Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 23840 - invalid RAND_MAX redefinition, fix implicit declarations [gcc -O2 failure]
invalid RAND_MAX redefinition, fix implicit declarations [gcc -O2 failure]
Product: Red Hat Powertools
Classification: Retired
Component: vic (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Powers
Depends On:
  Show dependency treegraph
Reported: 2001-01-11 16:39 EST by Pekka Savola
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-01-12 11:30:17 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
fix RAND_MAX and implicit declarations (2.18 KB, patch)
2001-01-11 16:40 EST, Pekka Savola
no flags Details | Diff

  None (edit)
Description Pekka Savola 2001-01-11 16:39:50 EST
I've received a report that vic segfaults if you try to encode a stream.  Decoding works fine.

The encoder process segfaults at random() (I ran the core file through gdb) which uses 
RAND_MAX.  It has been erroneuously redefined due to incorrect ordering of #includes.

This patch fixes RAND_MAX and adds a few headers to fix some implicit declaration warnings.

Unfortunately, I haven't back from the reporter (who has been busy with other stuff) whether 
this fixed his problem or not.  But IMO this looks "correct" nevertheless.
Comment 1 Pekka Savola 2001-01-11 16:40:28 EST
Created attachment 7465 [details]
fix RAND_MAX and implicit declarations
Comment 2 Tim Powers 2001-01-12 09:44:46 EST
This patch doesn't allow the package to build at all. Here's what I am getting
with  gcc-2.96-70:

rtp/ntp-time.h:76: warning: decimal constant is so large that it is
codec/decoder-raw.cpp: In method `int RawDecoder::colorhist (u_int *)
codec/decoder-raw.cpp:105: warning: unused parameter `u_int *hist'
rm -f render/renderer.o; c++ -o render/renderer.o -c -O2 -g -W -Wall
-Wno-implicit-int -Wno-return-type -DLinux -DUSE_SHM -fsigned-char -DED_YBITS=4
-DSIGRET=void -DNLAYER=8 -I. -Icodec/tmndec -Icodec/tmn-x -Icodec/h263 -Irtp
-Irender -Inet -Ivideo -Icodec -I../common      -Icodec/jpeg -Icodec/p64 -I.
cc1plus: warning: Ignoring command line option '-Wno-implicit-int'
/tmp/ccAfxPga.s: Assembler messages:
/tmp/ccAfxPga.s:1407: Error: `%dl' not allowed with `cmpw'
/tmp/ccAfxPga.s:1485: Error: `%dl' not allowed with `cmpw'
/tmp/ccAfxPga.s:1506: Error: `%dl' not allowed with `cmpw'
make: *** [render/renderer.o] Error 1
Bad exit status from /var/tmp/rpm-tmp.62640 (%build)

Are you having problems with the build using the same version of gcc?

I'm marking this as won't fix since the patch breaks things.

Comment 3 Pekka Savola 2001-01-12 11:30:13 EST
This happens regardless of my patch.  This worked fine with non-errata GCC. This is probably
a bug in the code that was brought up by newer tools, not gcc problem exactly.

There seem to be a lot of unsigned vs signed comparisons.  Gcc might be pickier
about these of late.  'compw' assembler command in conjunction with %ld might 
point at this direction too.

I noticed if you remove the optimizations ('-O2') in Makefile CCOPT, this will compile fine.

Added Jakub to Cc: list.  Can you say outright what's causing this?
Comment 4 Tim Powers 2001-01-12 12:53:25 EST
OK. Patch applied, and built without -O2. Thanks.

I'm resolving this as "rawhide".


Note You need to log in before you can comment on or make changes to this bug.