On Tue, 12 Jul 2005, Nicholas Nethercote wrote: > Similarly, the left-shifting in ROR causes signed integer overflow (I think) > and so ROR relies on undefined behaviour. 20020508-3.c is similar.
To quote implement-c.texi: GCC does not use the latitude given in C99 only to treat certain aspects of signed @samp{<<} as undefined, but this is subject to change. Unless there is a shift by >= the width of the (promoted) type, this code is defined for GNU C. In any case, it is defined for gnu89 mode even if we start treating this as undefined in C99 mode; see pr7284-1.c. > My question is: what exactly is gcc.c-torture testing? It seems to be That GNU C code compiles or executes as expected for GNU C. > testing more than just C standard compliance, but also certain > undefined-but-desired behaviours, such as wrap-on-signed-overflow (at least in > some cases). Is that right? If so, other C compilers could be correct with 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. Note that gcc.c-torture/compile correctly contains many tests involving undefined behavior at runtime which implementations are required to translate in case the problem code is never executed. These serve to test that e.g. uninitialized variables do not crash the compiler. > respect to the C standard but not pass all the tests. I couldn't find any The GCC testsuite is a testsuite for GCC only, not for other compilers. -- Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/ [EMAIL PROTECTED] (personal mail) [EMAIL PROTECTED] (CodeSourcery mail) [EMAIL PROTECTED] (Bugzilla assignments and CCs)