Port-vax archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: toolchain/46033: gcc miscompiles tcl config test



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' <= (c) && (c) <= 'z')
> #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
> #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
>
> int main ()
> {
>        int i;
>
>        for (i = 0; i < 256; i++) {
>                printf("testing with i = %d\n", i);
>                if (XOR (islower (i), ISLOWER (i))
>                    || toupper (i) != TOUPPER (i))
>                        exit(2);
>        }
>        printf("done\n");
>        return 0;
> }
>
> Compiling this causes strange warnings
>
> conftest.c:16:7: warning: 'iftmp.4' may be used uninitialized in this function
>
> and the value of i is always 0.


Home | Main Index | Thread Index | Old Index