Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!mouse From: mouse@thunder.mcrcim.mcgill.edu (der Mouse) Newsgroups: comp.lang.c Subject: Re: Can analysis detect undefined expressions? Message-ID: <1991Jun26.093935.5790@thunder.mcrcim.mcgill.edu> Date: 26 Jun 91 09:39:35 GMT References: <14489.2861906B@stjhmc.fidonet.org> Organization: McGill Research Centre for Intelligent Machines Lines: 47 In article <14489.2861906B@stjhmc.fidonet.org>, Dave.Harris@f14.n15.z1.fidonet.org (Dave Harris) writes: > In a message of , Dale Worley (1:114/15) writes: >> (j = ((i=1) == (i=2))) == (j = ((i=3) == (i=4))) >> Sorry to belabor this yet again, but there is no requirement in Ansi >> C that i have one of the values 1, 2, 3, or 4. > I for one would quickly scrap any compiler that went to the > additional work of embedding code to yield a value of anything other > than 1,2,3 or 4 for i. Let's rephrase that...I too would quickly scrap any compiler that went to the additional work of embedding unnecessary code. Period. However, if the architecture is such that assignments can happen in parallel, i could wind up holding 1|2|3|4, which happens to be 7. Or perhaps 1&2&3&4, which is 0. Or maybe i doesn't get changed at all. Or perhaps something else, including a run-time assignment collision fault from the parallel assignment hardware. > I would really like to see an example of code accomplishing > completely unexpected behavior as in setting i equal to 5. ON * RENDEZVOUS ; rendezvous (end of last statement) ON 0 MOV $1,i ; i=1 ON 1 MOV $2,i ; i=2 ON 2 MOV $3,i ; i=3 ON 3 MOV $4,i ; i=4 ON 4 MOV $0,j ; j = ((i=1) == (i=2)) ON 5 MOV $0,j ; j = ((i=3) == (i=4)) ON * RENDEZVOUS ; rendezvous again Or the optimizer might save code space by doing ON * RENDEZVOUS ON 0 MOV $0,j ; j = ((i=1) == (i=2)) ON 5 MOV $0,j ; j = ((i=3) == (i=4)) ON 1,2,3,4 MOV %PROCID,i ; i=1 / i=2 / i=3 / i=4 ON * RENDEZVOUS Of course, the hardware to execute that code probably doesn't exist at the moment, but that's beside the point. It's hardly a far-fetched architecture. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu