[Bug fortran/78618] ICE in gfc_check_rank, at fortran/check.c:3670
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Dec 2 00:17:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78618
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #3 from kargl at gcc dot gnu.org ---
This fixes the ICE. It does not produce the error in assigning
an out-of-range kind=4 character to a kind=1 character.
Index: gcc/fortran/check.c
===================================================================
--- gcc/fortran/check.c (revision 243142)
+++ gcc/fortran/check.c (working copy)
@@ -3667,7 +3667,7 @@ gfc_check_range (gfc_expr *x)
bool
-gfc_check_rank (gfc_expr *a ATTRIBUTE_UNUSED)
+gfc_check_rank (gfc_expr *a)
{
/* Any data object is allowed; a "data object" is a "constant (4.1.3),
variable (6), or subobject of a constant (2.4.3.2.3)" (F2008, 1.3.45).
*/
@@ -3676,9 +3676,16 @@ gfc_check_rank (gfc_expr *a ATTRIBUTE_UN
/* Functions returning pointers are regarded as variable, cf. F2008, R602.
*/
if (a->expr_type == EXPR_FUNCTION)
- is_variable = a->value.function.esym
- ? a->value.function.esym->result->attr.pointer
- : a->symtree->n.sym->result->attr.pointer;
+ {
+ if (a->value.function.esym)
+ is_variable = a->value.function.esym->result->attr.pointer;
+ else if (a->symtree->n.sym->result)
+ is_variable = a->symtree->n.sym->result->attr.pointer;
+ else if (a->symtree->n.sym->value)
+ is_variable = true;
+ else
+ gfc_internal_error ("gfc_check_rank(): invalid function result");
+ }
if (a->expr_type == EXPR_OP || a->expr_type == EXPR_NULL
|| a->expr_type == EXPR_COMPCALL|| a->expr_type == EXPR_PPC
More information about the Gcc-bugs
mailing list