-
Notifications
You must be signed in to change notification settings - Fork 13.7k
[Clang] Fix null pointer dereference in enum debug info generation #97105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,3 +98,6 @@ enum E8 { A8 = -128, B8 = 127 } x8; | |
// CHECK-NOT: DIFlagEnumClass | ||
// CHECK: !DIEnumerator(name: "A8", value: -128) | ||
|
||
// Forward declaration of an enum class. | ||
enum class Color : int; | ||
// CHECK-NOT: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Color" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you run this test? Because an unused enum like this usually isn't/shouldn't be emitted into the output... - note all the other enums have a variable declared of their type (the trailing "} xN;")
Comment on lines
+101
to
+103
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please follow the naming patterns already used in the test and rename the new enumeration to I added this change to my local build, but the test still passes without the associated change to
Can you do a bit more debugging to see if calls to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I spent some time experimenting and debugging today but have not been able to find a way for The most interesting scenario I played with involved use of the enumeration type within its own definition. In that context, the type is incomplete, but a definition is (being made) available. I wouldn't expect generation of debug info to ever be sensitive to such a context though. I know little about how debug information is generated, but seeing as the function under discussion is part of code generation, I wouldn't expect a not-yet-completed definition to ever be observed. I think adding an assert as proposed in #105556 suffices to address the static analysis concern. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have an example/reproducer where this would get exercised?