https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114693

            Bug ID: 114693
           Summary: `expand` introduce redundant store facing logic
                    expression
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: absoler at smail dot nju.edu.cn
  Target Milestone: ---

A simple case, regression from gcc-5
```
struct S{
    char  f0;
    int  f3;
} s;
int g, f;

void func_1() {
  int a = 0;
  s.f0 = 1 && ((3 > a) & g);
}
```
compiled with -O2 :

```
func_1():
  401340:       mov    0x10846(%rip),%eax        # 411b8c <g>
  401346:       mov    %al,0x10844(%rip)        # 411b90 <s>
  40134c:       andb   $0x1,0x1083d(%rip)        # 411b90 <s>
  401353:       retq  
```

it seems "1 && " interfere the compiler, after removing it the compiler
generates:
```
func_1():
  401340:       movzbl 0x10845(%rip),%eax        # 411b8c <g>
  401347:       and    $0x1,%eax
  40134a:       mov    %al,0x10840(%rip)        # 411b90 <s>
  401350:       retq   
```

Reply via email to