diff options
author | Richard Biener <rguenther@suse.de> | 2018-07-02 13:32:26 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2018-07-02 13:32:26 +0000 |
commit | 92590cd35f5e7b1c02a928069e54683f2e815914 (patch) | |
tree | 9189339028165f8d46da2db490a92924b087dfa5 /gcc | |
parent | 94ee1558a839de8bf20f4e89aebe8d1453fb6015 (diff) | |
download | gcc-92590cd35f5e7b1c02a928069e54683f2e815914.zip gcc-92590cd35f5e7b1c02a928069e54683f2e815914.tar.gz gcc-92590cd35f5e7b1c02a928069e54683f2e815914.tar.bz2 |
re PR tree-optimization/86363 (wrong code with __builtin_memset() at -O1)
2018-07-02 Richard Biener <rguenther@suse.de>
PR tree-optimization/86363
* tree-ssa-sccvn.c (vn_reference_lookup_3): Check the
memset argument refers to a non-variable address.
* gcc.dg/torture/pr86363.c: New testcase.
From-SVN: r262307
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr86363.c | 25 | ||||
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 1 |
4 files changed, 37 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 15f2749..dc90e39 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-07-02 Richard Biener <rguenther@suse.de> + + PR tree-optimization/86363 + * tree-ssa-sccvn.c (vn_reference_lookup_3): Check the + memset argument refers to a non-variable address. + 2018-07-02 Aldy Hernandez <aldyh@redhat.com> * tree-vrp.c (extract_range_from_binary_expr_1): Abstract a lot of the diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cc94d3b..8b09130 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-07-02 Richard Biener <rguenther@suse.de> + + PR tree-optimization/86363 + * gcc.dg/torture/pr86363.c: New testcase. + 2018-07-02 Martin Liska <mliska@suse.cz> * gcc.dg/completion-1.c: New test. diff --git a/gcc/testsuite/gcc.dg/torture/pr86363.c b/gcc/testsuite/gcc.dg/torture/pr86363.c new file mode 100644 index 0000000..154f938 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr86363.c @@ -0,0 +1,25 @@ +/* { dg-do run } */ +/* { dg-additional-options "-w -Wno-psabi" } */ + +typedef char U __attribute__ ((vector_size (16))); +typedef unsigned V __attribute__ ((vector_size (16))); + +V g; + +V +f (V v, U u) +{ + __builtin_memset (&u[v[0]], 0, 1); + g ^= u[0]; + return g; +} + +int +main (void) +{ + V x = f ((V) { 5 }, (U) { 1 }); + + if (x[0] != 1 || x[1] != 1 || x[2] != 1 || x[3] != 1) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index e5eddf9..1e16e13 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -1988,6 +1988,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_, base2 = get_ref_base_and_extent (ref2, &offset2, &size2, &maxsize2, &reverse); if (!known_size_p (maxsize2) + || !known_eq (maxsize2, size2) || !operand_equal_p (base, base2, OEP_ADDRESS_OF)) return (void *)-1; } |