https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124334
Bug ID: 124334
Summary: -flto=auto prevents -Wnull-dereference
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: janisozaur+gcc at gmail dot com
Target Milestone: ---
Created attachment 63804
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63804&action=edit
distilled Ride.cpp testcase
In GCC 15.2 and current trunk (tested on godbolt) using `-flto=auto` prevents
`-Wnull-dereference` from reporting an error.
Originally reported as https://github.com/OpenRCT2/OpenRCT2/issues/26117
Distilled test case is provided, available online here:
https://godbolt.org/z/Gqnr5dK35.
Compile with:
`gcc -O2 -Wnull-dereference -flto-auto -c Ride.cpp` observe result differs from
when not using lto.