diff options
author | Richard Biener <rguenther@suse.de> | 2017-12-12 08:50:31 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-12-12 08:50:31 +0000 |
commit | 5b0c69ae65b713ab68202af20dae9dca533d39cf (patch) | |
tree | 3bb310f9df1511ec6309b70eb110224f29320ea1 /gcc | |
parent | e157d4567738df5cb009a3304ca910501d77585f (diff) | |
download | gcc-5b0c69ae65b713ab68202af20dae9dca533d39cf.zip gcc-5b0c69ae65b713ab68202af20dae9dca533d39cf.tar.gz gcc-5b0c69ae65b713ab68202af20dae9dca533d39cf.tar.bz2 |
re PR middle-end/81889 (bogus warnings with -Wmaybe-uninitialized -O3)
2017-12-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/81889
* tree-ssa-loop-niter.c (infer_loop_bounds_from_signedness): Use
range info from the non-wrapping IV instead of just the range
of the type.
* gfortran.dg/pr81889.f90: New testcase.
* gcc.dg/tree-ssa/pr64183.c: Adjust.
From-SVN: r255573
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/pr64183.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr81889.f90 | 29 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-niter.c | 6 |
5 files changed, 49 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9ec6f5f..6ab0e47 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-12-12 Richard Biener <rguenther@suse.de> + + PR tree-optimization/81889 + * tree-ssa-loop-niter.c (infer_loop_bounds_from_signedness): Use + range info from the non-wrapping IV instead of just the range + of the type. + 2017-12-12 Julia Koval <julia.koval@intel.com> * config.gcc: Add vaesintrin.h. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cacb3f4..dfc5ed8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-12-12 Richard Biener <rguenther@suse.de> + + PR tree-optimization/81889 + * gfortran.dg/pr81889.f90: New testcase. + * gcc.dg/tree-ssa/pr64183.c: Adjust. + 2017-12-12 Julia Koval <julia.koval@intel.com> * gcc.target/i386/avx512-check.h: Handle bit_VAES. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr64183.c b/gcc/testsuite/gcc.dg/tree-ssa/pr64183.c index 8a3fadc..7a854fc 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr64183.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr64183.c @@ -17,4 +17,4 @@ test () bits += 8; } -/* { dg-final { scan-tree-dump "Loop 2 iterates at most 4 times" "cunroll"} } */ +/* { dg-final { scan-tree-dump "Loop 2 iterates at most 3 times" "cunroll"} } */ diff --git a/gcc/testsuite/gfortran.dg/pr81889.f90 b/gcc/testsuite/gfortran.dg/pr81889.f90 new file mode 100644 index 0000000..0516922 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr81889.f90 @@ -0,0 +1,29 @@ +! { dg-do compile } +! { dg-options "-O3 -Wall" } + +module m + + type t + integer, dimension(:), pointer :: list + end type + +contains + + subroutine s(n, p, Y) + integer, intent(in) :: n + type(t) :: p + real, dimension(:) :: Y + + real, dimension(1:16) :: xx + + if (n > 3) then + xx(1:n) = 0. + print *, xx(1:n) + else + xx(1:n) = Y(p%list(1:n)) ! { dg-bogus "uninitialized" } + print *, sum(xx(1:n)) + end if + + end subroutine + +end module diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index b97f1db..b067a0d 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -3510,6 +3510,12 @@ infer_loop_bounds_from_signedness (struct loop *loop, gimple *stmt) low = lower_bound_in_type (type, type); high = upper_bound_in_type (type, type); + wide_int minv, maxv; + if (get_range_info (def, &minv, &maxv) == VR_RANGE) + { + low = wide_int_to_tree (type, minv); + high = wide_int_to_tree (type, maxv); + } record_nonwrapping_iv (loop, base, step, stmt, low, high, false, true); } |