Typical/common?

Having virtually no experience with gcc, I'm amazed at the quality of the code generated by one vendor's version of it. I've found the code to be quite poor. When I told it to kick up the opimization, supposedly selecting an optimization to improve both speed and code size, the code was four times larger! I've also gotten error messages that are completely unrelated to the real problem and seemingly spurious error indications for which a cause cannot be found.

Is all this typical or common of other gcc's?

In looking at the 25 pages of compiler options in the user manual supplied and considering the results of using the compiler, I wonder if the Gnu people have added so many whistles and bells that they've lost sight of the main objective of a compiler.

Reply to
mojaveg
Loading thread data ...

That's the point about so-called free software. The cheese is free only in the mouse traps or trash bins.

The main objective of any compiler is making the development nice and easy. The quality of the code is a minor technical problem; you should be thankfull that it works at all.

Vladimir Vassilevsky

DSP and Mixed Signal Design Consultant

formatting link

Reply to
Vladimir Vassilevsky

Which vendor, what version of gcc, and what target?

"kicking up" the optimization implies that you don't know what the optimization levels mean. -O3 creates larger code in order to optimize speed and cache hits. For embedded systems, -Os (optimize for space) results in the smallest code. Also, don't forget to strip off the symbol table (-strip) or use size (-size) to determine the actual code size without all the debugging stuff.

Just because you can't find the error, doesn't mean it's not there.

Reply to
DJ Delorie

GCC's code quality varies a lot, repending of the target platform. You didn't indicate which architecture you were targetting; it might well be that this specific arch is quite poorly supported.

It might help to understand if you consider GCC to be more of a compiler framework, than a single compiler in itself. What it gains from the sheer amount of front-ends and back-ends for so many different platforms, it looses it in the inequality I mentionned previously.

Also, this vendor version (which I will assume is the official version from some point in time + a few custom patches) might be quite old. You might want to try building your own from recent sources, after googling a bit around for some hints or caveats.

Regards, D.

Reply to
D.

This is true, and the FSF have acknowledged this by 'rebranding' GCC. It's now the GNU Compiler Collection instead of the GNU C Compiler to reflect the different front and back ends used.

How good GCC is is difficult to say, in part because of this "what compiler are you using problem. However those who claim GCC to be the best compiler around are almost certainly wrong. It has certainly, for C at least, got a reasonable front end (I find the errors it generates useful most the time, and in that regard it _is_ better than most commercial compilers). The back ends are more technically demanding and I suspect not as much work goes into them, especially as multiple architechures are supported.

Things I don't like are it's non-standard extensions which are great for creating portability problems and are all too easy to trip up on - having a function called "index" is perfectly reasonable to me and I don't like it when my compiler with default options barfs on it. I'd also question its size. Ten years ago I remember downloading the then latest version of GCC which was about 6Mb. It's now around 40Mb. OK, there's been a few tweaks for e.g. C99, a couple of new front and back ends. Is that worth a seven fold increase in its size?

--
Andrew Smallshaw
andrews@sdf.lonestar.org
Reply to
Andrew Smallshaw

... snip ...

gcc 3.4 is about 3.7 MB, and 4.1 is about 4.5 MB. For DJGPP, compiling for the x86. I don't know where you got those numbers. You can easily setup an alias to force strict standards adherance:

alias cc=gcc -W -Wall -ansi -pedantic -Wwrite-strings -Wfloat-equal

-gstabs+ -O1 %1&

(one line) under messydos and 4dos.

--
Chuck F (cbfalconer at maineline dot net)
   Available for consulting/temporary embedded and systems.
Reply to
CBFalconer

He probably means the size of the source code. The full GCC 4.1.2 weights in at 39707720 bytes (bz2 compressed).

What should be mentionned is that this tarball contains everything and the kitchen sink, all language frontends (C, C++, Objective C, Ada, Fortran and Java), all backends, all runtimes, documentation, test suite and everything else. Therefore it's definitely not a good reference to compare to antique releases that contained way less stuff...

Regards, D.

Reply to
D.

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.