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

            Bug ID: 93044
           Summary: extra cast is not removed
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

While looking into some bit-field code generation, I found a case where we
don't remove a cast.  A slightly different testcase GCC does.
Take:
void f(signed char *a, unsigned char *c)
{
  unsigned short b = *a;
  *c = ((unsigned char)b);
}

---- CUT ---
We are not able to remove the cast there.

But if we change it to:

void f1(signed char *a, unsigned char *c)
{
  signed short b = *a;
  *c = ((unsigned char)b);
}
---- CUT ----
We are able to remove it.

Reply via email to