diff options
author | Thomas Preud'homme <thomas.preudhomme@arm.com> | 2014-05-08 01:23:01 +0000 |
---|---|---|
committer | Joey Ye <jye2@gcc.gnu.org> | 2014-05-08 01:23:01 +0000 |
commit | 7500b256b0f314c4dab8a590cffc6c58efa3ab23 (patch) | |
tree | 50791434e4b094eb34bb271837000e548a1948dc /gcc | |
parent | e1ec47c453e0d7cb4e62d1d1f6c0efb43cc0bfb5 (diff) | |
download | gcc-7500b256b0f314c4dab8a590cffc6c58efa3ab23.zip gcc-7500b256b0f314c4dab8a590cffc6c58efa3ab23.tar.gz gcc-7500b256b0f314c4dab8a590cffc6c58efa3ab23.tar.bz2 |
re PR middle-end/39246 (FAIL: gcc.dg/uninit-13.c)
2014-05-07 Thomas Preud'homme <thomas.preudhomme@arm.com>
PR middle-end/39246
* tree-complex.c (expand_complex_move): Keep line info when expanding
complex move.
* tree-ssa-uninit.c (warn_uninit): New argument. Ignore assignment
of complex expression. Use new argument to display correct location
for values coming from phi statement.
(warn_uninitialized_vars): Adapt to new signature of warn_uninit.
(warn_uninitialized_phi): Pass location of phi argument to
warn_uninit.
* tree-ssa.c (ssa_undefined_value_p): For SSA_NAME initialized by a
COMPLEX_EXPR, recurse on each part of the COMPLEX_EXPR.
testsuite:
* gcc.dg/uninit-13.c: Move warning on the actual source line where
the uninitialized complex is used.
* gcc.dg/uninit-17.c: New test to check partial initialization of
complex with branches.
* gcc.dg/uninit-17-O0.c: Likewise.
From-SVN: r210200
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/gcc.dg/uninit-17-O0.c | 15 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/uninit-17.c | 15 |
2 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/uninit-17-O0.c b/gcc/testsuite/gcc.dg/uninit-17-O0.c new file mode 100644 index 0000000..0eaef05 --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-17-O0.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-Wuninitialized" } */ + +typedef _Complex float C; +C foo(int cond) +{ + C f; + __imag__ f = 0; + if (cond) + { + __real__ f = 1; + return f; + } + return f; +} diff --git a/gcc/testsuite/gcc.dg/uninit-17.c b/gcc/testsuite/gcc.dg/uninit-17.c new file mode 100644 index 0000000..8a95f15 --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-17.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +typedef _Complex float C; +C foo(int cond) +{ + C f; + __imag__ f = 0; + if (cond) + { + __real__ f = 1; + return f; + } + return f; /* { dg-warning "may be used" "unconditional" } */ +} |