Article View: gnu.gcc.bug
Article #686GCC produces strange n_value on SunOS 4.0.3
From: goddard
Date: Wed, 04 Oct 1989 23:58
Date: Wed, 04 Oct 1989 23:58
52 lines
1520 bytes
1520 bytes
I compile a program with a single global integer, and then run nm on
the .o file. The value that nm prints for the integer is 8, but the
size of an integer is reported to be 4. I thought the value printed
by nm was supposed to be the size of the data item. Am I wrong or is
there a bug in GCC?
Here is the program:
#include <stdio.h>
int i;
main()
{
fprintf(stdout, "int (%d) float (%d) double (%d) long (%d)\n",
sizeof(int), sizeof(float), sizeof(double), sizeof(long));
}
I compile it:
gcc -c temp.c
gcc temp.o -o temp
and run it:
virus% temp
int (4) float (4) double (8) long (4)
virus%
and then run nm:
virus% nm temp.o
U __iob
U _fprintf
-> 00000008 C _i
0000002c T _main
00000000 t gcc_compiled.
virus%
but if I use cc instead of GCC, I get:
virus% cc -c temp.c
virus% cc temp.o -o temp
virus% temp
int (4) float (4) double (8) long (4)
virus% nm temp.o
U __iob
U _fprintf
-> 00000004 C _i
00000000 T _main
virus%
Technical Details
Message-ID:
<5343@hacgate.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!tut.cis.ohio-state.edu!cica!ctrsol!ginosko!usc!hacgate!goddard@aic.hrl.hac.comShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!tut.cis.ohio-state.edu!cica!ctrsol!ginosko!usc!hacgate!goddard@aic.hrl.hac.com From: goddard@aic.hrl.hac.com Newsgroups: gnu.gcc.bug Subject: GCC produces strange n_value on SunOS 4.0.3 Message-ID: <5343@hacgate.UUCP> Date: 4 Oct 89 23:58:48 GMT Sender: news@hacgate.UUCP Reply-To: goddard@aic.hrl.hac.com Distribution: gnu Organization: Hughes Aircraft Co., El Segundo, CA Lines: 52