Can analysis detect undefined expressions?

Dale Worley worley at compass.com
Sat Jun 22 00:45:56 AEST 1991


In article <6622.Jun2023.40.0891 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
   In article <WORLEY.91Jun18095521 at sn1987a.compass.com> worley at compass.com (Dale Worley) writes:
     [ on statements like (i = 1) == (i = 2) ]
   > The effect of this statement is "undefined", [...]

   More realistically, there do exist architectures where parts of the
   first assignment can overlap parts of the second. 

Or consider this:  Suppose the statement is

	(i = 100000) == (i = 1)

And suppose that the two assignments are performed by two parallel
processors.  And suppose that assignment to a (4-byte) int is *not*
atomic -- each processor has to perform it as two 2-byte stores.  The
result left in 'i' may have the high-order part from one assignment
and the low-order part from the other, giving the possible values:

	100000
	65537
	34464
	1

Dale Worley		Compass, Inc.			worley at compass.com
--
Managing computer programmers is like herding cats.



More information about the Comp.lang.c mailing list