public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/63427] New: hwint.h:250:29: runtime error: shift exponent 64 is too large for 64-bit type 'long int'
@ 2014-10-01 10:22 trippels at gcc dot gnu.org
  2014-10-01 12:44 ` [Bug fortran/63427] " trippels at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-10-01 10:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63427
           Summary: hwint.h:250:29: runtime error: shift exponent 64 is
                    too large for 64-bit type 'long int'
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org
                CC: zadeck at gcc dot gnu.org
            Blocks: 63426

gcc build with "-fsanitize=undefined" hits the following issue 
when compiling testsuite/gfortran.dg/integer_exponentiation_5.F90:

markus@x4 gfortran %
/var/tmp/gcc_build_dir_/gcc/testsuite/gfortran/../../gfortran
-B/var/tmp/gcc_build_dir_/gcc/testsuite/gfortran/../../
-B/var/tmp/gcc_build_dir_/x86_64-unknown-linux-gnu/./libgfortran/
/var/tmp/gcc/gcc/testsuite/gfortran.dg/integer_exponentiation_5.F90 
-fno-diagnostics-show-caret -fdiagnostics-color=never    -O0  -fno-range-check 
-B/var/tmp/gcc_build_dir_/x86_64-unknown-linux-gnu/./libgfortran/.libs
-L/var/tmp/gcc_build_dir_/x86_64-unknown-linux-gnu/./libgfortran/.libs
-L/var/tmp/gcc_build_dir_/x86_64-unknown-linux-gnu/./libgfortran/.libs
-B/var/tmp/gcc_build_dir_/x86_64-unknown-linux-gnu/./libquadmath/.libs
-L/var/tmp/gcc_build_dir_/x86_64-unknown-linux-gnu/./libquadmath/.libs
-L/var/tmp/gcc_build_dir_/x86_64-unknown-linux-gnu/./libquadmath/.libs  -lm   
-o ./integer_exponentiation_5.exe                                               
../../gcc/gcc/hwint.h:250:19: runtime error: shift exponent 64 is too large for
64-bit type 'long int'
../../gcc/gcc/hwint.h:250:29: runtime error: shift exponent 64 is too large for
64-bit type 'long int'


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/63427] hwint.h:250:29: runtime error: shift exponent 64 is too large for 64-bit type 'long int'
  2014-10-01 10:22 [Bug middle-end/63427] New: hwint.h:250:29: runtime error: shift exponent 64 is too large for 64-bit type 'long int' trippels at gcc dot gnu.org
@ 2014-10-01 12:44 ` trippels at gcc dot gnu.org
  2015-02-21 14:43 ` rsandifo at gcc dot gnu.org
  2015-02-24  0:05 ` rsandifo at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-10-01 12:44 UTC (permalink / raw)
  To: gcc-bugs

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

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |fortran

--- Comment #2 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Thanks.
Backtrace shows that it is a Fortran issue:

Breakpoint 1, 0x00007ffff6e33160 in __ubsan::Diag::~Diag() () from
/usr/lib/gcc/x86_64-pc-linux-gnu/5.0.0/libubsan.so.0
(gdb) bt
#0  0x00007ffff6e33160 in __ubsan::Diag::~Diag() () from
/usr/lib/gcc/x86_64-pc-linux-gnu/5.0.0/libubsan.so.0
#1  0x00007ffff6e35e1a in
handleShiftOutOfBoundsImpl(__ubsan::ShiftOutOfBoundsData*, unsigned long,
unsigned long, __ubsan::ReportOptions) ()
   from /usr/lib/gcc/x86_64-pc-linux-gnu/5.0.0/libubsan.so.0
#2  0x00007ffff6e36613 in __ubsan_handle_shift_out_of_bounds () from
/usr/lib/gcc/x86_64-pc-linux-gnu/5.0.0/libubsan.so.0
#3  0x00000000019d5e10 in sext_hwi (prec=<optimized out>, src=<optimized out>)
at ../../gcc/gcc/hwint.h:250
#4  set_len (is_sign_extended=<optimized out>, l=<optimized out>,
this=<optimized out>) at ../../gcc/gcc/wide-int.h:1075
#5  wi::from_mpz (type=0x11, x=0x53b5e20, wrap=64, wrap@entry=true) at
../../gcc/gcc/wide-int.cc:265
#6  0x00000000007633a5 in gfc_conv_mpz_to_tree (i=0x53b5e20, kind=8) at
../../gcc/gcc/fortran/trans-const.c:206
#7  0x0000000000764c38 in gfc_conv_constant (se=0x7fffffffd760, expr=0x53b5da0)
at ../../gcc/gcc/fortran/trans-const.c:403
#8  0x00000000007aec0b in gfc_conv_expr (se=se@entry=0x7fffffffd760,
expr=expr@entry=0x53b5da0) at ../../gcc/gcc/fortran/trans-expr.c:6520
#9  0x00000000007ba908 in gfc_conv_expr_reference (se=0x7fffffffd760,
expr=0x53b5da0) at ../../gcc/gcc/fortran/trans-expr.c:6651
#10 0x00000000007a0ccf in gfc_conv_procedure_call (se=0x7fffffffd170,
se@entry=0x7fffffffd8b0, sym=0x4396944, args=0x7fffffffd1f0,
args@entry=0x53aa0d0, expr=0x40, 
    expr@entry=0x0, append_args=0x4396940, append_args@entry=0x0) at
