This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/69422] Unexpected result with allocatable character type component


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69422

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pault at gcc dot gnu.org

--- Comment #2 from Paul Thomas <pault at gcc dot gnu.org> ---
Hmmm! This works if the pointer attribute is changed to allocatable. As
reported, it generates:

  x.p->source = 0B;
  x.p->_source_length = 0;
  {
    struct t t.0;

    t.0.source = 0B;
    t.0._source_length = 0;
    *x.p = t.0;
  }
  {
    integer(kind=4) D.2324;

    D.2324 = x.p->_source_length;
    if (D.2324 != 0)
      {
        if ((unsigned long) D.2324 <= 11)
          {
            __builtin_memcpy ((void *) x.p->source, (void *) &"test
string"[1]{lb: 1 sz: 1}, (unsigned long) D.2324);
          }
        else
          {
            __builtin_memcpy ((void *) x.p->source, (void *) &"test
string"[1]{lb: 1 sz: 1}, 11);
            __builtin_memset ((void *) x.p->source + 11, 32, (unsigned long)
D.2324 + 18446744073709551605);
          }
      }
  }

so that D.2324 is zero and nothing is copied.

I'll take it, although this time it preceeds my input :-)

Thanks for the report

Paul

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]