diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d3323a62a8a5..1f91bb110531 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-03-08 Jakub Jelinek + + PR tree-optimization/70127 + * fold-const.c (operand_equal_p): Revert the 2015-10-28 change. + 2016-03-09 David Malcolm PR c/68473 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 21241db5a49c..696b4a6996fa 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3032,6 +3032,9 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags) TYPE_SIZE (TREE_TYPE (arg1)), flags))) return 0; + /* Verify that access happens in similar types. */ + if (!types_compatible_p (TREE_TYPE (arg0), TREE_TYPE (arg1))) + return 0; /* Verify that accesses are TBAA compatible. */ if (!alias_ptr_types_compatible_p (TREE_TYPE (TREE_OPERAND (arg0, 1)), diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 31dd65e20b7f..e611b29be0f3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-03-08 Jakub Jelinek + + PR tree-optimization/70127 + * gcc.c-torture/execute/pr70127.c: New test. + 2016-03-09 Cesar Philippidis * c-c++-common/goacc/combined-directives-2.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/execute/pr70127.c b/gcc/testsuite/gcc.c-torture/execute/pr70127.c new file mode 100644 index 000000000000..a0bf3c02830f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr70127.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/70127 */ + +struct S { int f; signed int g : 2; } a[1], c = {5, 1}, d; +short b; + +__attribute__((noinline, noclone)) void +foo (int x) +{ + if (x != 1) + __builtin_abort (); +} + +int +main () +{ + while (b++ <= 0) + { + struct S e = {1, 1}; + d = e = a[0] = c; + } + foo (a[0].g); + return 0; +}