[comp.unix.questions] '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

davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) (09/29/89)

  Before using gcc your should read the license. If you compile and link
using their library you must make the source of your program available
to the public for three years. That may not be desirable in all cases.

  gcc is not bug free, but it is about as clean as most commercial
compilers. It has *deferent* bugs, not *more* bugs.

-- 
bill davidsen	(davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon

fischer@iesd.auc.dk (Lars P. Fischer) (10/08/89)

In article <7158@asterix.UUCP> jimp@asterix.UUCP (Jim Patterson) writes:
>We tried out gcc on our system (Sun 3's), and never encountered what
>could be called a 'bug'.
>..
>The differences that we encountered (there are likely others) are:
>...

AND of course:
  - better code generated (program runs faster).
  - you don't have to write "register int x' all over the place. GCC
    does register allocation.
  - ANSI compliance. You can do 'void f(int x){..}'.
  - you have the source.

GCC is really a very good product. As is all GNUware.
  
/Lars
--
Copyright 1989 Lars Fischer; you can redistribute only if your recipients can.
Lars Fischer,  fischer@iesd.auc.dk, {...}!mcvax!iesd!fischer
Department of Computer Science, University of Aalborg, DENMARK.

"That makes 100 errors; please try again" --TeX

fischer@iesd.auc.dk (Lars P. Fischer) (10/08/89)

In article <631@crdos1.crd.ge.COM> davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) writes:
>  Before using gcc your should read the license. If you compile and link
>using their library you must make the source of your program available
>to the public for three years.

Not so. Read the GNU Public License. Note that 'gnulib.c' (the runtime
system) is *not* copyrighted. If you compile with gcc, and link with
your systems 'ld' (the default) there is no problem.

When the GNU version of libc.a becomes available, all programs linked
with it will have to distributed as GNUware, *if* they are distributed
at all. You can of course still use your own version of libc.a if you
like.

>  gcc is not bug free, but it is about as clean as most commercial
>compilers. It has *deferent* bugs, not *more* bugs.

Actually, it has *fewer* bugs that most commercial compilers.

/Lars
--
Copyright 1989 Lars Fischer; you can redistribute only if your recipients can.
Lars Fischer,  fischer@iesd.auc.dk, {...}!mcvax!iesd!fischer
Department of Computer Science, University of Aalborg, DENMARK.

"That makes 100 errors; please try again" --TeX

jv@mh.nl (Johan Vromans) (10/09/89)

In article <FISCHER.89Oct7211012@dirac.iesd.auc.dk> fischer@iesd.auc.dk (Lars P. Fischer) writes:
> >  gcc is not bug free, but it is about as clean as most commercial
> >compilers. It has *deferent* bugs, not *more* bugs.
> 
> Actually, it has *fewer* bugs that most commercial compilers.

One of the reasons there is misconception about the number of bugs in
the gcc compiler, is because there is a wide platform (the USENET)
they are discussed on. Each time I get a new cc from one of my
vendors, there are tens to houndreds of errors corrected. Almost all
of these errors I did not know that they existed at all.  With gcc we
*KNOW* about most of the errors. That's the difference.

Johan
--
Johan Vromans				       jv@mh.nl via internet backbones
Multihouse Automatisering bv		       uucp: ..!{uunet,hp4nl}!mh.nl!jv
Doesburgweg 7, 2803 PL Gouda, The Netherlands  phone/fax: +31 1820 62944/62500
------------------------ "Arms are made for hugging" -------------------------

fischer@iesd.auc.dk (Lars P. Fischer) (10/09/89)

In article <JV.89Oct8125014@mhres.mh.nl> jv@mh.nl (Johan Vromans) writes:
>One of the reasons there is misconception about the number of bugs in
>the gcc compiler, is because there is a wide platform (the USENET)
>they are discussed on. Each time I get a new cc from one of my
>vendors, there are tens to houndreds of errors corrected. Almost all
>of these errors I did not know that they existed at all.  With gcc we
>*KNOW* about most of the errors. That's the difference.

If you want to now about errors in your compiler, try looking up
"known bugs" in the manual. Most likely, there'll be lots of 'em. With
GNU, when you report a bug, it gets fixed. With most (other) vendor,
it gets added to the "know bugs" list (new releases of GNUware nearly
always have the words "this release corrects all know bugs.."
somewhere).

GNUware--high performance software you can trust :-).

/Lars
--
Copyright 1989 Lars Fischer; you can redistribute only if your recipients can.
Lars Fischer,  fischer@iesd.auc.dk, {...}!mcvax!iesd!fischer
Department of Computer Science, University of Aalborg, DENMARK.

"That makes 100 errors; please try again" --TeX