This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/70450] [6 Regression] Wrong code with -O0 and -O1.


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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ok, so

          signop sign = TYPE_SIGN (ctype);
          unsigned prec = TYPE_PRECISION (ctype);
          wide_int mul = wi::mul (wide_int::from (op1, prec, sign),
                                  wide_int::from (c, prec, sign),
                                  sign, &overflow_mul_p);

doesn't sign-extend the int -2 op1.  It's representation _is_ sign-extended
though.

Looks like

1066    wide_int_storage::from (const wide_int_ref &x, unsigned int precision,
1067                            signop sgn)
1068    {
1069      wide_int result = wide_int::create (precision);
1070      result.set_len (wi::force_to_size (result.write_val (), x.val, x.len,
1071                                         x.precision, precision, sgn));
1072      return result;
1073    }

called with sng == UNSIGNED, precision == 64 and x.precision being 32 assumes
it has to zero-extend from x.precision.

Ah, that's what ::from is documented to do.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]