aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr97456.c40
-rw-r--r--gcc/tree-complex.c3
2 files changed, 42 insertions, 1 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr97456.c b/gcc/testsuite/gcc.dg/tree-ssa/pr97456.c
new file mode 100644
index 0000000..5171c9b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr97456.c
@@ -0,0 +1,40 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fwhole-program" } */
+
+
+float val2 = 1.710780f;
+float val3;
+volatile float vf;
+
+int __attribute__((noipa))
+get_bool (void)
+{
+ return 1;
+}
+
+int __attribute__((noinline))
+wrong (float *pos)
+{
+ _Complex float a;
+
+ __real__ a = *pos;
+ __imag__ a = *pos;
+
+ _Complex float b = 0 + 0i;
+
+ b = b + a;
+
+ if (b == 0.0f)
+ return 1;
+
+ vf = __imag__ b;
+ return 0;
+}
+
+int main(int argc, char **argv) {
+ float val = get_bool () == 1 ? val2 : val3;
+
+ if ((wrong(&val), wrong(&val)))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 2e54bbb..f132e0f 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -569,7 +569,8 @@ set_component_ssa_name (tree ssa_name, bool imag_p, tree value)
{
/* Replace an anonymous base value with the variable from cvc_lookup.
This should result in better debug info. */
- if (SSA_NAME_VAR (ssa_name)
+ if (!SSA_NAME_IS_DEFAULT_DEF (value)
+ && SSA_NAME_VAR (ssa_name)
&& (!SSA_NAME_VAR (value) || DECL_IGNORED_P (SSA_NAME_VAR (value)))
&& !DECL_IGNORED_P (SSA_NAME_VAR (ssa_name)))
{