Defining what happens when a bool isn’t 0 or 1

I don’t think the default behavior should depend on the target, that’s going to lead to some really hard-to-debug scenarios when going from a nonzero target to a truncate target. Personally, I think the default behavior should be nonzero for improved security; people who need the performance tradeoff on a target where truncate performs slightly better can opt into it. But I think that can also be hashed out on the PR rather than part of the RFC (I don’t insist on this approach, I just think it’s the more user-friendly option than what’s proposed).

The area team did not discuss this RFC specifically at our last meeting, so this is my personal reading of the thread – I think this has consensus to move forward. There may be some details to iron out during the PR review, but I don’t see any significant push-back on the idea or the direction it’s heading. I feel comfortable accepting on behalf of the area team.

2 Likes

Replying to Richard Bieber on there: -fstrict-bool=trap seems like a valid future extension for Clang and an attractive alternate spelling for the existing GCC option.

We would call the existing behavior -fstrict-bool=ub .

1 Like