public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: "Thomas König" <tk@tkoenig.net>
Cc: fortran@gcc.gnu.org
Subject: Re: Odd bug from Stack Overflow
Date: Sun, 18 Mar 2018 17:19:00 -0000	[thread overview]
Message-ID: <20180318171913.GA61043@troutmask.apl.washington.edu> (raw)
In-Reply-To: <5b6dfedc-425f-6e60-7ef1-4dee23eb2b27@tkoenig.net>

On Sun, Mar 18, 2018 at 06:12:23PM +0100, Thomas König wrote:
> Hi Steve,
> 
> This looks like a missing conversion somewhere,
> because this works:
> 
> program test
>     implicit none
>     integer, parameter :: n = 65536
>     real, dimension(n) :: y
>     integer :: i
>     y = (/ (1.0, i=1, n) /)
>     print *,y(2)
>     if (y(2) /= 1) stop 1
> end program test
> 
> Also, n=65536 is a limit... setting n=2**16-1 actually
> works as expected with the orginal test case.

Yes, n=2**16-1 works because gfortran switches over from
expanding the array constructor into a static temporary
variable to scalarizing the implied-do-loop at 2**16.  It
is a trade-off we made a long time ago for

integer, parameter :: i(somebignumber) = [(i,i=1,somebignumer)]

See -fmax-array-constructor= option.

> This looks like a resolution problem, not something
> in the scalarizer. Can you open a PR?

Yes.

-- 
Steve

      reply	other threads:[~2018-03-18 17:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-18 15:40 Steve Kargl
2018-03-18 16:03 ` Steve Kargl
2018-03-18 17:12 ` Thomas König
2018-03-18 17:19   ` Steve Kargl [this message]

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=20180318171913.GA61043@troutmask.apl.washington.edu \
    --to=sgk@troutmask.apl.washington.edu \
    --cc=fortran@gcc.gnu.org \
    --cc=tk@tkoenig.net \
    /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).