Testcase: subroutine option_stopwatch_s(default_clock) character, intent(in) :: default_clock call option_stopwatch_a((/default_clock/)) end subroutine option_stopwatch_s ------ pc64:~> ~/checkin/bin/gfortran t.f90 -fdump-tree-all t.f90: In function ‘option_stopwatch_s’: t.f90:3: internal compiler error: in gimplify_expr, at gimplify.c:4658 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. ------ In 4.0.3, we ICE differently with: t.f90:1: internal compiler error: in gfc_build_indirect_ref, at fortran/trans.c:291 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. Related to 23634 as it was reduced from that PR (though only to find this bug)
If we make a tempary variable to hold the array, it works: subroutine option_stopwatch_s(default_clock) character(len=2), intent(in) :: default_clock character(len=2), dimension(1) :: a a = (/default_clock/) call option_stopwatch_a(a) end subroutine option_stopwatch_s -------------------------------- The problem is obvious in .t02.orginal: (*(char[0:][1:1] *) atmp.3.data)[NON_LVALUE_EXPR <S.5>] = *(*(char[0:][1:1] *) atmp.0.data)[NON_LVALUE_EXPR <S.5>]; That is an array copy which is just wrong as there is no such thing in Generic or the gimplifier can handle. Confirmed.
the variable does not have to be a "dummy" variable either to reproduce this. subroutine option_stopwatch_s() character(len=1) :: default_clock call option_stopwatch_a((/default_clock/)) end subroutine option_stopwatch_s
(In reply to comment #2) > the variable does not have to be a "dummy" variable either to reproduce this. > subroutine option_stopwatch_s() > character(len=1) :: default_clock > call option_stopwatch_a((/default_clock/)) > end subroutine option_stopwatch_s > Another example of the (probably) same bug (reported by Vivek Rao, reduced by myself): $ cat vivek.f90 character(len=1) :: s(1) = "" integer :: i(1) print *, s(i) end $ gfortran -c vivek.f90 vivek.f90: In function ‘MAIN__’: vivek.f90:3: internal compiler error: in gimplify_expr, at gimplify.c:5788 The top of the gdb backtrace is: Breakpoint 1, fancy_abort (file=0x859ff15 "../../../trunk/gcc/gimplify.c", line=5788, function=0x85a052e "gimplify_expr") at ../../../trunk/gcc/diagnostic.c:641 641 { (gdb) where #0 fancy_abort (file=0x859ff15 "../../../trunk/gcc/gimplify.c", line=5788, function=0x85a052e "gimplify_expr") at ../../../trunk/gcc/diagnostic.c:641 #1 0x080e49d0 in gimplify_expr (expr_p=0xb7bcc09c, pre_p=0xbfafd324, post_p=Variable "post_p" is not available. ) at ../../../trunk/gcc/gimplify.c:5788 #2 0x080e2b5b in gimplify_expr (expr_p=0xb7b6e434, pre_p=0xbfafd324, post_p=0xbfafd320, gimple_test_f=0x80dae80 <is_gimple_mem_rhs>, fallback=fb_rvalue) at ../../../trunk/gcc/gimplify.c:5341 #3 0x080e1a1a in gimplify_modify_expr (expr_p=0xb7bba554, pre_p=0xbfafd324, post_p=0xbfafd320, want_value=0 '\0') at ../../../trunk/gcc/gimplify.c:3433 #4 0x080e3b1a in gimplify_expr (expr_p=0xb7bba554, pre_p=0xbfafd324, post_p=Variable "post_p" is not available. ) at ../../../trunk/gcc/gimplify.c:5270 #5 0x080e5dcf in gimplify_stmt (stmt_p=0xb7bba554) at ../../../trunk/gcc/gimplify.c:4129 #6 0x080e27f7 in gimplify_expr (expr_p=0xb7bb0570, pre_p=0xbfafd3c4, post_p=0xbfafd3c0, gimple_test_f=0x80daf90 <is_gimple_stmt>, fallback=fb_none) at ../../../trunk/gcc/gimplify.c:3591 #7 0x080e5dcf in gimplify_stmt (stmt_p=0xb7bb0570) at ../../../trunk/gcc/gimplify.c:4129 #8 0x080e6c17 in gimplify_to_stmt_list (stmt_p=0xb7bb0570) at ../../../trunk/gcc/gimplify.c:4137 #9 0x080e7753 in gimplify_bind_expr (expr_p=0xb7bba56c, temp=0x0, pre_p=0xbfafd4c4) at ../../../trunk/gcc/gimplify.c:1036 #10 0x080e30e5 in gimplify_expr (expr_p=0xb7bba56c, pre_p=0xbfafd4c4, post_p=0xbfafd4c0, gimple_test_f=0x80daf90 <is_gimple_stmt>, fallback=fb_none) at ../../../trunk/gcc/gimplify.c:5376 #11 0x080e5dcf in gimplify_stmt (stmt_p=0xb7bba56c) at ../../../trunk/gcc/gimplify.c:4129 #12 0x080e27f7 in gimplify_expr (expr_p=0xbfafd5b0, pre_p=0xbfafd564, post_p=0xbfafd560, gimple_test_f=0x80daf90 <is_gimple_stmt>, fallback=fb_none) at ../../../trunk/gcc/gimplify.c:3591 #13 0x080e5dcf in gimplify_stmt (stmt_p=0xbfafd5b0) at ../../../trunk/gcc/gimplify.c:4129 #14 0x080e7c6f in gimplify_and_add (t=0xb7bc88e8, list_p=0xbfafd614) at ../../../trunk/gcc/gimplify.c:336 #15 0x080e2c8c in gimplify_expr (expr_p=0xb7bba590, pre_p=0xbfafd614, post_p=0xbfafd610, gimple_test_f=0x80daf90 <is_gimple_stmt>, fallback=fb_none) at ../../../trunk/gcc/gimplify.c:1241 #16 0x080e5dcf in gimplify_stmt (stmt_p=0xb7bba590) at ../../../trunk/gcc/gimplify.c:4129 #17 0x080e27f7 in gimplify_expr (expr_p=0xb7bb05c0, pre_p=0xbfafd6b4, post_p=0xbfafd6b0, gimple_test_f=0x80daf90 <is_gimple_stmt>, fallback=fb_none) at ../../../trunk/gcc/gimplify.c:3591 #18 0x080e5dcf in gimplify_stmt (stmt_p=0xb7bb05c0) at ../../../trunk/gcc/gimplify.c:4129 #19 0x080e6c17 in gimplify_to_stmt_list (stmt_p=0xb7bb05c0) at ../../../trunk/gcc/gimplify.c:4137 #20 0x080e7753 in gimplify_bind_expr (expr_p=0xb7bba5a8, temp=0x0, pre_p=0xbfafd7b4) at ../../../trunk/gcc/gimplify.c:1036 #21 0x080e30e5 in gimplify_expr (expr_p=0xb7bba5a8, pre_p=0xbfafd7b4, post_p=0xbfafd7b0, gimple_test_f=0x80daf90 <is_gimple_stmt>, fallback=fb_none) at ../../../trunk/gcc/gimplify.c:5376 #22 0x080e5dcf in gimplify_stmt (stmt_p=0xb7bba5a8) at ../../../trunk/gcc/gimplify.c:4129
*** Bug 26491 has been marked as a duplicate of this bug. ***
This one is growing in popularity :)
*** Bug 26550 has been marked as a duplicate of this bug. ***
Subject: Bug 25619 Author: hjl Date: Wed Apr 5 04:47:51 2006 New Revision: 112695 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112695 Log: gcc/fortran/ 2006-04-04 H.J. Lu <hongjiu.lu@intel.com> PR fortran/25619 * trans-array.c (gfc_conv_expr_descriptor): Only dereference character pointer when copying temporary. PR fortran/23634 * trans-array.c (gfc_conv_expr_descriptor): Properly copy temporary character with non constant size. gcc/testsuite/ 2006-04-04 Paul Thomas <pault@gcc.gnu.org> PR fortran/23634 PR fortran/25619 * gfortran.dg/actual_array_constructor_1.f90: New testcase. Added: trunk/gcc/testsuite/gfortran.dg/actual_array_constructor_1.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-array.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 25619 Author: hjl Date: Wed Apr 12 20:58:04 2006 New Revision: 112899 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112899 Log: gcc/fortran/ 2006-04-12 H.J. Lu <hongjiu.lu@intel.com> PR fortran/25619 Backport from mainline 2006-04-04 H.J. Lu <hongjiu.lu@intel.com> * trans-array.c (gfc_conv_expr_descriptor): Only dereference character pointer when copying temporary. PR fortran/23634 Backport from mainline 2006-04-04 H.J. Lu <hongjiu.lu@intel.com> * trans-array.c (gfc_conv_expr_descriptor): Properly copy temporary character with non constant size. gcc/testsuite/ 2006-04-12 H.J. Lu <hongjiu.lu@intel.com> PR fortran/23634 PR fortran/25619 Backport from mainline 2006-04-04 Paul Thomas <pault@gcc.gnu.org> * gfortran.dg/actual_array_constructor_1.f90: New testcase. Added: branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/actual_array_constructor_1.f90 Modified: branches/gcc-4_1-branch/gcc/fortran/ChangeLog branches/gcc-4_1-branch/gcc/fortran/trans-array.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
HJ has fixed this one. Paul