This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix handling of call clobbering readonly-result


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]