]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
s390.c (s390_asm_output_function_label): Fix crash caused by bad second argument...
authorDominik Vogt <vogt@linux.vnet.ibm.com>
Thu, 13 Feb 2014 12:34:11 +0000 (12:34 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Thu, 13 Feb 2014 12:34:11 +0000 (12:34 +0000)
2014-02-13  Dominik Vogt  <vogt@linux.vnet.ibm.com>

* config/s390/s390.c (s390_asm_output_function_label): Fix crash
caused by bad second argument to warning_at() with -mhotpatch and
nested functions (e.g. with gfortran).

2014-02-13  Dominik Vogt  <vogt@linux.vnet.ibm.com>

* gcc.target/s390/hotpatch-compile-8.c: New test.

From-SVN: r207752

gcc/ChangeLog
gcc/config/s390/s390.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c [new file with mode: 0644]

index b0e7d8907d7cd74dea06aeed3731a09fc5981c88..c0fd31b24c040040b6978ae3c7bfd2ca5dbf2f78 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-13  Dominik Vogt  <vogt@linux.vnet.ibm.com>
+
+       * config/s390/s390.c (s390_asm_output_function_label): Fix crash
+       caused by bad second argument to warning_at() with -mhotpatch and
+       nested functions (e.g. with gfortran).
+
 2014-02-12  H.J. Lu  <hongjiu.lu@intel.com>
 
        Backport from mainline
index 257e33c8469bc0d9acc58c9b317b3e6a6d503446..9ab8352b5fe08e80303343a6a2a40119c18e9071 100644 (file)
@@ -5482,9 +5482,8 @@ s390_asm_output_function_label (FILE *asm_out_file, const char *fname,
       if (hotpatch_trampoline_halfwords >= 0
          && decl_function_context (decl) != NULL_TREE)
        {
-         warning_at (0, DECL_SOURCE_LOCATION (decl),
-                     "hotpatch_prologue is not compatible with nested"
-                     " function");
+         warning_at (DECL_SOURCE_LOCATION (decl), OPT_mhotpatch,
+                     "hotpatching is not compatible with nested functions");
          hotpatch_trampoline_halfwords = -1;
        }
     }
index 2b8ae5848979fc3590a0ab4fa56cbe37a6ee1cd1..0c44e92ffd7976916a09970ae37799c68815731d 100644 (file)
@@ -1,3 +1,7 @@
+2014-02-13  Dominik Vogt  <vogt@linux.vnet.ibm.com>
+
+       * gcc.target/s390/hotpatch-compile-8.c: New test.
+
 2014-02-12  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc.c-torture/execute/20140212-1.c: New test.
diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c
new file mode 100644 (file)
index 0000000..489fc5d
--- /dev/null
@@ -0,0 +1,23 @@
+/* Functional tests for the function hotpatching feature.  */
+
+/* { dg-do run } */
+/* { dg-options "-O3 -mzarch -mhotpatch" } */
+
+#include <stdio.h>
+
+int hp1(void)
+{
+  int nested1(void) /* { dg-warning "hotpatching is not compatible with nested functions" } */
+  { return 1; }
+
+  __attribute__ ((hotpatch))
+  int nested2(void) /* { dg-warning "hotpatching is not compatible with nested functions" } */
+  { return 1; }
+
+  return nested1() - nested2();
+}
+
+int main (void)
+{
+  return hp1();
+}