re PR c/44555 (Pointer evalutions, is that expected ?)
2010-07-27 Richard Guenther <rguenther@suse.de> PR c/44555 * c-common.c (c_common_truthvalue_conversion): Remove premature and wrong optimization concering ADDR_EXPRs. * gcc.c-torture/execute/pr44555.c: New testcase. From-SVN: r162566
This commit is contained in:
parent
aa8f9a5e14
commit
266e437ca9
|
@ -1,3 +1,9 @@
|
|||
2010-07-27 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR c/44555
|
||||
* c-common.c (c_common_truthvalue_conversion): Remove
|
||||
premature and wrong optimization concering ADDR_EXPRs.
|
||||
|
||||
2010-07-27 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/44977
|
||||
|
|
|
@ -3397,20 +3397,7 @@ c_common_truthvalue_conversion (location_t location, tree expr)
|
|||
inner);
|
||||
return truthvalue_true_node;
|
||||
}
|
||||
|
||||
/* If we still have a decl, it is possible for its address to
|
||||
be NULL, so we cannot optimize. */
|
||||
if (DECL_P (inner))
|
||||
{
|
||||
gcc_assert (DECL_WEAK (inner));
|
||||
break;
|
||||
}
|
||||
|
||||
if (TREE_SIDE_EFFECTS (inner))
|
||||
return build2 (COMPOUND_EXPR, truthvalue_type_node,
|
||||
inner, truthvalue_true_node);
|
||||
else
|
||||
return truthvalue_true_node;
|
||||
break;
|
||||
}
|
||||
|
||||
case COMPLEX_EXPR:
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2010-07-27 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR c/44555
|
||||
* gcc.c-torture/execute/pr44555.c: New testcase.
|
||||
|
||||
2010-07-27 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/44977
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
struct a {
|
||||
char b[100];
|
||||
};
|
||||
int foo(struct a *a)
|
||||
{
|
||||
if (&a->b)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
extern void abort (void);
|
||||
int main()
|
||||
{
|
||||
if (foo((struct a *)0) != 0)
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue