NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: toolchain/46033: gcc miscompiles tcl config test
The following reply was made to PR toolchain/46033; it has been noted by GNATS.
From: David Brownlee <abs%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: port-vax%netbsd.org@localhost
Subject: Re: toolchain/46033: gcc miscompiles tcl config test
Date: Tue, 1 May 2012 12:30:14 +0100
Had a quick play and found something interesting - this only shows up
under the native compiler, not a cross compiler
./build.sh -m vax ... tools
.../vax--netbsdelf-gcc -O2 -c conftest.c ; scp conftest.o root@vax
vax# cc -o a.out conftest.o ; ./a.out
[... valid output ...]
Not that this particularly helps, just to show that the test shows up
an issue in the compiler compiling gcc source, rather than itself :)
(Tested with -O2, -O and no -O)
[original source below]
> With gcc 4.5.3 the following (closely based on a config test from pkgsrc/=
lang/tcl)
> fails to complete:
>
> #include <ctype.h>
> #include <stdlib.h>
> #include <stdio.h>
>
> #define ISLOWER(c) ('a' <=3D (c) && (c) <=3D 'z')
> #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
> #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
>
> int main ()
> {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0int i;
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0for (i =3D 0; i < 256; i++) {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0printf("testing wi=
th i =3D %d\n", i);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (XOR (islower (=
i), ISLOWER (i))
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|| t=
oupper (i) !=3D TOUPPER (i))
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0exit(2);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 =C2=A0 =C2=A0printf("done\n");
> =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;
> }
>
> Compiling this causes strange warnings
>
> conftest.c:16:7: warning: 'iftmp.4' may be used uninitialized in this fun=
ction
>
> and the value of i is always 0.
Home |
Main Index |
Thread Index |
Old Index