Your June 7 change to expand_expr

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Wed Jul 1 20:52:00 GMT 1998


    As such, there does exist a safe value for MEM_IN_STRUCT_P, it is the
    value that will cause the aliasing rule to detect an alias.  This
    would be something like
	MEM_IN_STRUCT_P (x) = ! varies (XEXP (x, 0));

That's an interesting idea!

    It so happens that most aliasing failures can be fixed by setting
    MEM_IN_STRUCT_P to one

That's what my observations were as well and why I felt setting it to
one was the safest.  My mistake was in not realizing that it wasn't
perfectly safe either.

    I think the real problem here is that Kenner is redefining what a
    REFERENCE_TYPE is.

This is why I've been saying it's so important to have complete
documentation about each tree code, so a front end can know what it
can and cannot rely on.  I see no documentation in tree.def that says
this usage is invalid.  As more and more front ends get written, it's
more and more important to have these specifications complete and
accurate.

    In C++, a REFERENCE_TYPE points at an object.  In Ada, a
    REFERENCE_TYPE points into an object.

No.  In Ada it's like a C pointer: it *can* point into an object, but
usually points at an object.

    What I would like to see is a better explanation of how the Ada front
    end is trying to use REFERENCE_TYPEs,

This I already sent.

    and a testcase for the Ada front end problem that prompted Kenner to
    start setting MEM_IN_STRUCT_P for REFERENCE_TYPEs. 

It's a few hundred line; I'll send it to you separately.  The
confusing part is that the renaming in question is done by the front
end, so you can't see it in the sources explicitly, but -gnatdg shows
it.  Intestingly, this was a failure on MIPS (o32).

    This may mean access to more recent Ada front end sources, 

I'll have that set up for you.

    If it is necessary to make changes to REFERENCE_TYPEs, then it should
    be discussed in some open forum rather than privately decided by the
    Ada front end folks.

Agreed.  But nothing in the documentation suggested this was anything other
than a bug fix since there was nothing to suggest that REFENCE_TYPEs
couldn't point inside an object.

    The aliasing rule is correct only if the original address is varying,
    not if the current address is varying, and hence it would fix this
    testcase.  If we do decide to add a second bit, I think this is the
    bit that we should be adding, as this would fix the existing known
    bugs with the MEM_IN_STRUCT_P aliasing code.  It is possible that this
    is the bug that Kenner ran into with the Ada front end, but I can't
    tell without more info.

I don't think so, since the REFERENCE_TYPE in question actually *did*
point inside an object.  But if this lets us create a *safe mode*, it'll
be of great help.



More information about the Gcc-bugs mailing list