public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ibm/heads/gcc-9)] backport: re PR fortran/92775 (Incorrect expression in DW_AT_byte_stride on an array)
@ 2020-02-04 21:07 Peter Bergner
0 siblings, 0 replies; only message in thread
From: Peter Bergner @ 2020-02-04 21:07 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:bbd83540e017094a2d28af7bed278595833017a4
commit bbd83540e017094a2d28af7bed278595833017a4
Author: Jakub Jelinek <jakub@redhat.com>
Date: Fri Dec 20 18:36:48 2019 +0100
backport: re PR fortran/92775 (Incorrect expression in DW_AT_byte_stride on an array)
Backported from mainline
2019-12-06 Jakub Jelinek <jakub@redhat.com>
PR fortran/92775
* trans.h (struct lang_type, struct lang_decl): Remove span member.
(GFC_DECL_SPAN, GFC_TYPE_ARRAY_SPAN): Remove macros.
* trans-array.h (gfc_get_descriptor_offsets_for_info): Add another
argument.
* trans-array.c (gfc_get_descriptor_offsets_for_info): Add SPAN_OFF
argument and initialize *SPAN_OFF to the offset of span field.
* trans-types.c (gfc_get_array_descr_info): Adjust
gfc_get_descriptor_offsets_for_info caller. Compute elem_size
as base->span instead of TYPE_SIZE_UNIT (etype) constant.
From-SVN: r279668
Diff:
---
gcc/fortran/ChangeLog | 13 +++++++++++++
gcc/fortran/trans-array.c | 9 ++++++---
gcc/fortran/trans-array.h | 2 +-
gcc/fortran/trans-types.c | 11 ++++++-----
gcc/fortran/trans.h | 4 ----
5 files changed, 26 insertions(+), 13 deletions(-)
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 2ed0089..97c9fab 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,6 +1,19 @@
2019-12-20 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
+ 2019-12-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/92775
+ * trans.h (struct lang_type, struct lang_decl): Remove span member.
+ (GFC_DECL_SPAN, GFC_TYPE_ARRAY_SPAN): Remove macros.
+ * trans-array.h (gfc_get_descriptor_offsets_for_info): Add another
+ argument.
+ * trans-array.c (gfc_get_descriptor_offsets_for_info): Add SPAN_OFF
+ argument and initialize *SPAN_OFF to the offset of span field.
+ * trans-types.c (gfc_get_array_descr_info): Adjust
+ gfc_get_descriptor_offsets_for_info caller. Compute elem_size
+ as base->span instead of TYPE_SIZE_UNIT (etype) constant.
+
2019-12-05 Jakub Jelinek <jakub@redhat.com>
PR fortran/92781
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 3945d11..2e5eb4f 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -537,9 +537,10 @@ gfc_conv_shift_descriptor_lbound (stmtblock_t* block, tree desc,
void
gfc_get_descriptor_offsets_for_info (const_tree desc_type, tree *data_off,
- tree *dtype_off, tree *dim_off,
- tree *dim_size, tree *stride_suboff,
- tree *lower_suboff, tree *upper_suboff)
+ tree *dtype_off, tree *span_off,
+ tree *dim_off, tree *dim_size,
+ tree *stride_suboff, tree *lower_suboff,
+ tree *upper_suboff)
{
tree field;
tree type;
@@ -549,6 +550,8 @@ gfc_get_descriptor_offsets_for_info (const_tree desc_type, tree *data_off,
*data_off = byte_position (field);
field = gfc_advance_chain (TYPE_FIELDS (type), DTYPE_FIELD);
*dtype_off = byte_position (field);
+ field = gfc_advance_chain (TYPE_FIELDS (type), SPAN_FIELD);
+ *span_off = byte_position (field);
field = gfc_advance_chain (TYPE_FIELDS (type), DIMENSION_FIELD);
*dim_off = byte_position (field);
type = TREE_TYPE (TREE_TYPE (field));
diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h
index 8c2d518..aadb685 100644
--- a/gcc/fortran/trans-array.h
+++ b/gcc/fortran/trans-array.h
@@ -161,7 +161,7 @@ void gfc_trans_array_cobounds (tree, stmtblock_t *, const gfc_symbol *);
/* Build expressions for accessing components of an array descriptor. */
void gfc_get_descriptor_offsets_for_info (const_tree, tree *, tree *, tree *, tree *,
- tree *, tree *, tree *);
+ tree *, tree *, tree *, tree *);
tree gfc_conv_descriptor_data_get (tree);
tree gfc_conv_descriptor_data_addr (tree);
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 3c8188b..d0f1095 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -3323,7 +3323,7 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info)
int rank, dim;
bool indirect = false;
tree etype, ptype, t, base_decl;
- tree data_off, dim_off, dtype_off, dim_size, elem_size;
+ tree data_off, span_off, dim_off, dtype_off, dim_size, elem_size;
tree lower_suboff, upper_suboff, stride_suboff;
tree dtype, field, rank_off;
@@ -3380,12 +3380,13 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info)
if (indirect)
base_decl = build1 (INDIRECT_REF, ptype, base_decl);
- elem_size = fold_convert (gfc_array_index_type, TYPE_SIZE_UNIT (etype));
-
- gfc_get_descriptor_offsets_for_info (type, &data_off, &dtype_off, &dim_off,
- &dim_size, &stride_suboff,
+ gfc_get_descriptor_offsets_for_info (type, &data_off, &dtype_off, &span_off,
+ &dim_off, &dim_size, &stride_suboff,
&lower_suboff, &upper_suboff);
+ t = fold_build_pointer_plus (base_decl, span_off);
+ elem_size = build1 (INDIRECT_REF, gfc_array_index_type, t);
+
t = base_decl;
if (!integer_zerop (data_off))
t = fold_build_pointer_plus (t, data_off);
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index 6b42d82..f6af09f 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -963,7 +963,6 @@ struct GTY(()) lang_type {
tree offset;
tree dtype;
tree dataptr_type;
- tree span;
tree base_decl[2];
tree nonrestricted_type;
tree caf_token;
@@ -979,7 +978,6 @@ struct GTY(()) lang_decl {
address of target label. */
tree stringlen;
tree addr;
- tree span;
/* For assumed-shape coarrays. */
tree token, caf_offset;
unsigned int scalar_allocatable : 1;
@@ -989,7 +987,6 @@ struct GTY(()) lang_decl {
#define GFC_DECL_ASSIGN_ADDR(node) DECL_LANG_SPECIFIC(node)->addr
#define GFC_DECL_STRING_LEN(node) DECL_LANG_SPECIFIC(node)->stringlen
-#define GFC_DECL_SPAN(node) DECL_LANG_SPECIFIC(node)->span
#define GFC_DECL_TOKEN(node) DECL_LANG_SPECIFIC(node)->token
#define GFC_DECL_CAF_OFFSET(node) DECL_LANG_SPECIFIC(node)->caf_offset
#define GFC_DECL_SAVED_DESCRIPTOR(node) \
@@ -1038,7 +1035,6 @@ struct GTY(()) lang_decl {
#define GFC_TYPE_ARRAY_DTYPE(node) (TYPE_LANG_SPECIFIC(node)->dtype)
#define GFC_TYPE_ARRAY_DATAPTR_TYPE(node) \
(TYPE_LANG_SPECIFIC(node)->dataptr_type)
-#define GFC_TYPE_ARRAY_SPAN(node) (TYPE_LANG_SPECIFIC(node)->span)
#define GFC_TYPE_ARRAY_BASE_DECL(node, internal) \
(TYPE_LANG_SPECIFIC(node)->base_decl[(internal)])
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-02-04 21:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 21:07 [gcc(refs/vendors/ibm/heads/gcc-9)] backport: re PR fortran/92775 (Incorrect expression in DW_AT_byte_stride on an array) Peter Bergner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).