Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: malformed DWARF ranges (child not contained in parent) #33188
What version of Go are you using (
Here is some more detail on what's happening in the compiler with this bug. There are two problems, one easy to fix and the other more difficult.
The first problem is that the code that computes ranges for inlined routines is not doing the book-keeping properly to insure that child ranges are included in parent ranges when handling nested inlines. This problem triggers the verifier's "DIE address ranges are not contained in its parent's ranges" error. I sent CL 248724 to fix this.
The second problem is trickier. The code that tracks variable scopes in the compiler is more or less independent from the code that handles inlining, meaning that when you have an inlined call whose callsite is positioned within a given lexical scope, the inlined routine DIE doesn't wind up as a child of the scope. This triggers a different error ("DIEs have overlapping address ranges").
Here is a reduced testcase that illustrates the second problem:
Here's an abstracted version of the DWARF for main.main you get in this situation:
where the ranges for the lexical block containing "b" look like
which overlaps with the inlined routine but doesn't entirely contain it (and in addition the two DIEs in question are siblings within the main.main DIE, as opposed to having the scope parent the inline.
Fixing this is a good deal more complicated, since the two phases (scope generation and inline handling) operate more or less independently at the moment.