Bug 23840

Summary: invalid RAND_MAX redefinition, fix implicit declarations [gcc -O2 failure]
Product: [Retired] Red Hat Powertools Reporter: Pekka Savola <pekkas>
Component: vicAssignee: Tim Powers <timp>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: jakub
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-01-12 16:30:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
fix RAND_MAX and implicit declarations none

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
unsigned
codec/decoder-raw.cpp: In method `int RawDecoder::colorhist (u_int *)
const':
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.
render/renderer.cpp
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.

Tim

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".

Tim