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]

{PING} [PATCH] Unshare RTL for __stack_chk_guard


On 4/20/10 5:31 PM, Maxim Kuvyrkov wrote:
The following patch fixes wrong code bug on m68k and, possibly, other
targets when -fstack-protector option is used. Consider the following
testcase:
...
The problem is in sharing DECL_RTL of __stack_chk_guard_decl.

Currently, RTL for __stack_chk_guard_decl can be shared across
functions. The RTL is "(mem (symbol_ref))" and m68k reloads
"(symbol_ref)" into a register to produce a valid memory reference,
hence, it becomes "(mem (reg))".

The problem is that the transformations are applied directly to
DECL_RTL(stack_chk_guard_decl), so all subsequent functions pick up
transformed RTL, which is, in general case, wrong.

The fix is to set RTX_FLAG(used) of DECL_RTL(stack_chk_guard_decl) to
"1". This will make transformations create local copies of DECL_RTL and
apply changes to that.

Ping.


--
Maxim Kuvyrkov
CodeSourcery
maxim@codesourcery.com
(650) 331-3385 x724


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