This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/15262] New: [tree-ssa] Alias analyzer cannot handle addressable fields
- From: "dnovillo at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 May 2004 14:22:05 -0000
- Subject: [Bug optimization/15262] New: [tree-ssa] Alias analyzer cannot handle addressable fields
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The type-based alias analyzer cannot handle aliasing fields in structures. Given
&PTR->FIELD, it fails to build alias sets for PTR's memory tag. There is very
limited support for handling it, but it needs to be revamped.
Filing as a bug against the branch. I've got a partial fix, but it's proving to
be too intrusive for the freeze period. Will fix after the merge into mainline.
Compile the following with -O2 (adapted from fortran/scanner.c:next_char)
struct A
{
char *nextc;
float b;
};
void
bar (float *p)
{
*p = 5.2;
}
char *
foo(struct A *locp, int i, char *str)
{
float f, g, *p;
char *T355;
char **T356;
/* Currently, the alias analyzer has limited support for handling
aliases of structure fields when no other variables are aliased.
Introduce additional aliases to confuse it. */
p = i ? &g : &f;
bar (p);
if (*p > 0.0)
str = "abc";
T355 = locp->nextc;
T356 = &locp->nextc;
*T356 = str;
T355 = locp->nextc;
return T355;
}
main ()
{
struct A loc;
char *str;
loc.nextc = "123";
str = foo (&loc, 10, "xyz");
if (str[0] != 'a' || str[1] != 'b' || str[2] != 'c' || str[3] != '\0')
abort ();
return 0;
}
--
Summary: [tree-ssa] Alias analyzer cannot handle addressable
fields
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: optimization
AssignedTo: dnovillo at gcc dot gnu dot org
ReportedBy: dnovillo at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15262