alangen%ohe14.usc.edu@OBERON.USC.EDU (Anno Langen) (03/10/89)
I have noticed the following incompatibilty concerning returned structures when I used gcc to compile a file that was then linked with a library function from SunGKS2.2 which returns a structure. Following is the smallest example that reproduces the effect. Below is a script and a shar file. The shar file will create a dirctory "bug" in which the script can be reproduced. ------------------------------------------------------------------------------------ ohe14.usc.edu(15):make -k mix nomix cc -c -g testd.c gcc -v -traditional -g -c -o testg.o test.c gcc version 1.32 /usr/public/lib/gcc-cpp -v -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -traditional -D__HAVE_68881__ -Dmc68020 test.c /tmp/cca05403.cpp GNU CPP version 1.32 /usr/public/lib/gcc-cc1 /tmp/cca05403.cpp -quiet -dumpbase test.c -g -traditional -version -o /tmp/cca05403.s GNU C version 1.32 (68k, MIT syntax) compiled by GNU C version 1.32. as -mc68020 /tmp/cca05403.s -o testg.o gcc -o mix testd.o testg.o cc -g -c test.c cc -o nomix testd.o test.o ohe14.usc.edu(16):mix e = {8504, 0, 0} ohe14.usc.edu(17):nomix e = {1, 2, 3} ohe14.usc.edu(18): ---------------------------------------------------------------------------------------------- #!/bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #!/bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # bug # This archive created: Thu Mar 9 16:12:15 1989 export PATH; PATH=/bin:$PATH if test ! -d 'bug' then echo shar: creating directory "'bug'" mkdir 'bug' fi echo shar: entering directory "'bug'" cd 'bug' echo shar: extracting "'test.c'" '(113 characters)' if test -f 'test.c' then echo shar: over-writing existing file "'test.c'" fi cat << \SHAR_EOF > 'test.c' #include "test.h" main(){ Gevent e; e = f(); printf("e = {%d, %d, %d}\n", e.ws, e.dev, e.event_class); } SHAR_EOF echo shar: extracting "'test.h'" '(175 characters)' if test -f 'test.h' then echo shar: over-writing existing file "'test.h'" fi cat << \SHAR_EOF > 'test.h' typedef struct /* event */ { int ws; /* workstation */ int dev; /* device number */ int event_class; /* event class */ } Gevent; Gevent f(); SHAR_EOF echo shar: extracting "'testd.c'" '(114 characters)' if test -f 'testd.c' then echo shar: over-writing existing file "'testd.c'" fi cat << \SHAR_EOF > 'testd.c' #include "test.h" Gevent f() { Gevent res; res.ws = 1; res.dev = 2; res.event_class = 3; return res; } SHAR_EOF echo shar: extracting "'makefile'" '(232 characters)' if test -f 'makefile' then echo shar: over-writing existing file "'makefile'" fi cat << \SHAR_EOF > 'makefile' testd.o: testd.c cc -c -g testd.c testg.o: test.c gcc -v -traditional -g -c -o testg.o test.c test.o: test.c cc -g -c test.c nomix: testd.o test.o cc -o nomix testd.o test.o mix: testd.o testg.o gcc -o mix testd.o testg.o SHAR_EOF echo shar: extracting "'#script#'" '(672 characters)' if test -f '#script#' then echo shar: over-writing existing file "'#script#'" fi cat << \SHAR_EOF > '#script#' make -k mix nomix cc -c -g testd.c gcc -v -traditional -g -c -o testg.o test.c gcc version 1.32 /usr/public/lib/gcc-cpp -v -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -traditional -D__HAVE_68881__ -Dmc68020 test.c /tmp/cca05403.cpp GNU CPP version 1.32 /usr/public/lib/gcc-cc1 /tmp/cca05403.cpp -quiet -dumpbase test.c -g -traditional -version -o /tmp/cca05403.s GNU C version 1.32 (68k, MIT syntax) compiled by GNU C version 1.32. as -mc68020 /tmp/cca05403.s -o testg.o gcc -o mix testd.o testg.o cc -g -c test.c cc -o nomix testd.o test.o ohe14.usc.edu(16):mix e = {8504, 0, 0} ohe14.usc.edu(17):nomix e = {1, 2, 3} ohe14.usc.edu(18): SHAR_EOF echo shar: done with directory "'bug'" cd .. # End of shell archive exit 0
alangen%sal50.usc.edu@OBERON.USC.EDU (Anno Langen) (03/12/89)
I have noticed an incompatibilty concerning returned structures when I used gcc to compile a file that was then linked with a library function from SunGKS2.2 which returns a structure. Following is the smallest example that reproduces the effect. Below is a script and a shar file. The shar file will create a dirctory "bug" in which the script can be reproduced. ------------------------------------------------------------------------------------ ohe14.usc.edu(15):make -k mix nomix cc -c -g testd.c gcc -v -traditional -g -c -o testg.o test.c gcc version 1.32 /usr/public/lib/gcc-cpp -v -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -traditional -D__HAVE_68881__ -Dmc68020 test.c /tmp/cca05403.cpp GNU CPP version 1.32 /usr/public/lib/gcc-cc1 /tmp/cca05403.cpp -quiet -dumpbase test.c -g -traditional -version -o /tmp/cca05403.s GNU C version 1.32 (68k, MIT syntax) compiled by GNU C version 1.32. as -mc68020 /tmp/cca05403.s -o testg.o gcc -o mix testd.o testg.o cc -g -c test.c cc -o nomix testd.o test.o ohe14.usc.edu(16):mix e = {8504, 0, 0} ohe14.usc.edu(17):nomix e = {1, 2, 3} ohe14.usc.edu(18): ---------------------------------------------------------------------------------------------- #!/bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #!/bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # bug # This archive created: Thu Mar 9 16:12:15 1989 export PATH; PATH=/bin:$PATH if test ! -d 'bug' then echo shar: creating directory "'bug'" mkdir 'bug' fi echo shar: entering directory "'bug'" cd 'bug' echo shar: extracting "'test.c'" '(113 characters)' if test -f 'test.c' then echo shar: over-writing existing file "'test.c'" fi cat << \SHAR_EOF > 'test.c' #include "test.h" main(){ Gevent e; e = f(); printf("e = {%d, %d, %d}\n", e.ws, e.dev, e.event_class); } SHAR_EOF echo shar: extracting "'test.h'" '(175 characters)' if test -f 'test.h' then echo shar: over-writing existing file "'test.h'" fi cat << \SHAR_EOF > 'test.h' typedef struct /* event */ { int ws; /* workstation */ int dev; /* device number */ int event_class; /* event class */ } Gevent; Gevent f(); SHAR_EOF echo shar: extracting "'testd.c'" '(114 characters)' if test -f 'testd.c' then echo shar: over-writing existing file "'testd.c'" fi cat << \SHAR_EOF > 'testd.c' #include "test.h" Gevent f() { Gevent res; res.ws = 1; res.dev = 2; res.event_class = 3; return res; } SHAR_EOF echo shar: extracting "'makefile'" '(232 characters)' if test -f 'makefile' then echo shar: over-writing existing file "'makefile'" fi cat << \SHAR_EOF > 'makefile' testd.o: testd.c cc -c -g testd.c testg.o: test.c gcc -v -traditional -g -c -o testg.o test.c test.o: test.c cc -g -c test.c nomix: testd.o test.o cc -o nomix testd.o test.o mix: testd.o testg.o gcc -o mix testd.o testg.o SHAR_EOF echo shar: done with directory "'bug'" cd .. # End of shell archive exit 0