Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 154781 - gcc-3.4.3 fails to compile numarray-1.2.3 (header problem)
Summary: gcc-3.4.3 fails to compile numarray-1.2.3 (header problem)
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 3
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
: 155232 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2005-04-14 03:26 UTC by Robert Ransom
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-04-16 15:57:57 UTC
Type: ---

Attachments (Terms of Use)
source file preprocessed with -E -dD (72.07 KB, application/x-bzip2)
2005-04-15 23:21 UTC, Robert Ransom
no flags Details

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 "http://www.python.org/ftp/python/2.4.1/Python-2.4.1.tar.bz2" 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 "http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=1351".  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 setup.py 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. ***

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