public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: "Dominique d'Humi??res" <dominiq@lps.ens.fr>
Cc: fortran@gcc.gnu.org
Subject: Re: [RFC] Hack for PRs 43996,45081, 58027, 59910, and 60993
Date: Sat, 14 Nov 2015 22:04:00 -0000	[thread overview]
Message-ID: <20151114220430.GA80427@troutmask.apl.washington.edu> (raw)
In-Reply-To: <65FD2119-0F31-4B31-96F8-0DC84E5E698A@lps.ens.fr>

On Sat, Nov 14, 2015 at 10:21:15PM +0100, Dominique d'Humi??res wrote:
> Compiling PRs 43996,45081, 58027, 59910, and 60993 gives the ICE
> 
> internal compiler error: in gfc_conv_array_initializer, at
> fortran/trans-array.c:5703
> 
> Compiling these PRs with  '-fno-range-check -fmax-array-constructor=1000000' succeeds except PR45081 (note that the output for pr 60993 does not seem to be the one expected by the reporter).
> 
> I have played with the following patch which gives the error
> 
> Fatal Error: A problem with BOZ and/or PARAMETER occurred at (1), try to compile with -fnorange-check and/or to increase the allowed 65535 upper limit for the '-fmax-array-constructor??? option
> 
> Is there a (simple) way to distinguish between the cases compiling with -fnorange-check and those requiring an increase of the default value for -fmax-array-constructor?
> 
> Indeed I know that the problem should be fixed upstream, but would it be acceptable to apply this kind of patch meanwhile?
> 

I looked at this a bit.  The comment above gfc_conv_array_initializer is

/* Create an array constructor from an initialization expression.
   We assume the frontend already did any expansions and conversions.  */

If this is indeed an initialization expression, it should be reduced.
It seems that the insertion of __convert_i8_i4 occurs after any previous
reduction.  So, I purpose the following

% svn diff trans-array.c
Index: trans-array.c
===================================================================
--- trans-array.c       (revision 230371)
+++ trans-array.c       (working copy)
@@ -5600,6 +5603,12 @@ gfc_conv_array_initializer (tree type, g
       && expr->symtree->n.sym->value)
     expr = expr->symtree->n.sym->value;
 
+  /* expr should be an initialization expression.  For BOZ entities, a
+     conversion may have been inserted but not reduced.  Do that here.  */
+  if (expr->expr_type == EXPR_FUNCTION
+      && strncmp (expr->symtree->name, "__", 2) == 0)
+    gfc_reduce_init_expr (expr);
+
   switch (expr->expr_type)
     {
     case EXPR_CONSTANT:

With the

  integer, parameter :: isclass(1) = (/ z'ff800000' /)
  print *, isclass
  end

I get

laptop-kargl:kargl[254] gfc -c u1.f90
u1.f90:1:37:

 integer, parameter :: isclass(1) = (/ z'ff800000' /)
                                     1

Error: Arithmetic overflow converting INTEGER(8) to INTEGER(4) at (1). This check can be disabled with the option '-fno-range-check'
u1.f90:1:37:

 integer, parameter :: isclass(1) = (/ z'ff800000' /)
                                     1

Error: Arithmetic overflow converting INTEGER(8) to INTEGER(4) at (1). This check can be disabled with the option '-fno-range-check'
u1.f90:1:37:

 integer, parameter :: isclass(1) = (/ z'ff800000' /)
                                     1

Error: Arithmetic overflow converting INTEGER(8) to INTEGER(4) at (1). This check can be disabled with the option '-fno-range-check'
u1.f90:1:37:

 integer, parameter :: isclass(1) = (/ z'ff800000' /)
                                     1

Error: Arithmetic overflow converting INTEGER(8) to INTEGER(4) at (1). This check can be disabled with the option '-fno-range-check'

No, I don't know why I get 4 errors instead of 1.  So, I suspect 
we need to do the reduction earlier.

-- 
Steve

  reply	other threads:[~2015-11-14 22:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-14 21:21 Dominique d'Humières
2015-11-14 22:04 ` Steve Kargl [this message]
2015-11-16  0:32 ` Steve Kargl

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=20151114220430.GA80427@troutmask.apl.washington.edu \
    --to=sgk@troutmask.apl.washington.edu \
    --cc=dominiq@lps.ens.fr \
    --cc=fortran@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).