This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/30252] [4.2 regression] miscompilation of sigc++-2.0 based code with -fstrict-aliasing
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jun 2007 15:28:12 -0000
- Subject: [Bug c++/30252] [4.2 regression] miscompilation of sigc++-2.0 based code with -fstrict-aliasing
- References: <bug-30252-7958@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #28 from rguenth at gcc dot gnu dot org 2007-06-04 15:28 -------
solution_set_add () looks like the culprit (thx micha). So, the following will
fix it in case we have offsets only from COMPONENT_REFs, not from regular
pointer arithmetic (which is not true):
Index: tree-ssa-structalias.c
===================================================================
--- tree-ssa-structalias.c (revision 125310)
+++ tree-ssa-structalias.c (working copy)
@@ -715,13 +715,10 @@ solution_set_add (bitmap set, unsigned H
less than end. Otherwise, it is globbed to a single
variable. */
- if ((get_varinfo (i)->offset + offset) < get_varinfo (i)->fullsize)
+ if (get_varinfo (i)->offset + get_varinfo (i)->size - 1 >= offset
+ && get_varinfo (i)->offset + offset < get_varinfo (i)->fullsize)
{
- unsigned HOST_WIDE_INT fieldoffset = get_varinfo (i)->offset +
offset;
- varinfo_t v = first_vi_for_offset (get_varinfo (i), fieldoffset);
- if (!v)
- continue;
- bitmap_set_bit (result, v->id);
+ bitmap_set_bit (result, i);
}
else if (get_varinfo (i)->is_artificial_var
|| get_varinfo (i)->has_union
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30252