From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: Dominique Dhumieres <dominiq@lps.ens.fr>
Cc: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org
Subject: Re: [PATCH] fortran/65429 -- don't dereference a null pointer
Date: Sun, 29 Mar 2015 16:25:00 -0000 [thread overview]
Message-ID: <20150329162546.GA95666@troutmask.apl.washington.edu> (raw)
In-Reply-To: <20150328000157.70A50105@mailhost.lps.ens.fr>
On Sat, Mar 28, 2015 at 01:01:57AM +0100, Dominique Dhumieres wrote:
>
> AFAICT your test succeeds without your patch and does not test that the ICE
> reported by FX is gone (indeed it is with your patch).
>
New patch and testcase. The ChangeLog entries are in the
original email. Built and tested on x86_64-*-freebsd.
OK, now?
--
Steve
Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c (revision 220943)
+++ gcc/fortran/decl.c (working copy)
@@ -1404,9 +1404,7 @@ add_init_expr_to_sym (const char *name,
}
else if (init->expr_type == EXPR_ARRAY)
{
- gfc_constructor *c;
- c = gfc_constructor_first (init->value.constructor);
- clen = c->expr->value.character.length;
+ clen = mpz_get_si (init->ts.u.cl->length->value.integer);
sym->ts.u.cl->length
= gfc_get_int_expr (gfc_default_integer_kind,
NULL, clen);
Index: gcc/testsuite/gfortran.dg/pr65429.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr65429.f90 (revision 0)
+++ gcc/testsuite/gfortran.dg/pr65429.f90 (working copy)
@@ -0,0 +1,19 @@
+! { dg-do run }
+! PR fortran/65429
+program foo
+
+ implicit none
+
+ character(*), parameter :: s(*) = [ character(5) :: 'abcde', 'fghij' ]
+ character(*), parameter :: t(*) = [ character(31) :: ]
+ character(*), parameter :: u(*) = [ 'qwerty', 'asdfgh', 'zxcvbn']
+ character(*), parameter :: v(*) = ['','']
+
+ if ((size(s) /= 2).or.(len(s)/=5)) call abort
+ if ((size(t) /= 0).or.(len(t)/=31)) call abort
+ if ((size(u) /= 3).or.(len(u)/=6)) call abort
+ if ((size(v) /= 2).or.(len(v)/=0)) call abort
+ if ((s(1)/='abcde').or.(s(2)/='fghij')) call abort
+ if ((u(1)/='qwerty').or.(u(2)/='asdfgh').or.(u(3)/='zxcvbn')) call abort
+
+end program foo
next prev parent reply other threads:[~2015-03-29 16:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-28 0:02 Dominique Dhumieres
2015-03-28 0:33 ` Steve Kargl
2015-03-28 11:42 ` Dominique d'Humières
2015-03-28 14:50 ` Steve Kargl
2015-03-28 15:17 ` Dominique d'Humières
2015-03-29 16:25 ` Steve Kargl [this message]
2015-03-31 17:17 ` Jerry DeLisle
2015-04-07 19:59 ` Steve Kargl
2015-04-22 23:18 ` Steve Kargl
-- strict thread matches above, loose matches on Subject: below --
2015-03-27 22:47 Steve Kargl
2015-03-27 23:50 ` Tobias Burnus
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=20150329162546.GA95666@troutmask.apl.washington.edu \
--to=sgk@troutmask.apl.washington.edu \
--cc=dominiq@lps.ens.fr \
--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).