Bug 14281

Summary: Build error on Debian unstable using gcc 4.7.1
Product: glibc Reporter: Daniel Schepler <dschepler>
Component: mathAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED WONTFIX    
Severity: enhancement CC: aj, hjl.tools, jrnieder
Priority: P2 Flags: fweimer: security-
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Attachments: Preprocessed s_isnan.c
Minimal file, should show the problem
Valgrind log from cc1 running on s_isnan.i
Minimal file, does show the problem

Description Daniel Schepler 2012-06-22 15:25:47 UTC
Created attachment 6468 [details]
Preprocessed s_isnan.c

When I try building glibc from git master branch on an up-to-date Debian sid amd64 system, with gcc-4.7 version 4.7.1-1, I get this error:

make  subdir=math -C math ..=../ subdir_lib
make[2]: Entering directory `/home/lfs/sources/glibc-2.16/math'
gcc ../sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c -c -std=gnu99 -fgnu89-inline  -O2 -Wall -Winline -Wwrite-strings -fmerge-all-constants -frounding-math -g -Wstrict-prototypes   -fPIC    -Wno-uninitialized   -D__NO_MATH_INLINES -D__LIBC_INTERNAL_MATH_INLINES -I../include -I/home/lfs/sources/libc-build/math -I/home/lfs/sources/libc-build -I../sysdeps/unix/sysv/linux/x86_64/64/nptl -I../sysdeps/unix/sysv/linux/x86_64/64 -I../nptl/sysdeps/unix/sysv/linux/x86_64 -I../nptl/sysdeps/unix/sysv/linux/x86 -I../sysdeps/unix/sysv/linux/x86 -I../sysdeps/unix/sysv/linux/x86_64 -I../sysdeps/unix/sysv/linux/wordsize-64 -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/inet -I../nptl/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../sysdeps/unix/x86_64 -I../nptl/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../nptl/sysdeps/x86_64/64 -I../sysdeps/x86_64/64 -I../sysdeps/x86_64/fpu/multiarch -I../sysdeps/x86_64/fpu -I../sysdeps/x86/fpu -I../sysdeps/x86_64/multiarch -I../nptl/sysdeps/x86_64 -I../sysdeps/x86_64 -I../sysdeps/x86 -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64/wordsize-64 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/wordsize-64 -I../sysdeps/ieee754 -I../sysdeps/generic -I../nptl  -I.. -I../libio -I.  -D_LIBC_REENTRANT -include ../include/libc-symbols.h  -DPIC -DSHARED     -o /home/lfs/sources/libc-build/math/s_isnan.os -MD -MP -MF /home/lfs/sources/libc-build/math/s_isnan.os.dt -MT /home/lfs/sources/libc-build/math/s_isnan.os 
../sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c:30:1: error: '__EI___isnan' aliased to external symbol '__GI___isnan'
make[2]: *** [/home/lfs/sources/libc-build/math/s_isnan.os] Error 1
make[2]: Leaving directory `/home/lfs/sources/glibc-2.16/math'
make[1]: *** [math/subdir_lib] Error 2
make[1]: Leaving directory `/home/lfs/sources/glibc-2.16'
make: *** [all] Error 2

Attaching s_isnan.i from running this command with -save-temps.

BTW, if I make -k, then aside from the inevitable errors from libc.a and libc.so not being built, the only errors I get are in s_isnan.c, s_finite.c, s_isnanf.c, and s_finitef.c.  And then later, in the others stage, fraiseexcpt.c.
Comment 1 H.J. Lu 2012-06-22 15:44:29 UTC
(In reply to comment #0)
> Created attachment 6468 [details]
> Preprocessed s_isnan.c
> 
> When I try building glibc from git master branch on an up-to-date Debian sid
> amd64 system, with gcc-4.7 version 4.7.1-1, I get this error:
> 

I can't reproduce it with

gcc version 4.7.2 20120622 (prerelease) (GCC) 

Have you tried FSF GCC 4.7.1?
Comment 2 Andreas Jaeger 2012-06-22 18:41:09 UTC
That's the same preprocessed file that my gcc 4.7.1 generates. So, this looks fine.

I suspect a bug in GCC, perhaps a distro specific patch you're using.
Comment 3 Andreas Jaeger 2012-06-22 18:44:16 UTC
Created attachment 6470 [details]
Minimal file, should show the problem

I'm attaching a small test case (just reduced your file to the minimal version). It should fail to compile on your system if you compile manually. If it does, please report it as bug against GCC since other GCC versions work just fine with this.
Comment 4 Daniel Schepler 2012-06-22 19:21:45 UTC
(In reply to comment #3)
> Created attachment 6470 [details]
> Minimal file, should show the problem
> 
> I'm attaching a small test case (just reduced your file to the minimal
> version). It should fail to compile on your system if you compile manually. If
> it does, please report it as bug against GCC since other GCC versions work just
> fine with this.

I couldn't reproduce the error with your attached file, whether I compiled just with "gcc -c s_isnan_min.i" or put in all the flags from the command line I posted.  On the other hand, "gcc -c s_isnan.i" does fail with the same error.
Comment 5 H.J. Lu 2012-06-22 19:47:28 UTC
(In reply to comment #4)
> 
> I couldn't reproduce the error with your attached file, whether I compiled just
> with "gcc -c s_isnan_min.i" or put in all the flags from the command line I
> posted.  On the other hand, "gcc -c s_isnan.i" does fail with the same error.

Use valgrind to see if there is anything odd.
Comment 6 Daniel Schepler 2012-06-22 20:02:45 UTC
Created attachment 6471 [details]
Valgrind log from cc1 running on s_isnan.i
Comment 7 Daniel Schepler 2012-06-22 20:04:36 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > 
> > I couldn't reproduce the error with your attached file, whether I compiled just
> > with "gcc -c s_isnan_min.i" or put in all the flags from the command line I
> > posted.  On the other hand, "gcc -c s_isnan.i" does fail with the same error.
> 
> Use valgrind to see if there is anything odd.

Hmm, yes, I do get a couple valgrind errors in cc1, attached.
Comment 8 H.J. Lu 2012-06-22 20:30:44 UTC
(In reply to comment #6)
> Created attachment 6471 [details]
> Valgrind log from cc1 running on s_isnan.i

It looks OK.  Please try FSF GCC 4.7.1.
Comment 9 Daniel Schepler 2012-06-22 22:42:42 UTC
(In reply to comment #8)
> (In reply to comment #6)
> > Created attachment 6471 [details]
> > Valgrind log from cc1 running on s_isnan.i
> 
> It looks OK.  Please try FSF GCC 4.7.1.

Finally finished the build of FSF GCC 4.7.1, with a configuration as close as possible to Debian's.  After the build, "`pwd`/gcc/xgcc -B`pwd`/gcc -c /tmp/s_isnan.i -o /tmp/s_isnan.o" works fine.

So, I guess now I need to file a bug on Debian gcc-4.7, and close this bug after I post a link to the Debian bug report.
Comment 10 Daniel Schepler 2012-06-22 23:23:24 UTC
Bug filed with Debian BTS: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=678589

Will wait some time to see Debian package maintainer's response, before I close this bug.
Comment 11 Andreas Jaeger 2012-06-23 19:18:19 UTC
*** Bug 14285 has been marked as a duplicate of this bug. ***
Comment 12 Daniel Schepler 2012-07-01 21:43:05 UTC
No response by debian-gcc on Debian bts #678589 so far...  Closing this bug.
Comment 13 Jonathan Nieder 2012-07-01 22:39:31 UTC
(In reply to comment #12)
> No response by debian-gcc on Debian bts #678589 so far...  Closing this bug.

Shouldn't it at least be documented somewhere so we don't get piles of
duplicate reports? (Not to mention making the lives of people building
glibc a little better.)
Comment 14 Daniel Schepler 2012-07-06 23:01:16 UTC
Created attachment 6512 [details]
Minimal file, does show the problem

I've found a reduced test case which does show the failure on Debian gcc.  It seems the previous inline definition is crucial to reproducing the failure.
Comment 15 Daniel Schepler 2012-07-07 00:36:24 UTC
FYI: I found that the Debian GCC patch causing this failure was a proposed patch from http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33763#c31 .
Comment 16 Jonathan Nieder 2012-10-03 03:34:39 UTC
Build still fails but doesn't seem to be documented at <http://sourceware.org/glibc/wiki/Release/2.16>, so reopening. If it's not easy to avoid tickling this gcc bug, maybe configure could check for it and error out early.
Comment 17 Andreas Jaeger 2012-11-16 11:09:40 UTC
GCC has now a patch committed that handles this situation correctly.

I ask Debian to update their compiler and replace the buggy patch with a fixed one and close this bug as WONTFIX since it's a bug in a distribution specific compiler that shouuld be fixed with an updated compiler.
Comment 18 Jonathan Nieder 2012-11-16 15:25:56 UTC
(In reply to comment #17)
> GCC has now a patch committed that handles this situation correctly.
> 
> I ask Debian to update their compiler and replace the buggy patch with a fixed
> one

The compiler bugfix was merged into Debian's gcc-4.7 package (version 4.7.2-3) on 6 October and enterered testing for Debian 7.0 (wheezy) yesterday. Previous Debian releases don't have gcc 4.7, so I don't think anyone will be running into this any more. Thanks, all.
Comment 19 Jackie Rosen 2014-02-16 17:44:05 UTC Comment hidden (spam)