diff options
author | Jean Perier <jperier@hsw1.pgi.net> | 2018-11-19 07:50:30 -0800 |
---|---|---|
committer | Jean Perier <jperier@hsw1.pgi.net> | 2018-11-19 07:50:30 -0800 |
commit | 218a5aa56a28443e7fba7dd50046fb29b5ed389e (patch) | |
tree | 69d81205688481ab635c20fe43a093f21c0cce34 /flang/runtime | |
parent | 056234106374c5e38bbdc92479bebcf011316392 (diff) | |
download | llvm-218a5aa56a28443e7fba7dd50046fb29b5ed389e.tar.gz |
[flang] Set lower bounds to 0 in CFI_establish, CFI_select_part and CFI_setpointer
Original-commit: flang-compiler/f18@65c67347d9530cce293f1f90089fb4e8186ccabc
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
Diffstat (limited to 'flang/runtime')
-rw-r--r-- | flang/runtime/ISO_Fortran_binding.cc | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/flang/runtime/ISO_Fortran_binding.cc b/flang/runtime/ISO_Fortran_binding.cc index 5531fad75907..526a75d340f0 100644 --- a/flang/runtime/ISO_Fortran_binding.cc +++ b/flang/runtime/ISO_Fortran_binding.cc @@ -179,12 +179,6 @@ int CFI_establish(CFI_cdesc_t *descriptor, void *base_addr, descriptor->dim[j].sm = byteSize; byteSize *= extents[j]; } - } else { - for (std::size_t j{0}; j < rank; ++j) { - descriptor->dim[j].lower_bound = lower_bound; - descriptor->dim[j].extent = 0; - descriptor->dim[j].sm = 0; - } } return CFI_SUCCESS; } @@ -265,6 +259,7 @@ int CFI_section(CFI_cdesc_t *result, const CFI_cdesc_t *source, resRank = 0; for (int j{0}; j < source->rank; ++j) { if (actualStride[j] != 0) { + result->dim[resRank].lower_bound = 0; result->dim[resRank].extent = extent[j]; result->dim[resRank].sm = actualStride[j] * source->dim[j].sm; ++resRank; @@ -291,9 +286,6 @@ int CFI_select_part(CFI_cdesc_t *result, const CFI_cdesc_t *source, if (result->type != CFI_type_char) { elem_len = result->elem_len; } - if (elem_len == 0) { - return CFI_INVALID_ELEM_LEN; // TODO: is it wrong to forbid this? - } if (displacement + elem_len > source->elem_len) { return CFI_INVALID_ELEM_LEN; } @@ -302,7 +294,9 @@ int CFI_select_part(CFI_cdesc_t *result, const CFI_cdesc_t *source, displacement + reinterpret_cast<char *>(source->base_addr)); result->elem_len = elem_len; for (int j{0}; j < source->rank; ++j) { - result->dim[j] = source->dim[j]; + result->dim[j].lower_bound = 0; + result->dim[j].extent = source->dim[j].extent; + result->dim[j].sm = source->dim[j].sm; } return CFI_SUCCESS; } |