Some tests in gcc.c-torture rely on undefined behaviour?

Ian Lance Taylor ian@airs.com
Tue Jul 12 18:39:00 GMT 2005


"Joseph S. Myers" <joseph@codesourcery.com> writes:

> Such tests are in general bugs.  You'd have to ask Torbjorn about what the 
> original purpose of the old parts of c-torture was, as that may have 
> differed from the current GCC testsuite, but invalid tests should be 
> removed (or, perhaps better, moved to gcc.c-torture/compile) or have 
> relevant options such as -fwrapv added.

The original purpose was simply to collect programs which caused the
compiler to fail.  When he saw a bug report with a test case, he
collected the test case, reduced it, and added it to the torture
tests.  The tests were simply run at various optimization levels.
Tests which caused the compiler to crash were put in compile, tests
which showed a miscompilation visible at run time were put in execute.

I would guess that 920612-1.c, at least, could just be changed to use
unsigned int, and it would continue to test whatever bug it was
testing when it was originally added.

Ian



More information about the Gcc mailing list