[Bug fortran/50892] Internal compiler error: in gimplify_expr, at gimplify.c:7477
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50892 --- Comment #10 from Janne Blomqvist --- Author: jb Date: Sat Jan 6 10:41:03 2018 New Revision: 256310 URL: https://gcc.gnu.org/viewcvs?rev=256310=gcc=rev Log: PR 50892 Latent bug in char pointer assignment Due to r256284 (PR 78534) there was a latent bug that reared it's head due to different character length types in the pointer assignment. Fixed by this patch, which also adds a reduced testcase. Regtested on x86_64-pc-linux-gnu, committed to trunk as obvious. gcc/fortran/ChangeLog: 2018-01-06 Janne BlomqvistPR fortran/50892 * trans-expr.c (gfc_trans_pointer_assignment): fold_convert rhs to lhs type. gcc/testsuite/ChangeLog: 2018-01-06 Janne Blomqvist PR fortran/50892 * gfortran.dg/char_pointer_assign_icb_1.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/char_pointer_assign_icb_1.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-expr.c trunk/gcc/testsuite/ChangeLog
[Bug fortran/50892] Internal compiler error: in gimplify_expr, at gimplify.c:7477
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50892 --- Comment #9 from Janne Blomqvist --- Following r256284 (PR 78534) the original testcase ICE's. Interestingly, the reduced testcases in #c2 and #c3 work fine. The patch below fixes the ICE diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 533435a..82fe424 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -8392,7 +8392,9 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2) if (expr1->ts.deferred) { if (expr2->expr_type != EXPR_NULL && lse.string_length != NULL) - gfc_add_modify (, lse.string_length, rse.string_length); + gfc_add_modify (, lse.string_length, + fold_convert (TREE_TYPE (lse.string_length), + rse.string_length)); else if (lse.string_length != NULL) gfc_add_modify (, lse.string_length, build_zero_cst (TREE_TYPE (lse.string_length)));
[Bug fortran/50892] Internal compiler error: in gimplify_expr, at gimplify.c:7477
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50892 Jerry DeLisle changed: What|Removed |Added CC||jvdelisle at gcc dot gnu.org --- Comment #8 from Jerry DeLisle --- (In reply to Dominique d'Humieres from comment #7) > > Likely by r240850. > > Confirmed. IMO there is no need for a new test, hence closing s FIXED.` hmm, guess we need this test case now.
[Bug fortran/50892] Internal compiler error: in gimplify_expr, at gimplify.c:7477
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50892 Dominique d'Humieres changed: What|Removed |Added Status|WAITING |RESOLVED Resolution|--- |FIXED --- Comment #7 from Dominique d'Humieres --- > Likely by r240850. Confirmed. IMO there is no need for a new test, hence closing s FIXED.`
[Bug fortran/50892] Internal compiler error: in gimplify_expr, at gimplify.c:7477
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50892 Dominique d'Humieres changed: What|Removed |Added Status|NEW |WAITING CC||lkrupp at gcc dot gnu.org --- Comment #6 from Dominique d'Humieres --- > AFAICT this PR has been fixed between revisions r240781 and r240870. Likely by r240850.
[Bug fortran/50892] Internal compiler error: in gimplify_expr, at gimplify.c:7477
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50892 --- Comment #5 from Dominique d'Humieres --- AFAICT this PR has been fixed between revisions r240781 and r240870.
[Bug fortran/50892] Internal compiler error: in gimplify_expr, at gimplify.c:7477
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50892 Dominique d'Humieres changed: What|Removed |Added CC||bugs at stellardeath dot org --- Comment #4 from Dominique d'Humieres --- *** Bug 64947 has been marked as a duplicate of this bug. ***
[Bug fortran/50892] Internal compiler error: in gimplify_expr, at gimplify.c:7477
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50892 Francois-Xavier Coudert fxcoudert at gcc dot gnu.org changed: What|Removed |Added CC||fxcoudert at gcc dot gnu.org --- Comment #3 from Francois-Xavier Coudert fxcoudert at gcc dot gnu.org --- Further reduced testcase still fails. Shows that it's all about the character length, not C binding or the C_PTR derived type: program test character, pointer :: str str = g(42) contains function g(i) integer, value :: i character(len=i), pointer :: g end function end
[Bug fortran/50892] Internal compiler error: in gimplify_expr, at gimplify.c:7477
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50892 Tobias Burnus burnus at gcc dot gnu.org changed: What|Removed |Added Keywords||ice-on-valid-code CC||burnus at gcc dot gnu.org Known to fail||4.3.4 --- Comment #2 from Tobias Burnus burnus at gcc dot gnu.org 2011-10-29 15:04:34 UTC --- (In reply to comment #0) In addition to the internal compiler error, there is a problem mentioned in a comment. According to a Fortran language lawyer, Fortran 2008 allows two local definitions of procedures to have the same binding label. This problem is illustrated in a comment. I think that's PR 48858. I'm mainly filing this bug because of the internal compiler error Simplified test case below. Dump shows: test () { character(kind=1)[1:1] * str; void * text; static void fortranchar (character(kind=1)[1:] * , integer(kind=4), void *); { character(kind=1)[1:MAX_EXPR D.1732, 0] * pstr.0; integer(kind=4) D.1732; void * D.1730; D.1730 = text; D.1732 = strlen (*D.1730); fortranchar (pstr.0, MAX_EXPR D.1732, 0, D.1730); str = (character(kind=1)[1:1] *) pstr.0; } } program test use, intrinsic :: ISO_C_Binding, only: c_ptr, c_int, c_char type(c_ptr) :: text character, pointer :: str interface pure integer(c_int) function strlen (c) bind(c,name='strlen') import type(c_ptr), intent(in), value :: c end function strlen end interface str = FortranChar(text) contains function FortranChar ( C ) type(c_ptr), intent(in), value :: C character(len=strlen(c),kind=c_char), pointer :: FortranChar end function FortranChar end program test
[Bug fortran/50892] Internal compiler error: in gimplify_expr, at gimplify.c:7477
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50892 Richard Guenther rguenth at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2011-10-28 Ever Confirmed|0 |1 Known to fail||4.7.0 --- Comment #1 from Richard Guenther rguenth at gcc dot gnu.org 2011-10-28 09:42:57 UTC --- Confirmed. #1 0x009ab110 in gimplify_expr (expr_p=0x75b3d078, pre_p=0x7fffbdc8, post_p=0x7fff84f8, gimple_test_f= 0x93fdf9 is_gimple_val(tree_node*), fallback=1) at /space/rguenther/src/svn/trunk/gcc/gimplify.c:7599 7599 gcc_assert (!VOID_TYPE_P (TREE_TYPE (*expr_p))); (gdb) call debug_generic_expr (*expr_p) *D.1735 #3 0x009840a8 in gimplify_call_expr (expr_p=0x75a2d7a8, pre_p=0x7fffbdc8, want_value=true) at /space/rguenther/src/svn/trunk/gcc/gimplify.c:2438 2438EXPR_LOCATION (*expr_p)); (gdb) call debug_generic_expr (*expr_p) strlen_void (*D.1735) mem_ref 0x75a2d930 type void_type 0x75a31bd0 void VOID align 8 symtab 0 alias set -1 canonical type 0x75a31bd0 pointer_to_this pointer_type 0x75a31c78 arg 0 var_decl 0x75a2c640 D.1735 type pointer_type 0x75a31c78 type void_type 0x75a31bd0 void public unsigned DI size integer_cst 0x75a20ec0 constant 64 unit size integer_cst 0x75a20ee0 constant 8 align 64 symtab 0 alias set -1 canonical type 0x75a31c78 pointer_to_this pointer_type 0x75a44f18 used unsigned ignored DI file t.f90 line 18 col 0 size integer_cst 0x75a20ec0 64 unit size integer_cst 0x75a20ee0 8 align 64 context function_decl 0x75b38600 test arg 1 integer_cst 0x75a34580 type pointer_type 0x75a31c78 constant 0 t.f90:18:0