[cfe-commits] [PATCH] Drop attributes for dropped parameters in ReplaceUsesOfNonProtoTypeWithRealFunction

John McCall rjmccall at apple.com
Tue Aug 2 11:09:17 PDT 2011


On Aug 2, 2011, at 10:47 AM, Aaron Myles Landwehr wrote:
> I am submitting a patch for CodeGenModule.cpp:ReplaceUsesOfNonProtoTypeWithRealFunction(). There exists a defect in the implementation where the attribute list of the original call instruction is copied over without modification to the new call instruction. In cases where extra arguments are passed, this means that the arguments are dropped, but the attributes for those arguments persist.
> 
> This can result in the following assertion error occurring in the back-end when verifying the CS via Verifier.cpp:VerifyCallSite().
> Attributes after last parameter!
>   call void @bar()
> 
> The attached err.c file is one such error case.  However, as far as I can tell, this is only reproducible on targets that promote integer types to 64 bit. This is because the integer parameter at the call site has an added sext attribute and then later the parameter is removed, but the attribute for the parameter is kept. 
> 
>  SystemZ is one such case. Running the following command using trunk llvm/clang will reproduce the error:
> "clang -ccc-host-triple s390x-unknown-linux err.c"

This patch looks fine to me.  If you wouldn't mind turning err.c into a proper test case, I'd be happy to commit.

I suggest modeling the test case after test/CodeGen/arm-pcs.c.

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110802/778946fb/attachment.html>


More information about the cfe-commits mailing list