public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/66113] New: Variable n cannot appear in the expression with nested blocks
@ 2015-05-11 19:28 tkoenig at gcc dot gnu.org
  2015-05-11 20:01 ` [Bug fortran/66113] " dominiq at lps dot ens.fr
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-05-11 19:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66113

            Bug ID: 66113
           Summary: Variable n cannot appear in the expression with nested
                    blocks
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkoenig at gcc dot gnu.org
  Target Milestone: ---

ig25@linux-fd1f:~/Krempel/Block> cat block.f90
program main
  integer :: n
  n = 3
  block
    block
      block
        real, dimension(n) :: a
      end block
    end block
  end block
end program main

ig25@linux-fd1f:~/Krempel/Block> gfortran block.f90
block.f90:7:24:

         real, dimension(n) :: a
                        1
Error: Variable »n« cannot appear in the expression at (1)

This is bogus.

Any solution should include the case of an arbitrary number
of nested blocks.
>From gcc-bugs-return-486030-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon May 11 19:45:20 2015
Return-Path: <gcc-bugs-return-486030-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 988 invoked by alias); 11 May 2015 19:45:20 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 940 invoked by uid 48); 11 May 2015 19:45:16 -0000
From: "jens.gustedt at inria dot fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/65471] type interpretation in _Generic
Date: Mon, 11 May 2015 19:45:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jens.gustedt at inria dot fr
X-Bugzilla-Status: SUSPENDED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-65471-4-a40JtnT35e@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65471-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65471-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-05/txt/msg00870.txt.bz2
Content-length: 307

https://gcc.gnu.org/bugzilla/show_bug.cgi?ide471

--- Comment #2 from Jens Gustedt <jens.gustedt at inria dot fr> ---
For referece, I have now a paper at the ISO committee:

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1930.htm

we will look at it in the automn session to decide what to do with it.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/66113] Variable n cannot appear in the expression with nested blocks
  2015-05-11 19:28 [Bug fortran/66113] New: Variable n cannot appear in the expression with nested blocks tkoenig at gcc dot gnu.org
@ 2015-05-11 20:01 ` dominiq at lps dot ens.fr
  2015-05-11 20:34 ` tkoenig at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-05-11 20:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66113

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Is not the code invalid?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/66113] Variable n cannot appear in the expression with nested blocks
  2015-05-11 19:28 [Bug fortran/66113] New: Variable n cannot appear in the expression with nested blocks tkoenig at gcc dot gnu.org
  2015-05-11 20:01 ` [Bug fortran/66113] " dominiq at lps dot ens.fr
@ 2015-05-11 20:34 ` tkoenig at gcc dot gnu.org
  2015-05-11 20:56 ` mikael at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-05-11 20:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66113

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #1)
> Is not the code invalid?

I don't think it is invalid.

This works as expected:

program main
  integer :: n
  n = 3
    block
      block
        real, dimension(n) :: a
      end block
    end block
end program main


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/66113] Variable n cannot appear in the expression with nested blocks
  2015-05-11 19:28 [Bug fortran/66113] New: Variable n cannot appear in the expression with nested blocks tkoenig at gcc dot gnu.org
  2015-05-11 20:01 ` [Bug fortran/66113] " dominiq at lps dot ens.fr
  2015-05-11 20:34 ` tkoenig at gcc dot gnu.org
@ 2015-05-11 20:56 ` mikael at gcc dot gnu.org
  2015-05-12  6:52 ` tkoenig at gcc dot gnu.org
  2015-05-16 12:35 ` tkoenig at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mikael at gcc dot gnu.org @ 2015-05-11 20:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66113

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #3 from Mikael Morin <mikael at gcc dot gnu.org> ---
Some people write strange code. ;-)
This is related to the inline matmul patch isn't it?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/66113] Variable n cannot appear in the expression with nested blocks
  2015-05-11 19:28 [Bug fortran/66113] New: Variable n cannot appear in the expression with nested blocks tkoenig at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-05-11 20:56 ` mikael at gcc dot gnu.org
@ 2015-05-12  6:52 ` tkoenig at gcc dot gnu.org
  2015-05-16 12:35 ` tkoenig at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-05-12  6:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66113

--- Comment #4 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
The reason is that I want to make creation of temporary
variables for arrays more sane.

Currently, temporary arrays are handled using an allocatable array
variable. This obviously does not work if -fno-realloc-lhs is
specified, and introduces unneeded complexity in the generated
code, which is hard for the middle-end optimizers to remove.

What I want to do is, if I want to create a temporary variable for
an array, is to change

   real, dimension(something,other) :: a

   a(f(x),1:3)

into

   block
     freeze = f(x)
     size_1 = 1;
     size_2 = 3;
       block
          real, dimension(size_1, size_2) :: a_tmp
          a_tmp(:,;) = a(freeze, 1:3)
          ...
       end block
   end block

While this might work in the most simple cases, I don't want
to introduce instability by hitting a bug with too many nesting
levels.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/66113] Variable n cannot appear in the expression with nested blocks
  2015-05-11 19:28 [Bug fortran/66113] New: Variable n cannot appear in the expression with nested blocks tkoenig at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-05-12  6:52 ` tkoenig at gcc dot gnu.org
@ 2015-05-16 12:35 ` tkoenig at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2015-05-16 12:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66113

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Fixed on trunk, closing.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-05-16 12:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-11 19:28 [Bug fortran/66113] New: Variable n cannot appear in the expression with nested blocks tkoenig at gcc dot gnu.org
2015-05-11 20:01 ` [Bug fortran/66113] " dominiq at lps dot ens.fr
2015-05-11 20:34 ` tkoenig at gcc dot gnu.org
2015-05-11 20:56 ` mikael at gcc dot gnu.org
2015-05-12  6:52 ` tkoenig at gcc dot gnu.org
2015-05-16 12:35 ` tkoenig at gcc dot gnu.org

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).