This is an archive of the discontinued LLVM Phabricator instance.

Fix for http://llvm.org/PR21915: Assertion Failed on multidimensional VLA in function arguments.
ClosedPublic

Authored by ABataev on Dec 15 2014, 5:34 AM.

Details

Summary

Fixed assertion on type checking for arguments and parameters on function call if arguments are pointers to VLA

Diff Detail

Event Timeline

ABataev updated this revision to Diff 17279.Dec 15 2014, 5:34 AM
ABataev retitled this revision from to Fix for http://llvm.org/PR21915: Assertion Failed on multidimensional VLA in function arguments..
ABataev updated this object.
ABataev edited the test plan for this revision. (Show Details)
ABataev added a reviewer: rjmccall.
ABataev added a subscriber: Unknown Object (MLST).
rjmccall added inline comments.Dec 15 2014, 2:01 PM
lib/CodeGen/CodeGenFunction.h
2752

Pointers aren't the only variably-modified type; you need to be able to look through functions types as well. Something like::

size_t test(int n, int (*(*fn)(void))[n])

And you're not looking through references, either.

But why not just have an exception for any variably-modified type?

2756

If you do keep this code, use castAs<> for casts that you know will succeed.

ABataev updated this revision to Diff 17330.Dec 16 2014, 3:07 AM

John, fixed your comments

rjmccall edited edge metadata.Dec 16 2014, 10:16 AM

Okay, but now that you have an exception for variably-modified types, why you do need to look through pointer types at all? Shouldn't the argument type always match exactly unless it's variably-modified?

Yep, you're right, we don't need to dig through all these pointers. I'll
fix it.

Best regards,

Alexey Bataev

Software Engineer
Intel Compiler Team

16.12.2014 21:16, John McCall пишет:

Okay, but now that you have an exception for variably-modified types, why you do need to look through pointer types at all? Shouldn't the argument type always match exactly unless it's variably-modified?

http://reviews.llvm.org/D6655

EMAIL PREFERENCES

http://reviews.llvm.org/settings/panel/emailpreferences/
ABataev updated this revision to Diff 17379.Dec 17 2014, 1:01 AM
ABataev edited edge metadata.

Update after review

Looks great, thanks!

This revision was automatically updated to reflect the committed changes.