Path: 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 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 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%