From e697d1191cdd301abe0c0b89a5ced36dc3f5f9a3 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Thu, 13 Feb 2014 12:38:52 +0000 Subject: [PATCH] s390.c (s390_asm_output_function_label): Fix crash caused by bad second argument to warning_at() with -mhotpatch and... 2014-02-13 Dominik Vogt * 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 * gcc.target/s390/hotpatch-compile-8.c: New test. From-SVN: r207753 --- gcc/ChangeLog | 6 +++++ gcc/config/s390/s390.c | 5 ++-- gcc/testsuite/ChangeLog | 4 ++++ .../gcc.target/s390/hotpatch-compile-8.c | 23 +++++++++++++++++++ 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c31875d0903c..e0293c5096f6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-02-13 Dominik Vogt + + * 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 Richard Sandiford * opts.c (option_name): Remove "enabled by default" rider. diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 993ed8434f61..7a79286c9b40 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -5305,9 +5305,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; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 803207cfc645..392986f4f8f0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-02-13 Dominik Vogt + + * gcc.target/s390/hotpatch-compile-8.c: New test. + 2014-02-13 Richard Sandiford * gcc.dg/pr59605.c: Convert to a compile test. Protect MAX_COPY 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 index 000000000000..489fc5dd9f0b --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c @@ -0,0 +1,23 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do run } */ +/* { dg-options "-O3 -mzarch -mhotpatch" } */ + +#include + +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(); +} -- 2.47.3