public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, middle-end]: Fix PR67619, ICE at -O1 and above in int_mode_for_mode, at stor-layout.c
@ 2015-09-18 16:45 Uros Bizjak
  2015-09-19 18:45 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2015-09-18 16:45 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 660 bytes --]

Hello!

When expanding __bultin_eh_return, its address pointers can degrade to
a modeless constant. Use copy_addr_to_reg to always give temporary
register a Pmode.

2015-09-18  Uros Bizjak  <ubizjak@gmail.com>

    PR middle-end/67619
    * except.c (expand_builtin_eh_return): Use copy_addr_to_reg to copy
    the address to a register.

testsuite/ChangeLog:

2015-09-18  Uros Bizjak  <ubizjak@gmail.com>

    PR middle-end/67619
    * gcc.dg/torture/pr67619.c: New test.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Committed to mainline SVN as obvious, the patch will be backported to
other release branches in a couple of days.

Uros.

[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 1290 bytes --]

Index: testsuite/gcc.dg/torture/pr67619.c
===================================================================
--- testsuite/gcc.dg/torture/pr67619.c	(revision 0)
+++ testsuite/gcc.dg/torture/pr67619.c	(revision 0)
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+
+void
+foo ()
+{
+  unsigned long l;
+  void *p = 0; 
+
+  __builtin_unwind_init ();
+  l = 0; 
+  __builtin_eh_return (l, p);
+}
Index: except.c
===================================================================
--- except.c	(revision 227896)
+++ except.c	(working copy)
@@ -2219,7 +2219,7 @@ expand_builtin_eh_return (tree stackadj_tree ATTRI
 		     VOIDmode, EXPAND_NORMAL);
   tmp = convert_memory_address (Pmode, tmp);
   if (!crtl->eh.ehr_stackadj)
-    crtl->eh.ehr_stackadj = copy_to_reg (tmp);
+    crtl->eh.ehr_stackadj = copy_addr_to_reg (tmp);
   else if (tmp != crtl->eh.ehr_stackadj)
     emit_move_insn (crtl->eh.ehr_stackadj, tmp);
 #endif
@@ -2228,7 +2228,7 @@ expand_builtin_eh_return (tree stackadj_tree ATTRI
 		     VOIDmode, EXPAND_NORMAL);
   tmp = convert_memory_address (Pmode, tmp);
   if (!crtl->eh.ehr_handler)
-    crtl->eh.ehr_handler = copy_to_reg (tmp);
+    crtl->eh.ehr_handler = copy_addr_to_reg (tmp);
   else if (tmp != crtl->eh.ehr_handler)
     emit_move_insn (crtl->eh.ehr_handler, tmp);
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, middle-end]: Fix PR67619, ICE at -O1 and above in int_mode_for_mode, at stor-layout.c
  2015-09-18 16:45 [PATCH, middle-end]: Fix PR67619, ICE at -O1 and above in int_mode_for_mode, at stor-layout.c Uros Bizjak
@ 2015-09-19 18:45 ` Andreas Schwab
  2015-09-20 18:18   ` Uros Bizjak
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2015-09-19 18:45 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches

Uros Bizjak <ubizjak@gmail.com> writes:

>     PR middle-end/67619
>     * gcc.dg/torture/pr67619.c: New test.

On ia64:

FAIL: gcc.dg/torture/pr67619.c   -O0  (test for excess errors)
Excess errors:
/usr/local/gcc/gcc-20150919/gcc/testsuite/gcc.dg/torture/pr67619.c:12:1: error: __builtin_eh_return not supported on this target

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, middle-end]: Fix PR67619, ICE at -O1 and above in int_mode_for_mode, at stor-layout.c
  2015-09-19 18:45 ` Andreas Schwab
@ 2015-09-20 18:18   ` Uros Bizjak
  0 siblings, 0 replies; 3+ messages in thread
From: Uros Bizjak @ 2015-09-20 18:18 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 466 bytes --]

On Sat, Sep 19, 2015 at 2:32 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Uros Bizjak <ubizjak@gmail.com> writes:
>
>>     PR middle-end/67619
>>     * gcc.dg/torture/pr67619.c: New test.
>
> On ia64:
>
> FAIL: gcc.dg/torture/pr67619.c   -O0  (test for excess errors)
> Excess errors:
> /usr/local/gcc/gcc-20150919/gcc/testsuite/gcc.dg/torture/pr67619.c:12:1: error: __builtin_eh_return not supported on this target

Fixed by attached testsuite patch.

Uros.

[-- Attachment #2: t.diff.txt --]
[-- Type: text/plain, Size: 809 bytes --]

Index: gcc.dg/torture/pr67619.c
===================================================================
--- gcc.dg/torture/pr67619.c	(revision 227909)
+++ gcc.dg/torture/pr67619.c	(working copy)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-require-effective-target builtin_eh_return } */
 
 void
 foo ()
Index: lib/target-supports.exp
===================================================================
--- lib/target-supports.exp	(revision 227908)
+++ lib/target-supports.exp	(working copy)
@@ -6449,3 +6449,13 @@
 	int (*fn) () = foo;
     }]
 }
+
+# Return 1 if target supports __builtin_eh_return
+proc check_effective_target_builtin_eh_return { } {
+    return [check_no_compiler_messages builtin_eh_return object {
+	void test (long l, void *p)
+	{
+	    __builtin_eh_return (l, p);
+	}
+    } "" ]
+}

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-20 18:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-18 16:45 [PATCH, middle-end]: Fix PR67619, ICE at -O1 and above in int_mode_for_mode, at stor-layout.c Uros Bizjak
2015-09-19 18:45 ` Andreas Schwab
2015-09-20 18:18   ` Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).