[Bug tree-optimization/34029] [4.3 Regression] internal compiler error: verify_stmts failed
jakub at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Nov 20 11:50:00 GMT 2007
------- Comment #5 from jakub at gcc dot gnu dot org 2007-11-20 11:50 -------
While it would be nice if that got folded, I believe the problem is elsewhere.
Consider:
static const char s[] = "ab.cd.efghijk";
static const char t[] = "abcde";
long
foo (const char *x)
{
const char *a;
long b = 0;
a = __builtin_strchr (s, '.');
return ((long) a) + (1 - (long) t);
}
(ok, not really kosher code, because there are two unrelated pointers
involved).
This ICEs the same way, and really fold can't fold &s[2] p+ (1 - (long int)
&t[0]) to anything meaningful (well, perhaps it could avoid creating the
ADDR_EXPR.
The problem is IMHO in is_gimple_min_invariant blindly allowing any ADDR_EXPRs
with TREE_INVARIANT set, yet the checking code in verify_expr insists that also
TREE_OPERAND (addr_ref, 1) is is_gimple_val.
Either the checking code should be made less stricter and allow any
TREE_INVARIANT ADDR_EXPRs (likely very bad idea), or is_gimple_min_invariant
should enforce it:
case ADDR_EXPR:
return TREE_INVARIANT (t) && is_gimple_val (TREE_OPERAND (t, 1));
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amacleod at redhat dot com,
| |dnovillo at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34029
More information about the Gcc-bugs
mailing list