This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Fix accidental reuse of VLA size
ClosedPublic

Authored by rogfer01 on Aug 6 2021, 1:32 PM.

Details

Summary

We were using an OpaqueValueExpr allocated on the stack to store the size of a VLA. Because the VLASizeMap in CodegenFunction uses the address of the expression to avoid recomputing VLAs, we were accidentally reusing an earlier llvm::Value. This led to invalid LLVM IR.

After this change, we allocate the OpaqueValueExpr in ASTContext rather than in the stack. This is a temporary solution until VLASizeMap can be pushed and popped based on the context.

Diff Detail

Event Timeline

rogfer01 created this revision.Aug 6 2021, 1:32 PM
rogfer01 requested review of this revision.Aug 6 2021, 1:32 PM
Herald added a project: Restricted Project. · View Herald Transcript
This revision is now accepted and ready to land.Aug 6 2021, 1:34 PM

Thanks for the prompt review @ABataev! I'll push this shortly.

This revision was automatically updated to reflect the committed changes.