Bug 23840 - invalid RAND_MAX redefinition, fix implicit declarations [gcc -O2 failure]
Summary: invalid RAND_MAX redefinition, fix implicit declarations [gcc -O2 failure]
Alias: None
Product: Red Hat Powertools
Classification: Retired
Component: vic
Version: 7.0
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Tim Powers
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2001-01-11 21:39 UTC by Pekka Savola
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

Clone Of:
Last Closed: 2001-01-12 16:30:17 UTC

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

Description Pekka Savola 2001-01-11 21:39:50 UTC
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 21:40:28 UTC
Created attachment 7465 [details]
fix RAND_MAX and implicit declarations

Comment 2 Tim Powers 2001-01-12 14:44:46 UTC
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 16:30:13 UTC
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 17:53:25 UTC
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.