gcc3 vs 176.gcc

Dale Johannesen dalej@apple.com
Tue Jan 8 19:17:00 GMT 2002


On Tuesday, January 8, 2002, at 06:08 PM, dewar@gnat.com wrote:

> <<I'm not exactly sure what you're asking.  SPEC CPU2000 is a benchmark,
> not a test.  SPEC regards standards compliance as a desirable goal, but
> not a requirement.  They are more interested in portability.  There are
> other cases where SPEC has nonstandard usage.  For example, "long long"
> was used before it was in the standards.
>
> There is a difference between an extended feature, which the SPEC suite
> therefore tends to encourage people to implement, and undefined code,
> which means that a valid compiler can produce anything (presumably
> any such test may be easy to compile quick code for :-)

This particular code (from gcc 2.7.2.2) is undefined *according to the
standard*.  It is clear to a reader what it is supposed to do; indeed,
there is a nearby comment (perhaps dating back to RMS?) to the effect
that this is the maximally portable way of doing it.  (No longer true,
memset is more portable today.)  Gcc is within its rights to do
something else *according to the standard*, but this is not useful
behavior, not what you would expect from a good compiler.  There is
nothing sacred about the standard, after all.  I can't put it better
than RMS:

 > In C, we cannot divide all user code into "right" and "wrong" in this
 > kind of simple way, and certainly not based on the ISO standard.  That
 > standard is just the decisions of a certain committee (which I was a
 > member of) about what cases conforming compilers should commit to
 > support.  We must not let ourselves start thinking that C code is
 > "wrong", just because it is not conforming ISO C code.

(http://gcc.gnu.org/ml/gcc/1999-09n/msg00396.html)



More information about the Gcc mailing list