Bug 154781 - gcc-3.4.3 fails to compile numarray-1.2.3 (header problem)
gcc-3.4.3 fails to compile numarray-1.2.3 (header problem)
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
3
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
: 155232 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-04-13 23:26 EDT by Robert Ransom
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-04-16 11:57:57 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Robert Ransom 2005-04-13 23:26:30 EDT
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):
gcc-3.4.3-22.fc3

How reproducible:
Always

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-13 23:32:16 EDT
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 14:16:36 EDT
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 19:21:55 EDT
Created attachment 113263 [details]
source file preprocessed with -E -dD
Comment 4 Robert Ransom 2005-04-15 23:10:28 EDT
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 11:57:57 EDT
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
defines.

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 02:19:12 EDT
Thank you for your help.  I will send your explanation to the numarray developers.
Comment 7 Jakub Jelinek 2005-04-18 10:10:45 EDT
*** 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.