Nothing prevents entries from being bigger than the 16 bit size field in
Dwarf < 5. For entries that are too big, there is nothing we can do
other than not emitting them, unless I missed something.
This fixes PR41038.
The minimal test case attached to the bug report is 500 KB as bitcode and
2.2 MB as IR. Not sure if it makes sense to attach it?
This looks incorrect - is it?
By setting the value to zero, now it refers to a different location list than the one that's intended, right? (it refers to the first one)
So while it doesn't crash, it produces the wrong description (describing one variable as being at the location of another variable).
Seems like if we're going to support this (out of curiosity - where did this come up in the wild? Would it be reasonable to reject this with a report_fatal_error, perhaps? (I know, not elegant/nice, but figured I'd ask)) perhaps we need to keep track of the location offsets as they are added and not include a DW_AT_location at all if its offset would be too large? Not sure if that's possible (if we have the necessary information about all prior location lists to compute their size) - might require delaying adding DW_AT_locations.
(@aprantl @probinson - am I misreading this? What're your thoughts on this?)