This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."


On 30 Dec 2006 03:20:11 +0100, Gabriel Dos Reis
<gdr@integrable-solutions.net> wrote:
...
The C standard, in effect, has an appendix (Annex H) that was not
there in the C89 edition, and that talks about the very specific issue
at hand

H.2.2 Integer types

       [#1] The signed C integer types int,  long  int,  long  long
       int,  and  the  corresponding  unsigned types are compatible
       with LIA-1.  If an implementation adds support for the LIA-1
       exceptional  values  ``integer_overflow'' and ``undefined'',
       then those types are LIA-1 conformant types.   C's  unsigned
       integer  types  are  ``modulo''  in  the LIA-1 sense in that
       overflows  or  out-of-bounds  results  silently  wrap.    An
       implementation  that  defines  signed  integer types as also
       being modulo need not  detect  integer  overflow,  in  which
       case, only integer divide-by-zero need be detected.

which clearly says LIA-1 isn't a requirement - notice "if" in the second setence. H.1 makes it clear that the entire Annex H doesn't add any extra rule to the language but merely describes what C is in regard to LIA-1. H.2 doubly makes it clear that C as it defined isn't LIA-1 - again, notice "if" in H.2p1. The second sentence of H.3p1 confirms this again:

  C's operations are compatible with LIA−1 in that C
  allows an implementation to cause a notification to occur
  when any arithmetic operation
  returns an exceptional value as defined in LIA−1 clause 5.

i.e. "compatible" means C's definition doesn't prevent
a LIA-1 conformant implementation.
In other words, all LIA-1 comformant compiler is conformant to C99
in terms of arithmetic and types.
However, not all C99 conformant compiler aren't LIA-1 conformant.
C isn't conformant to LIA-1 but merely compatible,
exactly because of the undefined aspect.

That's enough playing a language laywer for me in a day.
--
#pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com";


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]