https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115293
Bug ID: 115293 Summary: Warn if a compiler flag downgrades protection provided by -fhardened Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: driver Assignee: unassigned at gcc dot gnu.org Reporter: siddhesh at gcc dot gnu.org Target Milestone: --- When -fhardened is passed alongside options it enables, the options could override behaviour enabled by -fhardened. This is by design, but there's a hole in this, in that accidentally passing, e.g. -fstack-protector alongside -fhardened could downgrade stack protection. Add a new warning (-Wweakened-hardening) that points out such a situation, allowing developers to turn off the warning if the downgrade in hardening is deliberate.