Commit 92590cd3 by Richard Biener Committed by Richard Biener

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
parent 94ee1558
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> 2018-07-02 Aldy Hernandez <aldyh@redhat.com>
* tree-vrp.c (extract_range_from_binary_expr_1): Abstract a lot of the * tree-vrp.c (extract_range_from_binary_expr_1): Abstract a lot of the
......
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> 2018-07-02 Martin Liska <mliska@suse.cz>
* gcc.dg/completion-1.c: New test. * gcc.dg/completion-1.c: New test.
......
/* { 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;
}
...@@ -1988,6 +1988,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_, ...@@ -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, base2 = get_ref_base_and_extent (ref2, &offset2, &size2, &maxsize2,
&reverse); &reverse);
if (!known_size_p (maxsize2) if (!known_size_p (maxsize2)
|| !known_eq (maxsize2, size2)
|| !operand_equal_p (base, base2, OEP_ADDRESS_OF)) || !operand_equal_p (base, base2, OEP_ADDRESS_OF))
return (void *)-1; return (void *)-1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment