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

--- Comment #3 from Drea Pinski <pinskia at gcc dot gnu.org> ---
Oh I see the issue.
In factor_operation_ok I did:
```
  /*  Some builtins should not be factored out with constants being involved. 
*/
  if (!all_ssa_names && code.is_fn_code ())
    return !fn_arg_must_be_const_p (combined_fn (code), opnum);

  // The types are need to be compatible.
  if (opnum >= 0)
    {
      for (size_t i = 1; i < num_args; i++)
        if (!types_compatible_p (TREE_TYPE (args[0]), TREE_TYPE (args[1])))
          return false;
    }
```

The problem is the types are not checked for the function case and I forgot
internal functions can have different argument types.

The simple fix is to swap the order of the checks here.  Will do it this
evening.

Reply via email to