OSDN Git Service

PR debug/51762
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 5 Jan 2012 20:47:16 +0000 (20:47 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 5 Jan 2012 20:47:16 +0000 (20:47 +0000)
* calls.c (emit_call_1): For noreturn calls force a REG_ARGS_SIZE
note when !ACCUMULATE_OUTGOING_ARGS.

* gcc.dg/pr51762.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182924 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/calls.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr51762.c [new file with mode: 0644]

index 7991f1a..e63604f 100644 (file)
@@ -1,3 +1,9 @@
+2012-01-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/51762
+       * calls.c (emit_call_1): For noreturn calls force a REG_ARGS_SIZE
+       note when !ACCUMULATE_OUTGOING_ARGS.
+
 2012-01-05  Eric Botcazou  <ebotcazou@adacore.com>
 
        * tree-vrp.c (extract_range_from_binary_expr_1): Remove duplicated
 2012-01-05  Eric Botcazou  <ebotcazou@adacore.com>
 
        * tree-vrp.c (extract_range_from_binary_expr_1): Remove duplicated
index c8d0b84..943ab09 100644 (file)
@@ -1,7 +1,7 @@
 /* Convert function calls to rtl insns, for GNU C compiler.
    Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
    1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
 /* Convert function calls to rtl insns, for GNU C compiler.
    Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
    1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-   2011 Free Software Foundation, Inc.
+   2011, 2012 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
 
 This file is part of GCC.
 
@@ -445,6 +445,11 @@ emit_call_1 (rtx funexp, tree fntree ATTRIBUTE_UNUSED, tree fndecl ATTRIBUTE_UNU
       if (SUPPORTS_STACK_ALIGNMENT)
         crtl->need_drap = true;
     }
       if (SUPPORTS_STACK_ALIGNMENT)
         crtl->need_drap = true;
     }
+  /* For noreturn calls when not accumulating outgoing args force
+     REG_ARGS_SIZE note to prevent crossjumping of calls with different
+     args sizes.  */
+  else if (!ACCUMULATE_OUTGOING_ARGS && (ecf_flags & ECF_NORETURN) != 0)
+    add_reg_note (call_insn, REG_ARGS_SIZE, GEN_INT (stack_pointer_delta));
 
   if (!ACCUMULATE_OUTGOING_ARGS)
     {
 
   if (!ACCUMULATE_OUTGOING_ARGS)
     {
index 8db8b22..6db7569 100644 (file)
@@ -1,5 +1,8 @@
 2012-01-05  Jakub Jelinek  <jakub@redhat.com>
 
 2012-01-05  Jakub Jelinek  <jakub@redhat.com>
 
+       PR debug/51762
+       * gcc.dg/pr51762.c: New test.
+
        PR rtl-optimization/51767
        * gcc.c-torture/compile/pr51767.c: New test.
 
        PR rtl-optimization/51767
        * gcc.c-torture/compile/pr51767.c: New test.
 
diff --git a/gcc/testsuite/gcc.dg/pr51762.c b/gcc/testsuite/gcc.dg/pr51762.c
new file mode 100644 (file)
index 0000000..9c59f33
--- /dev/null
@@ -0,0 +1,19 @@
+/* PR debug/51762 */
+/* { dg-do compile } */
+/* { dg-options "-g -Os -fomit-frame-pointer -fno-asynchronous-unwind-tables" } */
+
+void noret (void) __attribute__ ((noreturn));
+int bar (void);
+void baz (const char *);
+static int v = -1;
+
+void
+foo (void)
+{
+  if (bar () && v == -1)
+    {
+      baz ("baz");
+      noret ();
+    }
+  noret ();
+}