Commit 2445aeac by Richard Biener Committed by Richard Biener

re PR tree-optimization/58794 (ICE in set_lattice_value, at tree-ssa-ccp.c:455…

re PR tree-optimization/58794 (ICE in set_lattice_value, at tree-ssa-ccp.c:455 on x86_64-linux-gnu (at -O1, -O2, and -O3))

2013-10-21  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/58794
	* fold-const.c (operand_equal_p): Compare FIELD_DECL operand
	of COMPONENT_REFs with OEP_CONSTANT_ADDRESS_OF left in place.

	* c-c++-common/torture/pr58794-1.c: New testcase.
	* c-c++-common/torture/pr58794-2.c: Likewise.

From-SVN: r203891
parent d480e6a5
2013-10-21 Richard Biener <rguenther@suse.de> 2013-10-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/58794
* fold-const.c (operand_equal_p): Compare FIELD_DECL operand
of COMPONENT_REFs with OEP_CONSTANT_ADDRESS_OF left in place.
2013-10-21 Richard Biener <rguenther@suse.de>
PR middle-end/58742 PR middle-end/58742
* fold-const.c (fold_binary_loc): Fold ((T) (X /[ex] C)) * C * fold-const.c (fold_binary_loc): Fold ((T) (X /[ex] C)) * C
to (T) X for sign-changing conversions (or no conversion). to (T) X for sign-changing conversions (or no conversion).
......
...@@ -2715,10 +2715,11 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags) ...@@ -2715,10 +2715,11 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
case COMPONENT_REF: case COMPONENT_REF:
/* Handle operand 2 the same as for ARRAY_REF. Operand 0 /* Handle operand 2 the same as for ARRAY_REF. Operand 0
may be NULL when we're called to compare MEM_EXPRs. */ may be NULL when we're called to compare MEM_EXPRs. */
if (!OP_SAME_WITH_NULL (0)) if (!OP_SAME_WITH_NULL (0)
|| !OP_SAME (1))
return 0; return 0;
flags &= ~OEP_CONSTANT_ADDRESS_OF; flags &= ~OEP_CONSTANT_ADDRESS_OF;
return OP_SAME (1) && OP_SAME_WITH_NULL (2); return OP_SAME_WITH_NULL (2);
case BIT_FIELD_REF: case BIT_FIELD_REF:
if (!OP_SAME (0)) if (!OP_SAME (0))
......
2013-10-21 Richard Biener <rguenther@suse.de> 2013-10-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/58794
* c-c++-common/torture/pr58794-1.c: New testcase.
* c-c++-common/torture/pr58794-2.c: Likewise.
2013-10-21 Richard Biener <rguenther@suse.de>
PR middle-end/58742 PR middle-end/58742
* c-c++-common/fold-divmul-1.c: New testcase. * c-c++-common/fold-divmul-1.c: New testcase.
......
/* { dg-do compile } */
struct S0
{
int f;
};
struct S1
{
struct S0 f1;
volatile int f2;
};
struct S2
{
struct S1 g;
} a, b;
static int *c[1][2] = {{0, (int *)&a.g.f2}};
static int d;
int
main ()
{
for (d = 0; d < 1; d++)
for (b.g.f1.f = 0; b.g.f1.f < 1; b.g.f1.f++)
*c[b.g.f1.f][d + 1] = 0;
return 0;
}
/* { dg-do compile } */
struct S
{
volatile int f;
} a;
unsigned int b;
static int *c[1][2] = {{0, (int *)&a.f}};
static unsigned int d;
int
main ()
{
for (; d < 1; d++)
for (; b < 1; b++)
*c[b][d + 1] = 0;
return 0;
}
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