global vars and symbol visibility for mips32/elf
Nick Ing-Simmons
nik@tiuk.ti.com
Wed Aug 14 00:18:00 GMT 1996
Ruediger Helsch <rh@unifix.de> writes:
>But the standard allows such behaviour only if no strictly
>standard-conforming program is broken by the extension. The following
>program is strictly conforming and should continue to run:
>
> #include <assert.h>
> int optind[30000], optarg[30000];
>
> main()
> {
> int i;
> for (i = 0; i < 30000; i++) {
> optind[i] = 1;
> optarg[i] = 2;
> }
>
> for (i = 0; i < 30000; i++) {
> assert(optind[i] == 1);
> assert(optarg[i] == 2);
> }
> return 0;
> }
>
>Try this to see whether your compiler conforms to the C standard!
>
FWIW - gcc-2.7.2 (using /usr/ccs/bin/ld) , Solaris 2.5
gcc x.c -o x
ld: warning: symbol `optind' has differing sizes:
(file /var/tmp/cca006vl1.o value=0x1d4c0; file /usr/lib/libc.so value=0x4);
/usr/lib/libc.so definition taken
ld: warning: symbol `optarg' has differing sizes:
(file /var/tmp/cca006vl1.o value=0x1d4c0; file /usr/lib/libc.so value=0x4);
/usr/lib/libc.so definition taken
pluto 5% x
Segmentation Fault (core dumped)
Identical results with SunPro cc ...
More information about the Gas2
mailing list