[comp.lang.c] 'cc' versus 'gcc'

misha@sunnie.Huji.AC.IL (Michael Pak) (09/26/89)

Hi, there.

   I have recently discovered a 'gcc' compiler on our system.
When I began using it, it appeared that the code runs now much faster
than the one produced by the standard 'cc'. But a while ago,
somebody told me to stay away from this 'gcc', since it has quite
a few serious bugs in producing code. He said, that it sometimes
produces incorrect code, and the program does things it was not
supposed to do.
Since I have never encountered any bugs whatsoever (and I use it very
extensively) I would like to ask whether you have encountered any bugs,
and if you did, I would appreciate if you can send me their description.
And also, if you have any benchmark results, I would like
to see them very much.


                     Thanks.

jimp@asterix.UUCP (Jim Patterson) (09/28/89)

In article <506@shuldig.Huji.Ac.IL> misha%shum.huji.ac.il@CUNYVM.CUNY.EDU writes:
>   I have recently discovered a 'gcc' compiler on our system.
>When I began using it, it appeared that the code runs now much faster
>than the one produced by the standard 'cc'. ...
>I would like to ask whether you have encountered any bugs,

We tried out gcc on our system (Sun 3's), and never encountered what
could be called a 'bug'. (If you have different hardware, this experience
may not relate). We did encounter a few differences between calling
conventions of gcc and those of Sun's compiler. These are relevant
only if you mix the two languages.

The differences that we encountered (there are likely others) are:

- A function declared as returning float actually returns a float
with gcc. cc promotes the float to double. Both are consistent
with the ANSI draft standard. The only time this causes problems
are: if an external reference declares a function float but the
declaration is actually double (works with cc, not with gcc);
or the function is declared float, and the implementation is
compiled with cc but the caller compiles with gcc.

- Struct alignments. gcc will allocate a struct containing a single
byte (or 8 bits or less of bit-fields) to be 1 byte long. cc allocates
a minimum of 2 bytes for any struct.

-- 
Jim Patterson                              Cognos Incorporated
UUCP:decvax!utzoo!dciem!nrcaer!cognos!jimp P.O. BOX 9707    
PHONE:(613)738-1440                        3755 Riverside Drive
                                           Ottawa, Ont  K1G 3Z4