kparzysz added a comment.

In https://reviews.llvm.org/D31885#751164, @rjmccall wrote:

> The right fix is probably just to make sure that EmitLValueForField doesn't 
> add TBAA information when the base LValue doesn't have it.  That will also 
> fix problems with recursive member access where the base is may_alias.


That won't work for arrays that are member of unions.  We'd need to change 
EmitArraySubscriptExpr, which at some point calls MakeAddrLValue for the type 
being loaded/stored. MakeAddrLValue adds TBAAInfo for that type (unsigned short 
in case of the C testcase) and it does so regardless of any struct paths. This 
TBAA info must be removed for the testcase to be fixed.  At that point we would 
have to examine the base expression to see if it refers to a union member, 
which is not different from the approach in this review.  The LValue 
construction is done in a piecewise manner where some elements of the 
previously (recursively) created LValues may or may not be preserved.  This 
makes me concerned that any more detailed attempt at fixing this may 
accidentally omit some case.
The patch in this review is not intended as a permanent solution, only 
something that is easily revertible and will fix the problem until a better 
solution is developed (which is already worked on).


Repository:
  rL LLVM

https://reviews.llvm.org/D31885



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to