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] |
Maxim Kuvyrkov wrote:
--- varasm.c.orig 2008-11-14 18:04:27.693643900 +0100 +++ varasm.c 2008-11-14 17:58:06.522748300 +0100 @@ -3245,7 +3245,7 @@ }
maybe_output_constant_def_contents (desc, defer); - return desc->rtl; + return copy_rtx (desc->rtl); }
This patch seems correct to me. It makes output_constant_def() always return a copy of the value rather than the value.
I will regtest this patch on ColdFire [where the miscompilation occurs], wound anyone volunteer to test it on x86[_64]?
-- Maxim
Unfortunately, there is no clear documentation on sharing of constant pool entries; however, upon reviewing the code in GCC itself, it appears to me the compiler expects entries in the constant pool to be shared. That would make your patch incorrect.
Instead we need to focus on the code which reloads the symbol into a register transforming (mem (symbol)) into (mem ((reg)). That code should be copying the MEM before modifying it. If you search for CONSTANT_POOL_ADDRESS in reload.c you'll see an example of what I mean.
/* 1 if RTX is a symbol_ref that addresses a value in the file's tree constant pool. This information is private to varasm.c. */ #define TREE_CONSTANT_POOL_ADDRESS_P(RTX) ...
-- Maxim
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |