missing error message.
Geoff Keating
geoffk@ozemail.com.au
Tue Apr 20 20:09:00 GMT 1999
I did this:
struct foo
{
char c[2][2147483643];
int i;
char d;
};
#include <stdio.h>
int main(void)
{ printf ("%llx\n", (unsigned long long) sizeof(struct foo));
return 0; }
on my powerpc-unknown-linux-gnu egcs 1.1.1, and:
$ gcc -O -v -W -Wall l.c -o l
Reading specs from /usr/lib/gcc-lib/powerpc-unknown-linux-gnu/egcs-2.91.60/specs
gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
/usr/lib/gcc-lib/powerpc-unknown-linux-gnu/egcs-2.91.60/cpp -lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=91 -DPPC -D__ELF__ -Dunix -Dlinux -Dpowerpc -D__PPC__ -D__ELF__ -D__unix__ -D__linux__ -D__powerpc__ -D__PPC -D__unix -D__linux -D__powerpc -Asystem(unix) -Asystem(linux) -Acpu(powerpc) -Amachine(powerpc) -D__CHAR_UNSIGNED__ -D__OPTIMIZE__ -W -Wall -D_CALL_SYSV -D_BIG_ENDIAN -D__BIG_ENDIAN__ -Amachine(bigendian) -D_ARCH_PPC -D__unix__ -D__linux__ -Dunix -Dlinux -Asystem(unix) -Asystem(linux) l.c /tmp/ccOp5Y6T.i
GNU CPP version egcs-2.91.60 19981201 (egcs-1.1.1 release) (PowerPC GNU/Linux)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc-lib/powerpc-unknown-linux-gnu/egcs-2.91.60/include
/usr/include
End of search list.
/usr/lib/gcc-lib/powerpc-unknown-linux-gnu/egcs-2.91.60/cc1 /tmp/ccOp5Y6T.i -quiet -dumpbase l.c -O -W -Wall -version -o /tmp/ccMhbIr3.s
GNU C version egcs-2.91.60 19981201 (egcs-1.1.1 release) (powerpc-unknown-linux-gnu) compiled by GNU C version egcs-2.91.57 19980901 (egcs-1.1 release).
/usr/powerpc-unknown-linux-gnu/bin/as -mppc -V -Qy -o /tmp/ccJrOHek.o /tmp/ccMhbIr3.s
GNU assembler version 981225 (powerpc-unknown-linux-gnu) using BFD version 981225
/usr/lib/gcc-lib/powerpc-unknown-linux-gnu/egcs-2.91.60/collect2 -m elf32ppc -dynamic-linker /lib/ld.so.1 -o l /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc-lib/powerpc-unknown-linux-gnu/egcs-2.91.60/crtbegin.o -L/usr/lib/gcc-lib/powerpc-unknown-linux-gnu/egcs-2.91.60 -L/usr/powerpc-unknown-linux-gnu/lib /tmp/ccJrOHek.o /usr/lib/gcc-lib/powerpc-unknown-linux-gnu/egcs-2.91.60/libgcc.a -lc /usr/lib/gcc-lib/powerpc-unknown-linux-gnu/egcs-2.91.60/libgcc.a /usr/lib/gcc-lib/powerpc-unknown-linux-gnu/egcs-2.91.60/crtend.o /usr/lib/crtn.o
[geoffk@geoffk /tmp]$ ./l
0
I claim egcs should print a warning message when 'sizeof' overflows.
(The structure definition by itself should not be illegal because it
would be useful when trying to represent, for instance, a memory map).
Also, there should be an error message for:
struct foo
{
char c[2][2147483643];
int i, j;
char d;
};
because this structure is larger than any memory map on a 32-bit
machine.
--
Geoffrey Keating <geoffk@ozemail.com.au>
More information about the Gcc-bugs
mailing list