Red Hat Bugzilla – Bug 23840
invalid RAND_MAX redefinition, fix implicit declarations [gcc -O2 failure]
Last modified: 2008-05-01 11:37:59 EDT
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.
Created attachment 7465 [details]
fix RAND_MAX and implicit declarations
This patch doesn't allow the package to build at all. Here's what I am getting
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.
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?
OK. Patch applied, and built without -O2. Thanks.
I'm resolving this as "rawhide".