From: Matt H. <ma...@cs...> - 2005-08-09 18:43:50
|
> -----Original Message----- > From: cil...@li... > [mailto:cil...@li...] On Behalf Of > John Regehr > Sent: Tuesday, August 09, 2005 8:54 AM > To: cil...@li... > Subject: Re: [CIL users] CIL/gcc difference of opinion > > Sorry to keep harping on this topic but I think I've pinned > down some inconsistent behavior in CIL. > > When passed the program at the bottom of my mail CIL > evaluates the first argument to f2() first, since the return > value of f1() is put into a temp while glob1 is not. On the > other hand, if I pass this sort of code to CIL: > > f(x++,x++) > > then CIL always evaluates the second argument first. If you want consistent right-to-left evaluation of arguments, you'll have to change cabs2cil.ml to force all arguments to be assigned to temporaries. This should be sufficient, since cabs2cil is already looping over the args in right-to-left order. I'm guessing the easiest way to do this is to change the AExp case of finishExp in doExp. Create a new temporary, and add to the end of the chunk a Set of the expression to that temporary. Or just change your random program generator to only emit functions with a single argument. :-) -- Matt |