This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug bootstrap/30511] False array bound check causes gcc failed to boostrap
- From: "roger at eyesopen dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Jan 2007 20:55:30 -0000
- Subject: [Bug bootstrap/30511] False array bound check causes gcc failed to boostrap
- References: <bug-30511-682@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from roger at eyesopen dot com 2007-01-19 20:55 -------
It looks like the ivopts pass is creating dubious? array references.
The symbol.c.053t.vrp1
D.12252_12 = (long unsigned int) i_2;
D.12255_15 = &ns_4->default_type[D.12252_12];
ts_16 = D.12255_15 + -2328B;
i.e. we now have "&ns->default_type[i] - &ns->default_type['a']".
I wouldn't like to offer an opinion on whether this IV is valid in the
middle-end. The transformation is certainly unsafe in C, where a pointer
arithmetic is not guaranteed to be valid outside of the declared object.
I think the appropriate fix is that if ivopts is going to create these
suspicious array refs, it should appropriately set TREE_NO_WARNING, which
will then cause the reference to be ignored by the bounds checking in VRP.
Alternatively, we need more context in array bounds checking such that
&x['a'] is not a problem, but x['a'] on it's own is diagnosed. i.e. we
could perhaps keep an in_indirect_ref_p flag during the tree walking.
I hope this helps.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30511