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

            Bug ID: 122848
           Summary: `zero_extend<a> & sign_extend<a>` is not optimized to
                    `zero_extend<a>` for the gimple level
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
int f(unsigned char a)
{
  int t = a;
  int t1 = (signed char)a;
  return t & t1;
}

```

This should just be optimized to `return (int)a`;

Noticed on accident when looking into PR 122847.

Reply via email to