[Bug middle-end/122068] New: Add -fstrict-bool, -fno-strict-bool={truncate,nonzero} option
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 26 09:55:33 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122068
Bug ID: 122068
Summary: Add -fstrict-bool, -fno-strict-bool={truncate,nonzero}
option
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
https://discourse.llvm.org/t/defining-what-happens-when-a-bool-isn-t-0-or-1/86778/34?u=pinskia
This is nice security option which would be good to implement in gcc.
I can think of a few ways of implementing this. One is gimple to rtl expansion
which special cases loads from bool types and for arguments special case those.
The other is during frontend in the gimplification even.
More information about the Gcc-bugs
mailing list