Patch for -fcheck-memory-usage correct operation

Will Cohen wcohen@redhat.com
Fri Nov 17 09:03:00 GMT 2000


 
If the -fcheck-memory-usage option is used, the compiler must take
steps to make sure that the values returned in hard registers are
saved in memory because additional calls to the memory check functions
can clobber the values in hard register before they are used.
However, the previous implementation didn't check that the target was
really a hard register.  This patch creates a new temporary only when
the return value is in a hard register.  Cases where the target is a
region of memory (e.g. structs and classes) were not handled
correctly, and a new temporary location was created to store the
information.  The result was that the data was never moved from the
temp location created in expand_call to the location indicated by the
parameter target.

I bootstrapped the patched compiler on a Pentium III machine running
RH 7 Linux machine (--host=i686-pc-linux-gnu) and the "make compare"
reported no differences.  The "make check" had no more failures than
the unpatched gcc.

Below is the ChangeLog entry and the patch is attached to the mail.

2000-11-17  Will Cohen  <wcohen@redhat.com>

	* calls.c (expand_call): Clear target only when target is in
	hard register and current_function_check_memory_usage is set.

-Will Cohen





More information about the Gcc-patches mailing list