Summary: | hwint.h:250:29: runtime error: shift exponent 64 is too large for 64-bit type 'long int' | ||
---|---|---|---|
Product: | gcc | Reporter: | Markus Trippelsdorf <trippels> |
Component: | fortran | Assignee: | rsandifo <rsandifo> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | rsandifo, zadeck, zadeck |
Priority: | P3 | ||
Version: | 5.0 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2015-02-21 00:00:00 | |
Bug Depends on: | |||
Bug Blocks: | 63426 |
Description
Markus Trippelsdorf
2014-10-01 10:22:26 UTC
This failure is caused by the caller trying to sign extend something with a precision of zero. This bug should be fixed upstream of this call. 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) 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. 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 closing as fixed |