aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2018-05-31 19:51:50 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2018-05-31 19:51:50 +0000
commit27b34082f037de30b630f191be2488cd5902286d (patch)
tree79d05f535e5e4c7e857c3547331b8c402748f6b8
parenta48d7dbe942c1f56dcce07730a0e0a44681e3256 (diff)
PR target/85984
* bb-reorder.c (pass_partition_blocks::gate): Return false for functions with naked attribute. * gcc.target/i386/pr85984.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@261038 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/bb-reorder.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr85984.c18
4 files changed, 32 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 688215cd371..51f2a9f787b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2018-05-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/85984
+ * bb-reorder.c (pass_partition_blocks::gate): Return false for
+ functions with naked attribute.
+
2018-05-31 H.J. Lu <hongjiu.lu@intel.com>
PR target/85829
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index 6f2ad5a5220..d1019d01d09 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -2928,8 +2928,8 @@ pass_partition_blocks::gate (function *fun)
{
/* The optimization to partition hot/cold basic blocks into separate
sections of the .o file does not work well with linkonce or with
- user defined section attributes. Don't call it if either case
- arises. */
+ user defined section attributes or with naked attribute. Don't call
+ it if either case arises. */
return (flag_reorder_blocks_and_partition
&& optimize
/* See pass_reorder_blocks::gate. We should not partition if
@@ -2937,6 +2937,7 @@ pass_partition_blocks::gate (function *fun)
&& optimize_function_for_speed_p (fun)
&& !DECL_COMDAT_GROUP (current_function_decl)
&& !lookup_attribute ("section", DECL_ATTRIBUTES (fun->decl))
+ && !lookup_attribute ("naked", DECL_ATTRIBUTES (fun->decl))
/* Workaround a bug in GDB where read_partial_die doesn't cope
with DIEs with DW_AT_ranges, see PR81115. */
&& !(in_lto_p && MAIN_NAME_P (DECL_NAME (fun->decl))));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 80adeb3425e..45aeec07f55 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-05-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/85984
+ * gcc.target/i386/pr85984.c: New test.
+
2018-05-31 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/stack_usage1.adb: Replace -fstack-usage with -Wstack-usage.
diff --git a/gcc/testsuite/gcc.target/i386/pr85984.c b/gcc/testsuite/gcc.target/i386/pr85984.c
new file mode 100644
index 00000000000..23dd53dc2cf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr85984.c
@@ -0,0 +1,18 @@
+/* PR target/85984 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int foo (void);
+
+void __attribute__((naked))
+bar (void)
+{
+ if (!foo ())
+ __builtin_abort ();
+}
+
+void
+baz (void)
+{
+ bar ();
+}