public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* Strangeness for allocatable character arrays
@ 2020-12-21  8:38 Thomas Koenig
  0 siblings, 0 replies; only message in thread
From: Thomas Koenig @ 2020-12-21  8:38 UTC (permalink / raw)
  To: fortran

Hi,

here's a strangeness I noticed when chasing down one
bug in the shared memory code.

Consider

program main
   character (len=:), allocatable :: a(:)
   allocate (character(len=10) :: a(5))
end program main

This yields (in the tree dump)

   D.3941 = (bitsizetype) (sizetype) NON_LVALUE_EXPR <.a> * 8;
   D.3942 = (sizetype) NON_LVALUE_EXPR <.a>;
   a.data = 0B;
   {
     integer(kind=4) overflow.0;
     logical(kind=4) not_prev_allocated.1;

     .a = 10;

And later, if you use

size_in_bytes (gfc_get_element_type (TREE_TYPE(se->expr)))

you get an undefined variable.

I didn't pursue this any further, but it sure looks as
if this could be the cause of some bugs that we may or may
not have in bugzilla yet.

I've created https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98408
for this.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-21  8:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21  8:38 Strangeness for allocatable character arrays Thomas Koenig

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).