summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2017-07-26 08:52:37 +0000
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2017-07-26 08:52:37 +0000
commit3cfa73b5672911258f1c5d5844541f10b30456d1 (patch)
treee6e7217bb711dfa24d97cebd3c4daad78029b430
parentb3d94b0d080b762b16337be8e43e7032ec2cd285 (diff)
downloadgcc-3cfa73b5672911258f1c5d5844541f10b30456d1.tar.gz
Move non-local goto expansion after parm_birth_insn (PR sanitize/81186).
2017-07-26 Martin Liska <mliska@suse.cz> PR sanitize/81186 * function.c (expand_function_start): Make expansion of nonlocal_goto_save_area after parm_birth_insn. 2017-07-26 Martin Liska <mliska@suse.cz> PR sanitize/81186 * gcc.dg/asan/pr81186.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250561 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/function.c20
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/asan/pr81186.c18
4 files changed, 39 insertions, 10 deletions
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 <mliska@suse.cz>
+
+ PR sanitize/81186
+ * function.c (expand_function_start): Make expansion of
+ nonlocal_goto_save_area after parm_birth_insn.
+
2017-07-26 Sebastian Huber <sebastian.huber@embedded-brains.de>
* 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 <mliska@suse.cz>
+
+ PR sanitize/81186
+ * gcc.dg/asan/pr81186.c: New test.
+
2017-07-25 Carl Love <cel@us.ibm.com>
* 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;
+}