runtime, cmd/compile: implicit allocations allowed in the runtime #42158
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
FeatureRequest
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
We have a test in the compiler that ensures that we don't have any implicit allocations in the runtime. We want all allocations that the runtime does to be explicit (to avoid things like self-deadlock when allocating inside malloc).
That test doesn't catch all the allocations. In particular, it doesn't catch the allocation required to assign non-pointer types to interfaces. There may be others, I haven't checked.
I hacked a simple test into the compiler, and found a bunch of situations where this implicit allocation happens. An example:
This code needs to allocate a
boundsError
and put its address in the data field of an interface.All current missed interface-conversion allocations are of this form (an argument to
panic
).I ran into this issue in a CL I'm working on where implicit allocations were happening in a bad place, and it took me a while to track it down. It would have been much easier for the compiler to give me an error.
Update #42076
@josharian
The text was updated successfully, but these errors were encountered: