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]

Re: /internet



  In message <19981216162248.Z22090@perlsupport.com>you write:
  > According to Joe Buck:
  > > NCEG:
  > > >        Thus,  the result of the sum (a + 32760) is next added to b,
  > > >        and that result is then added to  5  which  results  in  the
  > > >        value  assigned  to  a.   On  a  machine  in which overflows
  > > >        produce an explicit trap and in which the  range  of  values
  > > >        representable   by   an   int   is   [-32768,  +32767],  the
  > > >        implementation cannot rewrite this expression as
  > > > 
  > > >                a = ((a + b) + 32765);
  > > 
  > > Amazing.  These guys are trying to turn C into Ada.
  > 
  > Hey, it only applies to machines where integer overflows trap.  Would
  > it be a problem to say that EGCS targets should never include such
  > environments?  Integer overflow traps are almost unheard of in C.
We'd have to introduce some new code to handle such an architecture if
one was to ever come along.

Right now GCC assumes integer instructions do not trap on overflow and wrap
in the expected manner.  As long as gcc is presented with that kind of
architecture it can reassociate integer operations in useful ways.

Some of gcc's existing targets have instructions which trap on overflow, but
they also include corresponding instructions which do not trap.  GCC uses
the non trapping variants.



jeff


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