This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix handling of call clobbering readonly-result
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Olivier Hainque <hainque at ACT-Europe dot FR>
- Cc: Richard dot Earnshaw at arm dot com, kenner at vlsi1 dot ultra dot nyu dot edu, gcc-patches at gcc dot gnu dot org
- Date: Thu, 08 May 2003 18:11:06 +0100
- Subject: Re: Fix handling of call clobbering readonly-result
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
This is just a working hypothesis at present as to what is going wrong.
The fundamental failure is coming from an incorrect cse'ing of the calls
to test3.
We then have
x <- 80.0
...
result = call test3(x)
if (result == 0)
abort();
...
x <- 100.0
...
resultb = call test3(x)
if (resultb != 0)
abort ();
test3 is being marked as const (it is), but cse may only treat the results
of calls to that function as being equivalent if the arguments (if any)
are the same; in this case they are not, but cse is doing exactly that,
and reducing the above to:
x <- 80.0
...
result = call test3(x)
if (result == 0)
abort();
...
x <- 100.0
...
resultb = call test3(x)
if (result != 0) // Note, incorrect cse
abort();
Which of course, then collapses (since we know that result != 0) to
x <- 80.0
...
result = call test3(x)
if (result == 0)
abort();
...
x <- 100.0
...
resultb = call test3(x)
abort ();
Unfortunately, I don't know enough about CSE to begin to fix this :-(
R.