[Bug fortran/65677] Incomplete assignment on deferred-length character variable
tkoenig at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Aug 7 17:40:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65677
--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
ig25@linux-fd1f:~/Krempel/Ass> cat a.f90
program main
character(:), allocatable :: text
text = 'asdf'
text = adjustl(text(2:))
print *,text
end program main
ig25@linux-fd1f:~/Krempel/Ass> gfortran a.f90
ig25@linux-fd1f:~/Krempel/Ass> ./a.out
sd
Should be 'sdf'.
Hmm... the rather obvious-looking patch
Index: frontend-passes.c
===================================================================
--- frontend-passes.c (Revision 239218)
+++ frontend-passes.c (Arbeitskopie)
@@ -174,7 +174,7 @@
return 0;
expr2 = gfc_discard_nops (co->expr2);
- if (expr2->expr_type != EXPR_VARIABLE)
+ if (expr2->expr_type != EXPR_VARIABLE && expr2->expr_type != EXPR_FUNCTION)
return 0;
if (!gfc_check_dependency (expr1, expr2, true))
fails rather spectacularly with
a.f90:5:0:
text = adjustl(text(2:))
internal compiler error: in fold_binary_loc, bei fold-const.c:9105
0x9297f9 fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
../../trunk/gcc/fold-const.c:9102
0x93225a fold_build2_stat_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
../../trunk/gcc/fold-const.c:12287
0x7522d3 alloc_scalar_allocatable_for_assignment
../../trunk/gcc/fortran/trans-expr.c:9051
0x7522d3 gfc_trans_assignment_1
../../trunk/gcc/fortran/trans-expr.c:9440
0x70b4c5 trans_code
../../trunk/gcc/fortran/trans.c:1678
0x78cc58 gfc_trans_block_construct(gfc_code*)
../../trunk/gcc/fortran/trans-stmt.c:1799
0x70b287 trans_code
../../trunk/gcc/fortran/trans.c:1783
0x73a048 gfc_generate_function_code(gfc_namespace*)
../../trunk/gcc/fortran/trans-decl.c:6207
0x6c5106 translate_all_program_units
../../trunk/gcc/fortran/parse.c:5916
0x6c5106 gfc_parse_file()
../../trunk/gcc/fortran/parse.c:6122
0x707382 gfc_be_parse_file
../../trunk/gcc/fortran/f95-lang.c:198
More information about the Gcc-bugs
mailing list