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

            Bug ID: 117356
           Summary: __builtin_mul_overflow_p(signed, 1, unsigned long)
                    should be just changed to `signed<0`
           Product: gcc
           Version: 15.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:
```
#if 1
int
foo(int s)
{
  unsigned t;
  return __builtin_mul_overflow(s, 1, &t);
}
#endif

int
foo1(int s)
{
long long t = s;
unsigned u = s;
long long tt = u;
return t != tt;
}


int
foo2(long s)
{
 return s < 0;
}
//slt a1,a0,zero # a1 = 1 if x is negative, 0 if 0 or positive

```

There are a few more dealing with MULT_OVERFLOW with 1. Especially if only
IMAGPART_EXPR is used.

Reply via email to