From d4319ef830cfbbc12965bd1853cfde919bd842ab Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Tue, 9 Jan 2018 19:49:25 +0000 Subject: [PATCH] re PR fortran/83742 (ICE in gfc_is_simply_contiguous, at fortran/expr.c:5323) 2018-01-09 Steven G. Kargl PR fortran/83742 * expr.c (gfc_is_simply_contiguous): Check for NULL pointer. 2018-01-09 Steven G. Kargl PR fortran/83742 * gfortran.dg/contiguous_6.f90: New test. From-SVN: r256391 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/expr.c | 16 ++++++++-------- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/contiguous_6.f90 | 7 +++++++ 4 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/contiguous_6.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 32586c509f9..e19ed61698b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2018-01-09 Steven G. Kargl + + PR fortran/83742 + * expr.c (gfc_is_simply_contiguous): Check for NULL pointer. + 2018-01-08 Steven G. Kargl * match.c (gfc_match_allocate): Check for NULL pointer. diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 5be8da18b05..45ccc184fc1 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -5313,14 +5313,14 @@ gfc_is_simply_contiguous (gfc_expr *expr, bool strict, bool permit_element) sym = expr->symtree->n.sym; if (expr->ts.type != BT_CLASS - && ((part_ref - && !part_ref->u.c.component->attr.contiguous - && part_ref->u.c.component->attr.pointer) - || (!part_ref - && !sym->attr.contiguous - && (sym->attr.pointer - || sym->as->type == AS_ASSUMED_RANK - || sym->as->type == AS_ASSUMED_SHAPE)))) + && ((part_ref + && !part_ref->u.c.component->attr.contiguous + && part_ref->u.c.component->attr.pointer) + || (!part_ref + && !sym->attr.contiguous + && (sym->attr.pointer + || (sym->as && sym->as->type == AS_ASSUMED_RANK) + || (sym->as && sym->as->type == AS_ASSUMED_SHAPE))))) return false; if (!ar || ar->type == AR_FULL) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bbf9c760647..6357b535b7f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-09 Steven G. Kargl + + PR fortran/83742 + * gfortran.dg/contiguous_6.f90: New test. + 2018-01-09 Richard Biener PR tree-optimization/83668 diff --git a/gcc/testsuite/gfortran.dg/contiguous_6.f90 b/gcc/testsuite/gfortran.dg/contiguous_6.f90 new file mode 100644 index 00000000000..b17c7ed8771 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/contiguous_6.f90 @@ -0,0 +1,7 @@ +! { dg-do compile } +! PR fortran/83742 +! Contributed by Gerhard Steinmetz +program p + real, target :: a + real, pointer, contiguous :: b => a ! { dg-error "has the CONTIGUOUS attribute" } +end -- 2.30.2