This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/40524] New: gcc 4.4.0 failure of: e1 ? e2 : e3 on Solaris (several machines, all configured differently)
- From: "david dot kirkby at onetel dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Jun 2009 23:39:00 -0000
- Subject: [Bug c/40524] New: gcc 4.4.0 failure of: e1 ? e2 : e3 on Solaris (several machines, all configured differently)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
One of the MPFR developers sent me this test program, which I've called test.c
You would expect both print statements to be the same, as exactly the same
things are being compared, but in fact the output is different with gcc-4.4.0
on Solaris to that with other versions of gcc.
drkirkby@kestrel:[~] $ cat test.c
#include <stdio.h>
#include <limits.h>
int main (void) {
long int exp = LONG_MIN;
printf ("%lu\n", (exp < (long int) 2 ? 2 : (unsigned long int) exp));
printf ("%lu\n", (exp < (long int) 2 ? 2 : 3));
return 0;
}
drkirkby@kestrel:[~] $ gcc test.c
drkirkby@kestrel:[~] $ ./a.out
2147483648
2
The code works as expected with gcc 3.4.3 on both SPARC machines, and gcc 4.3.2
on the other machine.
drkirkby@kestrel:[~] $ /usr/sfw/bin/gcc test.c
drkirkby@kestrel:[~] $ ./a.out
2
2
The failure appears on 3 different machines - two are SPARC based Suns, and
another is an x_64 machine, which was probably running Solaris, but I can't
confirm that yet.
1) A Sun Blade 2000, running Solaris 10 update 6, where gcc was configured to
use the Sun linker and assembler.
drkirkby@kestrel:[~] $ uname -a
SunOS kestrel 5.10 Generic_139555-08 sun4u sparc SUNW,Sun-Blade-1000
drkirkby@kestrel:[~] $ gcc -v
Using built-in specs.
Target: sparc-sun-solaris2.10
Configured with: ../gcc-4.4.0/configure CC=/usr/sfw/bin/gcc
--prefix=/export/home/drkirkby/install-gcc-4.4.0-Sun-as-ld
--with-as=/usr/ccs/bin/as --without-gnu-as --with-ld=/usr/ccs/bin/ld
--without-gnu-ld --enable-languages=c,c++,fortran
--with-mpfr-include=/export/home/drkirkby/install-mpfr-2.3.1/include
--with-mpfr-lib=/export/home/drkirkby/install-mpfr-2.3.1/lib
--with-gmp-include=/export/home/drkirkby/install-gmp-4.3.1/include
--with-gmp-lib=/export/home/drkirkby/install-gmp-4.3.1/lib
--with-libiconv-prefix=/usr/local
Thread model: posix
gcc version 4.4.0 (GCC)
2) A Sun T5240 where gcc was configured to use the GNU linker and assembler.
(bintuils 2.19.1)
kirkby@t2:[~] $ uname -a
SunOS t2 5.10 Generic_127111-09 sun4v sparc SUNW,T5240
kirkby@t2:[~] $ gcc -v
Using built-in specs.
Target: sparc-sun-solaris2.10
Configured with: ../gcc-4.4.0/configure --with-gnu-as
--with-as=/home/kirkby/bin/as --with-gnu-ld --with-ld=/home/kirkby/bin/ld
--with-gmp=/home/kirkby/dependencies/ --with-mpfr=/home/kirkby/dependencies/
--enable-languages=c,c++,fortran --prefix=/home/kirkby/dependencies/
Thread model: posix
gcc version 4.4.0 (GCC)
3) A 64-bit machine, which I *think* was running Solaris, but I've no idea
exactly what version, or how gcc was compiled.
--
Summary: gcc 4.4.0 failure of: e1 ? e2 : e3 on Solaris (several
machines, all configured differently)
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: david dot kirkby at onetel dot net
GCC build triplet: SunOS kestrel 5.10 Generic_139555-08 sun4u sparc
SUNW,Sun-Blade-
GCC host triplet: SunOS kestrel 5.10 Generic_139555-08 sun4u sparc
SUNW,Sun-Blade-
GCC target triplet: SunOS kestrel 5.10 Generic_139555-08 sun4u sparc
SUNW,Sun-Blade-
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40524