aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2019-01-15 19:52:08 +0000
committerPaul Thomas <pault@gcc.gnu.org>2019-01-15 19:52:08 +0000
commit92f3a180aaf6f3cd0b06e282632fc320445e3c01 (patch)
tree2da21eecc2233e94fad3334c4efbde354bd97134 /gcc
parent51177d3d648e871c936787f073b72389a4683ca3 (diff)
downloadgcc-92f3a180aaf6f3cd0b06e282632fc320445e3c01.zip
gcc-92f3a180aaf6f3cd0b06e282632fc320445e3c01.tar.gz
gcc-92f3a180aaf6f3cd0b06e282632fc320445e3c01.tar.bz2
trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Deal with exprs that are indirect references; ie.
2019-01-15 Paul Thomas <pault@gcc.gnu.org> * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Deal with exprs that are indirect references; ie. dummy arguments. 2019-01-15 Paul Thomas <pault@gcc.gnu.org> * gfortran.dg/ISO_Fortran_binding_2.c : Change reference to ISO_Fortran_binding_2.h. From-SVN: r267946
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/trans-expr.c11
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c2
4 files changed, 21 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 7ea2749..a8cb6dd 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,8 @@
+2019-01-15 Paul Thomas <pault@gcc.gnu.org>
+
+ * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Deal with exprs
+ that are indirect references; ie. dummy arguments.
+
2019-01-13 Dominique d'Humieres <dominiq@gcc.gnu.org>
PR fortran/88803
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index c3388d7..b38d784 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -4919,6 +4919,10 @@ gfc_conv_gfc_desc_to_cfi_desc (gfc_se *parmse, gfc_expr *e, gfc_symbol *fsym)
{
gfc_conv_expr_descriptor (parmse, e);
+ if (POINTER_TYPE_P (TREE_TYPE (parmse->expr)))
+ parmse->expr = build_fold_indirect_ref_loc (input_location,
+ parmse->expr);
+
/* All the temporary descriptors are marked as DECL_ARTIFICIAL. If
the expression type is different from the descriptor type, then
the offset must be found (eg. to a component ref or substring)
@@ -4949,6 +4953,11 @@ gfc_conv_gfc_desc_to_cfi_desc (gfc_se *parmse, gfc_expr *e, gfc_symbol *fsym)
else
{
gfc_conv_expr (parmse, e);
+
+ if (POINTER_TYPE_P (TREE_TYPE (parmse->expr)))
+ parmse->expr = build_fold_indirect_ref_loc (input_location,
+ parmse->expr);
+
/* Copy the scalar for INTENT_IN. */
if (e->expr_type == EXPR_VARIABLE && fsym->attr.intent == INTENT_IN)
parmse->expr = gfc_evaluate_now (parmse->expr, &parmse->pre);
@@ -5875,7 +5884,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
array-descriptor actual to array-descriptor dummy, see
PR 41911 for why a check has to be inserted.
fsym == NULL is checked as intrinsics required the descriptor
- but do not always set fsym.
+ but do not always set fsym.
Also, it is necessary to pass a NULL pointer to library routines
which usually ignore optional arguments, so they can handle
these themselves. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 141cf60..d38a578 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-01-15 Paul Thomas <pault@gcc.gnu.org>
+
+ * gfortran.dg/ISO_Fortran_binding_2.c : Change reference to
+ ISO_Fortran_binding_2.h.
+
2019-01-15 Marek Polacek <polacek@redhat.com>
PR c++/88866
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c
index 3bf5c3d..d3eb9a4 100644
--- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c
+++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c
@@ -1,6 +1,6 @@
/* Test F2008 18.5: ISO_Fortran_binding.h functions. */
-#include <ISO_Fortran_binding.h>
+#include "../../../libgfortran/ISO_Fortran_binding.h"
#include <stdio.h>
#include <stdlib.h>
#include <complex.h>