Re: Unsafe Optimizations (WAS: Compiler Design in C How about it?)

moss@cs.umass.edu (Eliot Moss)
Thu, 14 Jun 90 15:27:40 GMT

          From comp.compilers

Related articles
[6 earlier articles]
Unsafe Optimizations (WAS: Compiler Design in C How about it?) stewart@sdsu.edu (1990-06-05)
Re: Unsafe Optimizations (WAS: Compiler Design in C How about it?) poser@csli.stanford.edu (1990-06-06)
Re: Unsafe Optimizations (WAS: Compiler Design in C How about it?) larus@primost.cs.wisc.edu (1990-06-07)
Re: Unsafe Optimizations (WAS: Compiler Design in C How about it?) tli@%phakt.usc.edu (1990-06-07)
Re: Unsafe Optimizations (WAS: Compiler Design in C How about it?) moss@cs.umass.edu (1990-06-10)
Re: Unsafe Optimizations (WAS: Compiler Design in C How about it?) cwitty@csli.Stanford.EDU (1990-06-14)
Re: Unsafe Optimizations (WAS: Compiler Design in C How about it?) moss@cs.umass.edu (1990-06-14)
Re: Unsafe Optimizations (WAS: Compiler Design in C How about it?) pardo@june.cs.washington.edu (1990-06-15)
| List of all articles for this month |

Newsgroups: comp.compilers
From: moss@cs.umass.edu (Eliot Moss)
References: <1990Jun14.032437.5554@esegue.segue.boston.ma.us>
Date: Thu, 14 Jun 90 15:27:40 GMT
Organization: Dept of Comp and Info Sci, Univ of Mass (Amherst)
Keywords: optimize, code
In-Reply-To: cwitty@csli.Stanford.EDU's message of 14 Jun 90 03:24:37 GMT

In article <1990Jun14.032437.5554@esegue.segue.boston.ma.us> cwitty@csli.Stanford.EDU (Carl Witty) writes:


      ... For example, on many machines, integer arithmetic
      really is commutative and associative.


I take Carl's point, and he is right about commutativity, but integer
arithmetic is not associative if overflow matters. If all you care about is
the result mod the word length (i.e., you do not have overflow trapping
enabled) then Carl is correct. There are some languages that detect and report
overflow where this would make a difference; it does not make a difference in
C. (I guess on the MIPS chip they always use the "unsigned" (no overflow)
instructions regardless of whether the operands are C "int" or "unsigned".)
Yours in nit picking :-) .....
--


J. Eliot B. Moss, Assistant Professor
Department of Computer and Information Science
Lederle Graduate Research Center
University of Massachusetts
Amherst, MA 01003
(413) 545-4206; Moss@cs.umass.edu
[The ANSI C standard has a specific example pointing this out. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.