lsils / mockturtle

C++ logic network library
MIT License
212 stars 140 forks source link

Lifetime issue in `tech_library` constructor #662

Closed rocallahan closed 1 month ago

rocallahan commented 1 month ago

The tech_library constructor initializes _supergates_spec to be a reference to the super_lib referenced by the supergates_spec parameter. But the default value for that parameter is a default-constructed super_lib that will be destroyed when the tech_lib constructor returns. So if this default is used _supergates_spec becomes a dangling reference.

(Not super urgent since we haven't actually hit this yet, but it looks like a problem.)

aletempiac commented 1 month ago

Thank you for reporting! This issue shouldn't affect the execution of any program. However, it is good to remove it. Let me know if the change in #665 is good enough.

rocallahan commented 1 month ago

Yes, thanks.