From f51921e1737b6675d4aef2c94ca873484639715b Mon Sep 17 00:00:00 2001 From: pault Date: Thu, 1 Mar 2018 11:06:18 +0000 Subject: [PATCH] 2018-03-01 Paul Thomas PR fortran/84219 * target-memory.c (gfc_interpret_derived): Assert that BT_VOID components are caf tokens. (gfc_target_interpret_expr): Treat BT_VOID expressions as integers. 2018-03-01 Paul Thomas PR fortran/84219 * gfortran.dg/coarray_47.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@258098 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/target-memory.c | 8 ++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/coarray_47.f90 | 13 +++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/coarray_47.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index fd522b65741..742b83d096b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,13 @@ 2018-03-01 Paul Thomas + PR fortran/84219 + * target-memory.c (gfc_interpret_derived): Assert that BT_VOID + components are caf tokens. + (gfc_target_interpret_expr): Treat BT_VOID expressions as + integers. + +2018-03-01 Paul Thomas + PR fortran/84538 * class.c (class_array_ref_detected): Remove the condition that there be no reference after the array reference. diff --git a/gcc/fortran/target-memory.c b/gcc/fortran/target-memory.c index e445fbe665d..6b9292b5faf 100644 --- a/gcc/fortran/target-memory.c +++ b/gcc/fortran/target-memory.c @@ -547,6 +547,7 @@ gfc_interpret_derived (unsigned char *buffer, size_t buffer_size, gfc_expr *resu gcc_assert (ptr % 8 == 0); ptr = ptr/8 + TREE_INT_CST_LOW (DECL_FIELD_OFFSET (cmp->backend_decl)); + gcc_assert (e->ts.type != BT_VOID || cmp->attr.caf_token); gfc_target_interpret_expr (&buffer[ptr], buffer_size - ptr, e, true); } @@ -602,6 +603,13 @@ gfc_target_interpret_expr (unsigned char *buffer, size_t buffer_size, gcc_assert (result->representation.length >= 0); break; + case BT_VOID: + /* This deals with caf_tokens. */ + result->representation.length = + gfc_interpret_integer (result->ts.kind, buffer, buffer_size, + result->value.integer); + break; + default: gfc_internal_error ("Invalid expression in gfc_target_interpret_expr."); break; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 53475440415..e4ed421e7be 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2018-03-01 Paul Thomas + PR fortran/84219 + * gfortran.dg/coarray_47.f90: New test. + +2018-03-01 Paul Thomas + PR fortran/84538 * gfortran.dg/class_array_23.f03: New test. diff --git a/gcc/testsuite/gfortran.dg/coarray_47.f90 b/gcc/testsuite/gfortran.dg/coarray_47.f90 new file mode 100644 index 00000000000..c33eb9c2d7c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_47.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } +! { dg-options "-fcoarray=single" } +! +! Contributed by G Steinmetz +! +program p + type t + integer, allocatable :: t + end type + type(t) :: x + integer :: i = -1 + print *, transfer(i, x) ! { dg-error "cannot have ALLOCATABLE components" } +end -- 2.11.4.GIT