../../gcc/gcc/fortran/trans-expr.c:4429
#11 0x0000000000831728 in gfc_trans_call (code=code@entry=0x53b5e70,
dependency_check=<optimized out>, mask=mask@entry=0x0, count1=count1@entry=0x0, 
    invert=invert@entry=false) at ../../gcc/gcc/fortran/trans-stmt.c:408
#12 0x0000000000726aca in trans_code (code=0x53b5e70, cond=cond@entry=0x0) at
../../gcc/gcc/fortran/trans.c:1717
#13 0x000000000072a277 in gfc_trans_code (code=<optimized out>) at
../../gcc/gcc/fortran/trans.c:1928
#14 0x0000000000789f34 in gfc_generate_function_code (ns=<optimized out>) at
../../gcc/gcc/fortran/trans-decl.c:5789
#15 0x000000000072a2a5 in gfc_generate_code (ns=<optimized out>) at
../../gcc/gcc/fortran/trans.c:1945
#16 0x000000000068148b in translate_all_program_units
(gfc_global_ns_list=0x53a48b0) at ../../gcc/gcc/fortran/parse.c:4947
#17 gfc_parse_file () at ../../gcc/gcc/fortran/parse.c:5144
#18 0x0000000000715db8 in gfc_be_parse_file () at
../../gcc/gcc/fortran/f95-lang.c:212
#19 0x000000000129d388 in compile_file () at ../../gcc/gcc/toplev.c:551
#20 0x00000000012a0aab in do_compile () at ../../gcc/gcc/toplev.c:1946
#21 toplev_main (argc=20, argv=0x7fffffffe038) at ../../gcc/gcc/toplev.c:2022
#22 0x00007ffff6ae1fd0 in __libc_start_main () from /lib/libc.so.6
#23 0x000000000058d3a1 in _start ()
(gdb)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/63427] hwint.h:250:29: runtime error: shift exponent 64 is too large for 64-bit type 'long int'
  2014-10-01 10:22 [Bug middle-end/63427] New: hwint.h:250:29: runtime error: shift exponent 64 is too large for 64-bit type 'long int' trippels at gcc dot gnu.org
  2014-10-01 12:44 ` [Bug fortran/63427] " trippels at gcc dot gnu.org
@ 2015-02-21 14:43 ` rsandifo at gcc dot gnu.org
  2015-02-24  0:05 ` rsandifo at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2015-02-21 14:43 UTC (permalink / raw)
  To: gcc-bugs

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

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-02-21
           Assignee|unassigned at gcc dot gnu.org      |rsandifo at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #3 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Caused by wi::from_mpz mishandling the wrap operation.
Related, a testcase like:

program test
  write (*), (2_8 ** 64009999_2) / 2
end program test

(compiled with -fno-range-check) writes way beyond the buffer.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/63427] hwint.h:250:29: runtime error: shift exponent 64 is too large for 64-bit type 'long int'
  2014-10-01 10:22 [Bug middle-end/63427] New: hwint.h:250:29: runtime error: shift exponent 64 is too large for 64-bit type 'long int' trippels at gcc dot gnu.org
  2014-10-01 12:44 ` [Bug fortran/63427] " trippels at gcc dot gnu.org
  2015-02-21 14:43 ` rsandifo at gcc dot gnu.org
@ 2015-02-24  0:05 ` rsandifo at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2015-02-24  0:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Author: rsandifo
Date: Mon Feb 23 23:02:50 2015
New Revision: 220921

URL: https://gcc.gnu.org/viewcvs?rev=220921&root=gcc&view=rev
Log:
gcc/
    PR fortran/63427
    * wide-int.cc (wi::from_mpz): Cope with unwrapped values that are
    too big for a wide_int.  Implement missing wrapping operation.

gcc/testsuite/
    PR fortran/63427
    * gfortran.dg/integer_exponentiation_6.F90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/integer_exponentiation_6.F90
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/wide-int.cc


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-23 23:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-01 10:22 [Bug middle-end/63427] New: hwint.h:250:29: runtime error: shift exponent 64 is too large for 64-bit type 'long int' trippels at gcc dot gnu.org
2014-10-01 12:44 ` [Bug fortran/63427] " trippels at gcc dot gnu.org
2015-02-21 14:43 ` rsandifo at gcc dot gnu.org
2015-02-24  0:05 ` rsandifo at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).