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.