------- Comment #6 from rguenth at gcc dot gnu dot org  2010-01-14 16:57 -------
Note that with the current middle-end setup we cannot really ever derive
anything about alignment when just seeing a pointer type.  We only can
ever derive alignment information when having access to the pointed-to
decl or when encountering an actual dereference of a pointer (though as
with this middle-end problem I'm sure we have bugs where the alignment
of the access is not that of the type of the dereferenced pointer).

Thus get_pointer_alignment is overly optimistic.

We could establish some C rules in the middle-end namely that pointer
function arguments have proper alignment, likewise passing a pointer
to a function is as good as a dereference of it.  But as other people
have noted we simply need to propagate alignment information
somewhere and the frontends need a way to communicate constraints to
the middle-end.

The operand scanner could set a flag in the SSA names pointer information
whether it is dereferenced or passed as function argument, points-to
information can constrain alignment based on the pointed-to objects
(but never can derive larger alignment than the pointed-to types).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40060

Reply via email to