From: Steven G. Kargl Date: Fri, 30 Oct 2015 18:13:50 +0000 (+0000) Subject: re PR fortran/51993 (Erroneous type component initialization leads to internal compil... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=834e9dbb3999af9b49ba168c7e870f484504d35f;p=gcc.git re PR fortran/51993 (Erroneous type component initialization leads to internal compiler error) 2015-10-15 Steven G. Kargl PR fortran/51993 * decl.c (gfc_set_constant_character_len): Convert gcc_assert into an if-statement causing an early return leads to valid error message. 2015-10-15 Steven G. Kargl PR fortran/51993 * gfortran.dg/pr51993.f90: New test. From-SVN: r229594 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index f197ca9f022..8b99c0349f7 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2015-10-15 Steven G. Kargl + + PR fortran/51993 + * decl.c (gfc_set_constant_character_len): Convert gcc_assert into an + if-statement causing an early return leads to valid error message. + 2015-10-30 Steven G. Kargl PR fortran/36192 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 5a95fa4f193..7178aafe5e1 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -1293,7 +1293,9 @@ gfc_set_constant_character_len (int len, gfc_expr *expr, int check_len) int slen; gcc_assert (expr->expr_type == EXPR_CONSTANT); - gcc_assert (expr->ts.type == BT_CHARACTER); + + if (expr->ts.type != BT_CHARACTER) + return; slen = expr->value.character.length; if (len != slen) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 04f47e065fd..2e741529375 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-10-15 Steven G. Kargl + + PR fortran/51993 + * gfortran.dg/pr51993.f90: New test. + 2015-10-30 Vladimir Makarov PR rtl-optimization/68106 diff --git a/gcc/testsuite/gfortran.dg/pr51993.f90 b/gcc/testsuite/gfortran.dg/pr51993.f90 new file mode 100644 index 00000000000..753dd6fc80c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr51993.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR fortran/51993 +! Code contributed by Sebastien Bardeau +module mymod + type :: mytyp + character(len=3) :: a = .true. ! { dg-error "convert LOGICAL" } + end type mytyp +end module mymod