The following adjusts two uninit testcases to avoid a false negative
that appears when using -msoft-float on arm because the testcase
then mutates into a classical case of CCP eliding
# _11 = PHI <1.0e+0(2), f$real_9(D)(3)>
Avoid this by using a non-constant. And avoid flipping locations
for the diagnostic by not duplicating the return statement.
Tested on arm with {,-msoft-float} and on x86_64-linux.
OK?
Thanks,
Richard.
PR testsuite/115827
* gcc.dg/auto-init-uninit-17.c: Avoid CCP.
* gcc.dg/uninit-17.c: Likewise.
---
gcc/testsuite/gcc.dg/auto-init-uninit-17.c | 7 ++-----
gcc/testsuite/gcc.dg/uninit-17.c | 7 ++-----
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/gcc/testsuite/gcc.dg/auto-init-uninit-17.c
b/gcc/testsuite/gcc.dg/auto-init-uninit-17.c
index 9eec9440c75..d76227abbe4 100644
--- a/gcc/testsuite/gcc.dg/auto-init-uninit-17.c
+++ b/gcc/testsuite/gcc.dg/auto-init-uninit-17.c
@@ -2,14 +2,11 @@
/* { dg-options "-O -Wuninitialized -ftrivial-auto-var-init=zero" } */
typedef _Complex float C;
-C foo(int cond)
+C foo(int cond, float r)
{
C f;
__imag__ f = 0;
if (cond)
- {
- __real__ f = 1;
- return f;
- }
+ __real__ f = r; /* No constant to avoid a CCP induced false negative. */
return f; /* { dg-warning "may be used" "unconditional" } */
}
diff --git a/gcc/testsuite/gcc.dg/uninit-17.c b/gcc/testsuite/gcc.dg/uninit-17.c
index 8a95f15c5ae..ebf2cae0ec2 100644
--- a/gcc/testsuite/gcc.dg/uninit-17.c
+++ b/gcc/testsuite/gcc.dg/uninit-17.c
@@ -2,14 +2,11 @@
/* { dg-options "-O -Wuninitialized" } */
typedef _Complex float C;
-C foo(int cond)
+C foo(int cond, float r)
{
C f;
__imag__ f = 0;
if (cond)
- {
- __real__ f = 1;
- return f;
- }
+ __real__ f = r; /* No constant to avoid a CCP induced false negative. */
return f; /* { dg-warning "may be used" "unconditional" } */
}
--
2.51.0