From 98a36c7ca05d1acbd0a06c43bb0e0b0c4596ed5e Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Fri, 12 Oct 2007 16:45:46 +0000 Subject: re PR fortran/33664 (crash on invalid program) 2007-10-12 Paul Thomas PR fortran/33664 * expr.c (gfc_specification_expr): If a function is not external, intrinsic or pure is an error. Set the symbol pure to prevent repeat errors. 2007-10-12 Paul Thomas PR fortran/33664 * gfortran.dg/impure_spec_expr_1.f90: New test. * gfortran.dg/char_result_7.f90: Remove illegal test. From-SVN: r129267 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/expr.c | 12 ++++++++++++ 2 files changed, 19 insertions(+) (limited to 'gcc/fortran') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3b36e3f..c6e6d7e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2007-10-12 Paul Thomas + + PR fortran/33664 + * expr.c (gfc_specification_expr): If a function is not + external, intrinsic or pure is an error. Set the symbol pure + to prevent repeat errors. + 2007-10-10 Francois-Xavier Coudert PR fortran/33636 diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 16dc2b1..447263a 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -2526,6 +2526,18 @@ gfc_specification_expr (gfc_expr *e) return FAILURE; } + if (e->expr_type == EXPR_FUNCTION + && !e->value.function.isym + && !e->value.function.esym + && !gfc_pure (e->symtree->n.sym)) + { + gfc_error ("Function '%s' at %L must be PURE", + e->symtree->n.sym->name, &e->where); + /* Prevent repeat error messages. */ + e->symtree->n.sym->attr.pure = 1; + return FAILURE; + } + if (e->rank != 0) { gfc_error ("Expression at %L must be scalar", &e->where); -- cgit v1.1