From 108c3c88d7273be093ff1431760bff5774381ac1 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 26 Jul 2017 10:52:37 +0200 Subject: [PATCH] Move non-local goto expansion after parm_birth_insn (PR sanitize/81186). 2017-07-26 Martin Liska PR sanitize/81186 * function.c (expand_function_start): Make expansion of nonlocal_goto_save_area after parm_birth_insn. 2017-07-26 Martin Liska PR sanitize/81186 * gcc.dg/asan/pr81186.c: New test. From-SVN: r250561 --- gcc/ChangeLog | 6 ++++++ gcc/function.c | 20 ++++++++++---------- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/asan/pr81186.c | 18 ++++++++++++++++++ 4 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/asan/pr81186.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f7482c12a38..2adda50f195 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-07-26 Martin Liska + + PR sanitize/81186 + * function.c (expand_function_start): Make expansion of + nonlocal_goto_save_area after parm_birth_insn. + 2017-07-26 Sebastian Huber * config/sparc/sparc.c (sparc_option_override): Remove MASK_FPU diff --git a/gcc/function.c b/gcc/function.c index 986f43f0704..62e72eb2a9f 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -5254,6 +5254,16 @@ expand_function_start (tree subr) } } + /* The following was moved from init_function_start. + The move is supposed to make sdb output more accurate. */ + /* Indicate the beginning of the function body, + as opposed to parm setup. */ + emit_note (NOTE_INSN_FUNCTION_BEG); + + gcc_assert (NOTE_P (get_last_insn ())); + + parm_birth_insn = get_last_insn (); + /* If the function receives a non-local goto, then store the bits we need to restore the frame pointer. */ if (cfun->nonlocal_goto_save_area) @@ -5275,16 +5285,6 @@ expand_function_start (tree subr) update_nonlocal_goto_save_area (); } - /* The following was moved from init_function_start. - The move is supposed to make sdb output more accurate. */ - /* Indicate the beginning of the function body, - as opposed to parm setup. */ - emit_note (NOTE_INSN_FUNCTION_BEG); - - gcc_assert (NOTE_P (get_last_insn ())); - - parm_birth_insn = get_last_insn (); - if (crtl->profile) { #ifdef PROFILE_HOOK diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ba9e571982b..0794a290aab 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-07-26 Martin Liska + + PR sanitize/81186 + * gcc.dg/asan/pr81186.c: New test. + 2017-07-25 Carl Love * gcc.target/powerpc/builtins-4-p9-runnable.c: Add test file for diff --git a/gcc/testsuite/gcc.dg/asan/pr81186.c b/gcc/testsuite/gcc.dg/asan/pr81186.c new file mode 100644 index 00000000000..7f0f672ca40 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/pr81186.c @@ -0,0 +1,18 @@ +/* PR sanitizer/81186 */ +/* { dg-do run } */ + +int +main () +{ + __label__ l; + void f () + { + int a[123]; + + goto l; + } + + f (); +l: + return 0; +} -- 2.30.2