Obscure bug in cc??
Wm. Scott `Spot' Draves
wsd at cs.brown.edu
Sun Jun 10 17:19:09 AEST 1990
I can't explain this behavior with the man pages, can anyone duplicate it?
It seems to be a bug in cc that only occurs when
1) compiling -g
2) linking -n
3) source file is named .i
4) there are no functions in the source file.
This is a sun4/330 running 4.0.3
-rwxr-xr-x 1 root staff 98304 Jul 12 1989 /usr/bin/cc*
Here's the transcript
% cd /tmp
/tmp
% mkdir test
% cd test
/tmp/test
% ls
% echo 'main(){}' > main.c
% echo 'int i;' > foo.i
% cat main.c
main(){}
% cat foo.i
int i;
% cc -g -c main.c
% cc -g -c foo.i
% cc main.o foo.o
% cc -n main.o foo.o
Undefined:
LL0
% nm foo.o
U LL0
00000004 C _i
% cc -c foo.i
% cc -n main.o foo.o
% mv foo.i foo.c
% cc -g -c foo.c
% cc -n main.o foo.o
% mv foo.c foo.i
% cc -g -c foo.i
% cc -n main.o foo.o
Undefined:
LL0
% nm foo.o
U LL0
00000004 C _i
% nm main.o
00000000 T _main
% cc -n -g main.o foo.o
Undefined:
LL0
% echo 'foo(){}' > foo.i
% cc -g -c foo.i
% nm foo.o
00000000 T _foo
%
Here's how foo.s looks when generated from foo.i:
% cat foo.s
.stabs "/tmp/test/",0144,0,0,LL0
.seg "data"
.stabs "int:t(0,0)=r(0,0);-2147483648;2147483647;",0x80,0,0,0
.stabs "char:t(0,1)=r(0,1);0;127;",0x80,0,0,0
<more>
and from foo.c:
% cat foo.s
.stabs "/tmp/test/",0144,0,0,LL0
.stabs "foo.c",0144,0,0,LL0
LL0:
.seg "data"
.stabs "int:t(0,1)=r(0,1);-2147483648;2147483647;",0x80,0,0,0
.stabs "char:t(0,2)=r(0,2);0;127;",0x80,0,0,0
<more>
It's missing exactly two lines.
Scott Draves Space... The Final Frontier
wsd at cs.brown.edu
uunet!brunix!wsd
More information about the Comp.sys.sun
mailing list