Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Repository of buggy compiler versions for C++11 support

Tags:

c++

c++11

build

I have a C++ soft that gets compiled with different OSes, platforms & compilers. Now sometimes compiler have bugs e.g. for instance this one, which implies that gcc versions pre 4.6.4 and pre 4.7.3 are a no-go. Now i could include a unit test that showcases the bug (and perhaps this question will reveal that indeed that's what I should be doing) but this is a tedious task: compiler bugs are sometimes hard to repro and turning one into a unit test might not be easy either... and that's when you have the platform & compiler at hand.

What I'm looking for is a repository that tells me which versions of g++, clang++ and msvc++ suffers from fatal bugs for supporting C++11 (i'm not talking about missing features, when features are not there I work around them). I would then fatal crash when building with them in the build system. Nice feature is, I'm not even forced to hit a bug to ban a compiler (so I'm saving myself future trouble).

Does such a list exist?

like image 791
Gurg Hackpof Avatar asked Dec 02 '22 19:12

Gurg Hackpof


2 Answers

This is probably not the answer you are looking for, but I believe the correct way to deal with this is to have a white-list, rather than a black-list. In other words, have a list of compilers that you know works, and if the customer tries to build using a different version than the ones you have tested with, you issue a warning message as part of the build script saying something like this:

This compiler is not supported, please see http://www.example.com/list_of_supported_compilers.html for a list of compilers we support. If you choose to continue using this compiler, feel free to do so, but don't expect full support from our tech-support, if you find a problem.

The reason I say this is that:

  1. You will not be able to prove that EVERY version other than what is on your blacklist works correctly. You can, however, for whatever testcases you have, prove that compiler X version a.b.c-d works [this doesn't mean that this compiler is bug free - just that you haven't hit any of those bugs in your testing!]
  2. Even if the compiler is "known good" (by whatever standard that is defined), your particular code may trigger bugs that affect your code.

Any sufficiently large software (or hardware) product will have bugs. You can only show that your software works by testing it. Relying on external "there is known bug in version such and such of compiler X" will not help you avoid bugs affecting your code. Having said that, most compilers are fairly well tested, so you (usually) need to do some fairly unusual/complicated things to make the compiler fail.

like image 200
Mats Petersson Avatar answered Dec 24 '22 12:12

Mats Petersson


Investigate Boost.Config, in particular the header <boost/config.hpp>.

This includes a large group of macros for a wide variety of compilers (and different versions there of) which indicate which C++ features are enabled, broken etc. It also includes a comprehensive test suite which can be used to test any new compiler for missing features etc.

like image 33
Robert Ramey Avatar answered Dec 24 '22 11:12

Robert Ramey