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 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'


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

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #7)
> (In reply to Martin Liška from comment #5)
> > Thanks Richard!
> > 
> > Now I still see the other issue in dwarf2out:
> > 
> > Breakpoint 1, based_loc_descr (reg=0x7ffff51183a8, offset=...,
> > initialized=VAR_INIT_STATUS_INITIALIZED) at ../../gcc/dwarf2out.c:14170
> > warning: Source file is more recent than executable.
> > 14170		  elim = strip_offset_and_add (elim, &offset);
> > (gdb) c
> > Continuing.
> > ../../gcc/poly-int.h:414:21: runtime error: signed integer overflow:
> > 9223372036854775789 + 48 cannot be represented in type 'long int'
> >     #0 0xaa9c75 in poly_int_pod<1u, long>& poly_int_pod<1u,
> > long>::operator+=<long>(poly_int_pod<1u, long> const&)
> > ../../gcc/poly-int.h:414
> >     #1 0xaa9266 in strip_offset_and_add(rtx_def*, poly_int_pod<1u, long>*)
> > ../../gcc/rtl.h:4340
> >     #2 0xd4f022 in based_loc_descr ../../gcc/dwarf2out.c:14170
> >     #3 0xd5da4c in mem_loc_descriptor(rtx_def*, machine_mode, machine_mode,
> > var_init_status) ../../gcc/dwarf2out.c:15643
> >     #4 0xd65a2a in loc_descriptor ../../gcc/dwarf2out.c:16616
> > ...
> > 
> > (gdb) p debug_rtx(elim)
> > (plus:DI (reg/f:DI 7 sp)
> >     (const_int 48 [0x30]))
> > $2 = void
> > (gdb) p offset
> > $3 = {<poly_int_pod<1, long>> = {coeffs = {9223372036854775789}}, <No data
> > fields>}
> > 
> > Is it Jakub something we should handle? Do you have a suggestion how to do
> > that?
> 
> 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?

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