This is an archive of the discontinued LLVM Phabricator instance.

Restrict lvalue-to-rvalue conversions in CGExprConstant.
ClosedPublic

Authored by efriedma on Apr 12 2022, 5:32 PM.

Details

Summary

We were generating wrong code for cxx20-consteval-crash.cpp: instead of loading a value of a variable, we were using its address as the initializer.

Found while adding code to verify the size of constant initializers.

Diff Detail

Event Timeline

efriedma created this revision.Apr 12 2022, 5:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 12 2022, 5:32 PM
efriedma requested review of this revision.Apr 12 2022, 5:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 12 2022, 5:32 PM
Miss_Grape added inline comments.
clang/lib/CodeGen/CGExprConstant.cpp
1096

Could you add a test case?

rsmith accepted this revision.Apr 12 2022, 9:00 PM

LGTM

This revision is now accepted and ready to land.Apr 12 2022, 9:00 PM
aaron.ballman accepted this revision.Apr 13 2022, 4:18 AM

LGTM, thanks for catching this (sorry, pretty sure this was my bug)!

efriedma added inline comments.Apr 13 2022, 11:12 AM
clang/lib/CodeGen/CGExprConstant.cpp
1096

Compound literals are covered by existing testcases, if that's what you're asking.

This revision was landed with ongoing or failed builds.Apr 13 2022, 12:35 PM
This revision was automatically updated to reflect the committed changes.