This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/70450] [6 Regression] Wrong code with -O0 and -O1.
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 30 Mar 2016 11:17:14 +0000
- Subject: [Bug target/70450] [6 Regression] Wrong code with -O0 and -O1.
- Auto-submitted: auto-generated
- References: <bug-70450-4 at http dot gcc dot gnu dot org/bugzilla/>
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.