https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118742
Bug ID: 118742
Summary: No way to do ~a for a boolean type with the gimple FE
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Blocks: 101057
Target Milestone: ---
Take:
```
_Bool __GIMPLE (ssa,startwith("optimized")) g1(int i)
{
_Bool _1;
int _2;
_Bool _37;
_Bool _52;
_Bool _6;
_Bool _9;
__BB(2,guessed_local(97603132)):
_1 = i_3(D) == 1;
_2 = (int) _1;
_37 = _2 > 0;
_52 = ~_37;
_6 = _2 <= 0;
_9 = _6 | _52;
return _9;
}
```
This is rejected because a convert is added for the `~`:
```
<source>: In function 'g1':
<source>:19:1: error: invalid operand in unary operation
19 | }
| ^
_52 = ~(int) _37;
```
I noticed this while trying to see if I could extract a gimple testcase for PR
118739 .
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101057
[Bug 101057] [meta-bug] [gimplefe] GIMPLE frontend issues