From: Thomas Koenig <tkoenig@netcologne.de>
To: "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [patch, fortran, committed] Fix part 2 of PR 83224
Date: Fri, 01 Dec 2017 18:07:00 -0000 [thread overview]
Message-ID: <f46285ff-40f2-3ecb-afd1-6703f2e1e7eb@netcologne.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 437 bytes --]
Hello world,
I have committed the fix for the second part (and original
test case) of PR 83224 as obvious after regression-testing
as r255331.
Regards
Thomas
2017-12-01 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/83224
* frontend-passes.c (create_var): Also handle
character arrays, handling deferred lenghts.
2017-12-01 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/83224
* gfortran.dg/dependency_51.f90: New test.
[-- Attachment #2: p2.diff --]
[-- Type: text/x-patch, Size: 892 bytes --]
Index: frontend-passes.c
===================================================================
--- frontend-passes.c (Revision 255294)
+++ frontend-passes.c (Arbeitskopie)
@@ -767,7 +767,7 @@ create_var (gfc_expr * e, const char *vname)
}
deferred = 0;
- if (e->ts.type == BT_CHARACTER && e->rank == 0)
+ if (e->ts.type == BT_CHARACTER)
{
gfc_expr *length;
@@ -778,6 +778,8 @@ create_var (gfc_expr * e, const char *vname)
else
{
symbol->attr.allocatable = 1;
+ symbol->ts.u.cl->length = NULL;
+ symbol->ts.deferred = 1;
deferred = 1;
}
}
@@ -790,7 +792,7 @@ create_var (gfc_expr * e, const char *vname)
result = gfc_get_expr ();
result->expr_type = EXPR_VARIABLE;
- result->ts = e->ts;
+ result->ts = symbol->ts;
result->ts.deferred = deferred;
result->rank = e->rank;
result->shape = gfc_copy_shape (e->shape, e->rank);
[-- Attachment #3: dependency_51.f90 --]
[-- Type: text/x-fortran, Size: 393 bytes --]
! { dg-do run }
! PR 83224 - dependency mishandling with an array constructor
! Original test case by Urban Jost
program dusty_corner
implicit none
character(len=:),allocatable :: words(:)
integer :: n
words=[character(len=3) :: 'one', 'two']
n = 5
words=[character(len=n) :: words, 'three']
if (any(words /= [ "one ", "two ", "three"])) call abort
end program dusty_corner
reply other threads:[~2017-12-01 18:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=f46285ff-40f2-3ecb-afd1-6703f2e1e7eb@netcologne.de \
--to=tkoenig@netcologne.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@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).