Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/link: bad dwarf for sudog<elemtype> #21094
We generate DWARF types for channels containing various specific types.
The sudog contains a field called elem which points to the element to be sent or received. It has a type of unsafe.Pointer. To make a specific sudog type, we overwrite the elem field's type with the type of the element. That's wrong, we should overwrite with the pointer to-the-element type.
The DWARF is most plainly wrong when the element type isn't the size of a pointer. Then not only is the elem field wrong, but all the subsequent fields in the sudog are at the wrong offsets. (That's how I noticed this.)
I have a fix, just thinking about a test.