Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 154781

Summary: gcc-3.4.3 fails to compile numarray-1.2.3 (header problem)
Product: [Fedora] Fedora Reporter: Robert Ransom <rransom.8774>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3CC: ndbecker2
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-04-16 15:57:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Description Flags
source file preprocessed with -E -dD none

Description Robert Ransom 2005-04-14 03:26:30 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050323 Firefox/1.0.2 Fedora/1.0.2-1.3.1

Description of problem:
gcc 3.4.3 fails to compile libnumarraymodule.c in the numarray add-on for Python due to "errors" in /usr/include/fenv.h.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Download, compile, and install Python-2.4.1 from the source distribution at "" using the configure flags "--prefix='/opt/python-2.4.1' --enable-shared --enable-ipv6".
2. Download numarray-1.2.3 from SourceForge (project "numpy", package "numarray").  The SourceForge download page is located at "".  The file required is "numarray-1.2.3.tar.gz".
3. Unpack numarray into a convenient directory.
4. Run "/opt/python-2.4.1/bin/python2.4 build" in the numarray source directory.  This will fail.

Actual Results:  gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -IInclude/numarray -I/opt/python-2.4.1/include/python2.4 -c Src/libnumarraymodule.c -o build/temp.linux-i686-2.4/Src/libnumarraymodule.o
In file included from Src/libnumarraymodule.c:3621:
/usr/include/fenv.h: In function `int_overflow_error':
/usr/include/fenv.h:96: error: conflicting types for 'fegetenv'
/usr/include/fenv.h:96: error: previous declaration of 'fegetenv' was here
/usr/include/fenv.h:101: error: conflicting types for 'feholdexcept'
/usr/include/fenv.h:101: error: previous declaration of 'feholdexcept' was here
/usr/include/fenv.h:105: error: conflicting types for 'fesetenv'
/usr/include/fenv.h:105: error: previous declaration of 'fesetenv' was here
/usr/include/fenv.h:110: error: conflicting types for 'feupdateenv'
/usr/include/fenv.h:110: error: previous declaration of 'feupdateenv' was here
error: command 'gcc' failed with exit status 1

Expected Results:  numarray should have compiled properly with no errors ascribed to system header files.

Additional info:

This build failed with glibc-headers-2.3.5-0.fc3.1 and gcc-3.4.3-22.fc3.
This build previously succeeded with glibc-headers-2.3.5-0.fc3.1 and gcc-3.4.2-6.fc3.

Comment 1 Robert Ransom 2005-04-14 03:32:16 UTC
I should also have mentioned that the first two non-comment non-whitespace lines
of fenv.h are:

#ifndef _FENV_H
#define _FENV_H 1

Comment 2 Jakub Jelinek 2005-04-15 18:16:36 UTC
Can you please preprocess that file with -E -dD (plus the gcc options used
when compilining it, except -c) and attach here?

Comment 3 Robert Ransom 2005-04-15 23:21:55 UTC
Created attachment 113263 [details]
source file preprocessed with -E -dD

Comment 4 Robert Ransom 2005-04-16 03:10:28 UTC
This file includes <fenv.h> inside the function NA_checkFPErrors, and then later
undefines _FENV_H and includes <fenv.h> again inside the function
int_overflow_error.  It looks to me like gcc is now remembering the function
(and possibly type) declarations after the function that they first appeared in,
which contradicts the seventh item listed in gcc's "Incompatibilities" info node.

Comment 5 Jakub Jelinek 2005-04-16 15:57:57 UTC
Then it is broken.  See ISO C99, 7.1.2.  fenv.h is an ISO C99 standard header,
so following applies to it:
If used, a header shall be included outside of any external declaration or
definition, and it shall first be included before the first reference to any of
the functions or objects it declares, or to any of the types or macros it

void foo (void)
  typedef struct { int i; } T;
  extern void baz (T *);

void bar (void)
  typedef struct { int i; } T;
  extern void baz (T *);

which is what happens if you violate this in fenv.h case is invalid too, the two
baz declarations are incompatible.  See ISO C99, 6.2.7.  The 2 structs are in
the same translation unit, so the rule about comparing their tags and members
doesn't apply.
GCC included in FC3 release had a bug in same_translation_unit_p and
mistakenly handled this as if they were in different translation units because
of that bug.

Comment 6 Robert Ransom 2005-04-18 06:19:12 UTC
Thank you for your help.  I will send your explanation to the numarray developers.

Comment 7 Jakub Jelinek 2005-04-18 14:10:45 UTC
*** Bug 155232 has been marked as a duplicate of this bug. ***