On 2023-02-04 11:53, Sam James wrote:
I'd consider using #pragma GCC ... to suppress -Wuse-after-free for the "problematic" lines instead. It'd avoid the risk of either optimisations or sanitisers respectively causing us pain in future.
I don't see why that pragma would avoid those problems. All it would do is shut off the warnings; GCC's underlying analyses would be the same, and GCC would generate the same machine code. In that sense these warnings are useful - they're canaries in the coal mine.