This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/82491] UBSAN in gcc/gimple-fold.c:6187:6: runtime error: signed integer overflow: 9223372036854775807 * 8 cannot be represented in type 'long int'
- From: "rsandifo at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 21 Mar 2018 12:58:40 +0000
- Subject: [Bug tree-optimization/82491] UBSAN in gcc/gimple-fold.c:6187:6: runtime error: signed integer overflow: 9223372036854775807 * 8 cannot be represented in type 'long int'
- Auto-submitted: auto-generated
- References: <bug-82491-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82491
--- Comment #9 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #8)
> (In reply to Jakub Jelinek from comment #7)
> > Dunno, either perform the calculation in poly_uint64 instead and then cast
> > to poly_int64, or don't do it at all if there is overflow.
>
> Richard, may I ask you please one more time for poly_int hint how to write
> overflow checking?
What Jakub said about using poly_uint64 for the calculations
sounds right in this context. CONST_INTs (and thus CONST_INT
offsets) aren't inherently signed or unsigned.