re PR middle-end/85567 (internal compiler error: in gimplify_modify_expr, at gimplify...
authorRichard Biener <rguenther@suse.de>
Wed, 2 May 2018 07:59:34 +0000 (07:59 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 2 May 2018 07:59:34 +0000 (07:59 +0000)
2018-05-02  Richard Biener  <rguenther@suse.de>

PR middle-end/85567
* gimplify.c (gimplify_save_expr): When in SSA form allow
SAVE_EXPRs to compute to SSA vars.

* gcc.dg/torture/pr85567.c: New testcase.

From-SVN: r259826

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr85567.c [new file with mode: 0644]

index 2792c886b67b9b6c208a1fb5eb3bdb8f678e519e..3e961a190430d1f58ce6668629b35355626b627f 100644 (file)
@@ -1,3 +1,9 @@
+2018-05-02  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/85567
+       * gimplify.c (gimplify_save_expr): When in SSA form allow
+       SAVE_EXPRs to compute to SSA vars.
+
 2018-05-02  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/85582
index d27aae2eea8c6f70e33b8cf26c03af7a6788219b..9942afdd61fc21e24c5ce18c3aaf55c043cdd151 100644 (file)
@@ -5931,8 +5931,11 @@ gimplify_save_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
        }
       else
        /* The temporary may not be an SSA name as later abnormal and EH
-          control flow may invalidate use/def domination.  */
-       val = get_initialized_tmp_var (val, pre_p, post_p, false);
+          control flow may invalidate use/def domination.  When in SSA
+          form then assume there are no such issues and SAVE_EXPRs only
+          appear via GENERIC foldings.  */
+       val = get_initialized_tmp_var (val, pre_p, post_p,
+                                      gimple_in_ssa_p (cfun));
 
       TREE_OPERAND (*expr_p, 0) = val;
       SAVE_EXPR_RESOLVED_P (*expr_p) = 1;
index bdbdd17fd463bb9930a63ae6e9ec182ec5565e3a..6bd3e0fb4256f31ddc40338049e9d24ee5b291dc 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-02  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/85567
+       * gcc.dg/torture/pr85567.c: New testcase.
+
 2018-05-02  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/85582
diff --git a/gcc/testsuite/gcc.dg/torture/pr85567.c b/gcc/testsuite/gcc.dg/torture/pr85567.c
new file mode 100644 (file)
index 0000000..f20c69f
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+extern void sincos(double x, double *sinx, double *cosx);
+
+void apply(void (*f)(double, double *, double *),
+          double x, double *sinx, double *cosx)
+{
+  f(x, sinx, cosx);
+  return;
+}
+
+void apply_sincos(double x, double *sinx, double *cosx)
+{
+  apply(sincos, x, sinx, cosx);
+  return;
+}