What version of gcc version 4.x should I use?

In the product group I work in, gcc 3.4.6 is currently used (we know that it is ancient) for a large low-level c-code base and want to upgrade to a later version. We saw performance benefits by testing different versions of gcc 4.x on all the hardware platforms we tested on. However, we are very afraid of c-compiler errors (for a known reason historically) and are wondering if anyone has an idea about which version we should upgrade to.

Are people using 4.3.2 for large codebases and feel like they are working fine?

+6
c gcc
source share
6 answers

The best quality control for gcc is the linux kernel. GCC is the compiler of choice for major open source C / C ++ programs. A released GCC, especially one such as 4.3.X, which is found in the main linux distributions, should be pretty good.

GCC 4.3 also has better support for optimization on the new processor.

+4
source share

When I migrated the project from GCC 3 to GCC 4, I conducted several tests to ensure that the behavior was the same before and after. Can you run a set of (hopefully automated) tests to confirm the correct behavior? In the end, you want the โ€œrightโ€ behavior, not necessarily the behavior of GCC 3.

+4
source share

I do not have a specific version for you, but why not install 4.X and 3.4.6? Then you can try to save the compilation of the code in both versions, and if you encounter the error of stopping the show at 4, you will have an exit policy.

+1
source share

Use the latest version, but track down and understand every warning -Wall . For added fun, there are more warning flags for frob. You have an extensive set of regression tests (and others), run them all and test them.

GCC (notably C ++, but also C) has changed a lot. It significantly improves code analysis and optimization and processes code that, as it turns out, causes undefined bahaviiour in different ways. Therefore, code that "worked fine" but really relied on a specific interpretation of invalid constructs would probably break. We hope that the compiler will issue a warning or error, but does not guarantee such luck.

+1
source share

If you are interested in OpenMP, you will need to upgrade to gcc 4.2 or higher. We use 4.2.2 based on code of about 5M lines and do not experience any problems with it.

0
source share

I can't say anything about 4.3.2, but my laptop is a Gentoo Linux system built with GCC 4.3. {0,1} (depending on when each package was built), and I did not see any problems, This is basically just desktop use. If you have any weird code, your mileage may vary.

0
source share

All Articles