This is an archive of the discontinued LLVM Phabricator instance.

[LLDB] Remove undefined behavior in TestConstStaticIntegralMember.py
ClosedPublic

Authored by shafik on Aug 8 2022, 6:37 PM.

Details

Summary

Setting an enum without a fixed underlying type to a value which is outside the value range is undefined behavior.

The initializer needs to be a constant expression and therefore this was always ill-formed we just were not diagnosing it before.

See D130058 and D131307 for more details.

Diff Detail

Event Timeline

shafik created this revision.Aug 8 2022, 6:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 8 2022, 6:37 PM
shafik requested review of this revision.Aug 8 2022, 6:37 PM
shafik added a comment.Aug 8 2022, 6:42 PM

I will probably land this soon since this is being reported by several built bots and I this should bring the builds back to green. I just wanted the interested parties to see this in case there is some functionality this is testing that I am missing and some additions are needed to cover what you want.

This revision was not accepted when it landed; it landed in state Needs Review.Aug 8 2022, 7:25 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 8 2022, 7:25 PM

Just looking at the test I think the main thing this removes is checking that we can show an enum as a combination of more than one value plus some extra number (invalid_scoped_enum_val is only one valid name plus extra).

Thanks for bringing this to our attention. I'm guessing that the formatting code is the same for scoped/non scoped or non typed so I'll add an extra test for the typed enum to cover the multiple values case.