This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/69422] Unexpected result with allocatable character type component
- From: "pault at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 22 Jan 2016 18:27:21 +0000
- Subject: [Bug fortran/69422] Unexpected result with allocatable character type component
- Auto-submitted: auto-generated
- References: <bug-69422-4 at http dot gcc dot gnu dot org/bugzilla/>
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