public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pault at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/98408] Character lengths for allocatable character arrays
Date: Mon, 21 Dec 2020 10:33:51 +0000 [thread overview]
Message-ID: <bug-98408-4-2Qb1lfyiqP@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98408-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98408
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pault at gcc dot gnu.org
--- Comment #1 from Paul Thomas <pault at gcc dot gnu.org> ---
Hi Thomas,
>From gfc_conv_intrinsic_sizeof:
if (arg->ts.type == BT_CHARACTER)
byte_size = size_of_string_in_bytes (arg->ts.kind,
argse.string_length);
else
{
if (arg->rank == 0)
byte_size = TREE_TYPE (build_fold_indirect_ref_loc (input_location,
argse.expr));
else
byte_size = gfc_get_element_type (TREE_TYPE (argse.expr));
byte_size = fold_convert (gfc_array_index_type,
size_in_bytes (byte_size));
}
}
ie. characters are treated separately.
The problem is that gfc_get_element_type will come back with void* (or perhaps
void if TYPE_STRING_FLAG is not set) because of the cast in the allocation:
a.data = (void * restrict) __builtin_malloc (50);
which is what GFC_TYPE_ARRAY_DATAPTR_TYPE is coming back with.
I think that you will have to either interrogate the dtype for the element
length, use the span field or se->string_length if you know the kind.
Not so much a bug as a 'feature', I'm afraid.
Paul
next prev parent reply other threads:[~2020-12-21 10:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-21 8:35 [Bug fortran/98408] New: " tkoenig at gcc dot gnu.org
2020-12-21 10:33 ` pault at gcc dot gnu.org [this message]
2021-02-14 12:16 ` [Bug fortran/98408] " dominiq at lps dot ens.fr
2023-03-28 10:09 ` pault at gcc dot gnu.org
2023-04-08 8:04 ` cvs-commit at gcc dot gnu.org
2023-04-08 9:36 ` pault at gcc dot gnu.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-98408-4-2Qb1lfyiqP@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).