aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-02-04 14:04:37 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2014-02-04 14:04:37 +0100
commiteb259c4a329898bbae30bf7b55f9598fa73c7dd1 (patch)
tree294855e859722fa6bd67ec674e1a393b20f63a87 /gcc
parent30540e7958f841359d14b2c46e4c51f07a22ff5e (diff)
downloadgcc-eb259c4a329898bbae30bf7b55f9598fa73c7dd1.zip
gcc-eb259c4a329898bbae30bf7b55f9598fa73c7dd1.tar.gz
gcc-eb259c4a329898bbae30bf7b55f9598fa73c7dd1.tar.bz2
re PR ipa/60026 (ICE at -O3 on valid code (with the optimize pragma) on x86_64-linux-gnu)
PR ipa/60026 * tree-inline.c (copy_forbidden): Fail for __attribute__((optimize (0))) functions. * c-c++-common/torture/pr60026.c: New test. From-SVN: r207463
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/c-c++-common/torture/pr60026.c28
-rw-r--r--gcc/tree-inline.c12
4 files changed, 47 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1105fa9..6c6dfd6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2014-02-04 Jakub Jelinek <jakub@redhat.com>
+ PR ipa/60026
+ * tree-inline.c (copy_forbidden): Fail for
+ __attribute__((optimize (0))) functions.
+
PR other/58712
* omp-low.c (simd_clone_struct_copy): If from->inbranch
is set, copy one less argument.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 31e271d..f23b6c4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2014-02-04 Jakub Jelinek <jakub@redhat.com>
+ PR ipa/60026
+ * c-c++-common/torture/pr60026.c: New test.
+
PR rtl-optimization/57915
* gcc.target/i386/pr57915.c: New test.
diff --git a/gcc/testsuite/c-c++-common/torture/pr60026.c b/gcc/testsuite/c-c++-common/torture/pr60026.c
new file mode 100644
index 0000000..1cc5f55
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/pr60026.c
@@ -0,0 +1,28 @@
+/* PR ipa/60026 */
+/* { dg-do compile } */
+
+struct S { int f; } a;
+
+__attribute__((optimize (0)))
+struct S foo (int x, struct S y)
+{
+ int b = y.f;
+ return a;
+}
+
+void
+bar ()
+{
+ while (a.f)
+ {
+ struct S c = {0};
+ foo (0, c);
+ }
+}
+
+int
+main ()
+{
+ bar ();
+ return 0;
+}
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 439ef4c..ade78b2 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -3315,6 +3315,18 @@ copy_forbidden (struct function *fun, tree fndecl)
goto fail;
}
+ tree fs_opts;
+ fs_opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fun->decl);
+ if (fs_opts)
+ {
+ struct cl_optimization *os = TREE_OPTIMIZATION (fs_opts);
+ if (!os->x_optimize)
+ {
+ reason = G_("function %q+F compiled without optimizations");
+ goto fail;
+ }
+ }
+
fail:
fun->cannot_be_copied_reason = reason;
fun->cannot_be_copied_set = true;