[Ada] Fix ICE in insert_clobbers_for_var in SJLJ mode

Eric Botcazou ebotcazou@adacore.com
Sun Mar 25 17:14:00 GMT 2012


We have a call to builtin_alloca_with_align:

  S10b.27_153 = .builtin_alloca_with_align (5, 8);

and CCP replaces it with a static allocation:

  S10b.27_153 = &TMP;

and is trying to add a special out-of-scope CLOBBER for the new variable TMP,
under the assumption that every call to builtin_alloca_with_align is dominated 
by a call to builtin_stack_save.  But this isn't true here:

<bb 2>:
  FRAME.29.M17b = system.secondary_stack.ss_mark (); [return slot optimization]

<bb 3>:
  saved_stack.28_9(ab) = .builtin_stack_save ();

because the call to system.secondary_stack.ss_mark creates an abnormal edge to 
the setjmp dispatcher and we have a setjmp receiver after builtin_stack_save.

This is a latent issue and GCC 4.7+ now chokes on it.  The way out is to tell 
the compiler that system.secondary_stack.ss_mark is a well-behaved function, 
more precisely a "leaf" function.

Tested on i586-suse-linux, applied on the mainline and 4.7 branch.


2012-03-25  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/decl.c (SS_MARK_NAME): New define.
	(gnat_to_gnu_entity) <E_Function>: Prepend leaf attribute on entities
	whose name is SS_MARK_NAME.


2012-03-25  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/concat2.ad[sb]: New test.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 1505 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120325/d4741eaa/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: concat2.adb
Type: text/x-adasrc
Size: 318 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120325/d4741eaa/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: concat2.ads
Type: text/x-adasrc
Size: 100 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120325/d4741eaa/attachment-0002.bin>


More information about the Gcc-patches mailing list