public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/67885] New: ICE on using parameter array in block
@ 2015-10-07 19:06 gerhard.steinmetz.fortran@t-online.de
  2015-10-07 19:08 ` [Bug fortran/67885] " gerhard.steinmetz.fortran@t-online.de
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-10-07 19:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67885
           Summary: ICE on using parameter array in block
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gerhard.steinmetz.fortran@t-online.de
  Target Milestone: ---

Using a parameter array in a block with an inner block :

$ cat z1.f90
program p
   block
      real, parameter :: a(2) = 1.0
      real :: x(2)
      x = a
      block
      end block
   end block
end


$ gfortran -g -O0 -Wall -fcheck=all -fno-frontend-optimize z1.f90
internal compiler error: in gfc_process_block_locals, at
fortran/trans-decl.c:6096

Same issue when using other intrinsic types, etc.

---

Compiles without parameter attribute :

$ cat z2.f90
program p
   block
      real :: a(2) = 1.0
      real :: x(2)
      x = a
      block
      end block
   end block
end


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

* [Bug fortran/67885] ICE on using parameter array in block
  2015-10-07 19:06 [Bug fortran/67885] New: ICE on using parameter array in block gerhard.steinmetz.fortran@t-online.de
@ 2015-10-07 19:08 ` gerhard.steinmetz.fortran@t-online.de
  2015-10-07 22:58 ` kargl at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-10-07 19:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
Deleting this inner block gives another error :

$ cat z5.f90
program p
   block
      real, parameter :: a(2) = 1.0
      real :: x(2)
      x = a
      print *, x
   end block
end


$ gfortran -g -O0 -Wall -fcheck=all -fno-frontend-optimize z5.f90
/tmp/cckgiZhq.o: In function `p':
/home/.../z5.f90:5: undefined reference to `a.3386'
collect2: error: ld returned 1 exit status


$ gfortran z5.f90
/tmp/ccwaNc8P.o: In function `MAIN__':
z5.f90:(.text+0xe): undefined reference to `a.3385'
collect2: error: ld returned 1 exit status


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

* [Bug fortran/67885] ICE on using parameter array in block
  2015-10-07 19:06 [Bug fortran/67885] New: ICE on using parameter array in block gerhard.steinmetz.fortran@t-online.de
  2015-10-07 19:08 ` [Bug fortran/67885] " gerhard.steinmetz.fortran@t-online.de
@ 2015-10-07 22:58 ` kargl at gcc dot gnu.org
  2015-10-12 16:34 ` gerhard.steinmetz.fortran@t-online.de
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-10-07 22:58 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

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

--- Comment #3 from kargl at gcc dot gnu.org ---
(In reply to Gerhard Steinmetz from comment #1)
> Deleting this inner block gives another error :
> 
> $ cat z5.f90
> program p
>    block
>       real, parameter :: a(2) = 1.0
>       real :: x(2)
>       x = a
>       print *, x
>    end block
> end
> 
> 
> $ gfortran -g -O0 -Wall -fcheck=all -fno-frontend-optimize z5.f90
> /tmp/cckgiZhq.o: In function `p':
> /home/.../z5.f90:5: undefined reference to `a.3386'
> collect2: error: ld returned 1 exit status
> 

The a(2) appears to be optimized out.  Don't know if the
code is legal because I haven't looked at standard, yet.
Changing your print statement to 

      if (x(1) /= 1.0) call abort

gives

% gfc6 -fdump-tree-original -c g5.f90
% cat g5.f90.003t.original
p ()
{
  {
    real(kind=4) x[2];

    (void) __builtin_memcpy ((void *) &x, (void *) &a, 8);
    if (x[0] != 1.0e+0)
      {
        _gfortran_abort ();
      }
    L.2:;
    L.1:;
  }
}


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

* [Bug fortran/67885] ICE on using parameter array in block
  2015-10-07 19:06 [Bug fortran/67885] New: ICE on using parameter array in block gerhard.steinmetz.fortran@t-online.de
  2015-10-07 19:08 ` [Bug fortran/67885] " gerhard.steinmetz.fortran@t-online.de
  2015-10-07 22:58 ` kargl at gcc dot gnu.org
@ 2015-10-12 16:34 ` gerhard.steinmetz.fortran@t-online.de
  2015-10-26 19:02 ` kargl at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-10-12 16:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
Deleting the dimension from parameter a (making it scalar)
lets examples z1.f90 and z5.f90 compile and run fine.


$ cat y1.f90
program p
   block
      real, parameter :: a = 1.0
      real :: x(2)
      x = a
      print *, x
      block
         print *, x
      end block
      print *, x
   end block
end

$ gfortran -g -O0 -Wall -fcheck=all -fno-frontend-optimize y1.f90
$ a.out
   1.00000000       1.00000000
   1.00000000       1.00000000
   1.00000000       1.00000000

---

$ cat y5.f90
program p
   block
      real, parameter :: a = 1.0
      real :: x(2)
      x = a
      print *, x
   end block
end

$ gfortran -g -O0 -Wall -fcheck=all -fno-frontend-optimize y5.f90
$ a.out
   1.00000000       1.00000000


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

* [Bug fortran/67885] ICE on using parameter array in block
  2015-10-07 19:06 [Bug fortran/67885] New: ICE on using parameter array in block gerhard.steinmetz.fortran@t-online.de
                   ` (2 preceding siblings ...)
  2015-10-12 16:34 ` gerhard.steinmetz.fortran@t-online.de
@ 2015-10-26 19:02 ` kargl at gcc dot gnu.org
  2015-10-29  9:47 ` dominiq at lps dot ens.fr
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-10-26 19:02 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |kargl at gcc dot gnu.org

--- Comment #5 from kargl at gcc dot gnu.org ---
I'm testing a patch now.


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

* [Bug fortran/67885] ICE on using parameter array in block
  2015-10-07 19:06 [Bug fortran/67885] New: ICE on using parameter array in block gerhard.steinmetz.fortran@t-online.de
                   ` (3 preceding siblings ...)
  2015-10-26 19:02 ` kargl at gcc dot gnu.org
@ 2015-10-29  9:47 ` dominiq at lps dot ens.fr
  2015-10-29 17:07 ` kargl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-29  9:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Patch submitted at https://gcc.gnu.org/ml/fortran/2015-10/msg00153.html and
approved at https://gcc.gnu.org/ml/fortran/2015-10/msg00154.html.


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

* [Bug fortran/67885] ICE on using parameter array in block
  2015-10-07 19:06 [Bug fortran/67885] New: ICE on using parameter array in block gerhard.steinmetz.fortran@t-online.de
                   ` (4 preceding siblings ...)
  2015-10-29  9:47 ` dominiq at lps dot ens.fr
@ 2015-10-29 17:07 ` kargl at gcc dot gnu.org
  2015-10-29 19:53 ` kargl at gcc dot gnu.org
  2015-10-29 19:54 ` kargl at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-10-29 17:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Thu Oct 29 17:06:58 2015
New Revision: 229540

URL: https://gcc.gnu.org/viewcvs?rev=229540&root=gcc&view=rev
Log:
2015-10-29  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/67885
        * trans-decl.c (generate_local_decl): Mark PARAMETER entities in
        BLOCK construct.

2015-10-26  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/67885
        * gfortran.dg/pr67885.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/pr67885.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/67885] ICE on using parameter array in block
  2015-10-07 19:06 [Bug fortran/67885] New: ICE on using parameter array in block gerhard.steinmetz.fortran@t-online.de
                   ` (5 preceding siblings ...)
  2015-10-29 17:07 ` kargl at gcc dot gnu.org
@ 2015-10-29 19:53 ` kargl at gcc dot gnu.org
  2015-10-29 19:54 ` kargl at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-10-29 19:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Thu Oct 29 19:52:56 2015
New Revision: 229554

URL: https://gcc.gnu.org/viewcvs?rev=229554&root=gcc&view=rev
Log:
2015-10-29  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/67885
        * trans-decl.c (generate_local_decl): Mark PARAMETER entities in
        BLOCK construct.

2015-10-29  Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/67885
        * gfortran.dg/pr67885.f90: New test.

Added:
    branches/gcc-5-branch/gcc/testsuite/gfortran.dg/pr67885.f90
Modified:
    branches/gcc-5-branch/gcc/fortran/ChangeLog
    branches/gcc-5-branch/gcc/fortran/trans-decl.c
    branches/gcc-5-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/67885] ICE on using parameter array in block
  2015-10-07 19:06 [Bug fortran/67885] New: ICE on using parameter array in block gerhard.steinmetz.fortran@t-online.de
                   ` (6 preceding siblings ...)
  2015-10-29 19:53 ` kargl at gcc dot gnu.org
@ 2015-10-29 19:54 ` kargl at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-10-29 19:54 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |5.3

--- Comment #9 from kargl at gcc dot gnu.org ---
Fixed on trunk and 5-branch.  Thanks for the bug report.


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

end of thread, other threads:[~2015-10-29 19:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-07 19:06 [Bug fortran/67885] New: ICE on using parameter array in block gerhard.steinmetz.fortran@t-online.de
2015-10-07 19:08 ` [Bug fortran/67885] " gerhard.steinmetz.fortran@t-online.de
2015-10-07 22:58 ` kargl at gcc dot gnu.org
2015-10-12 16:34 ` gerhard.steinmetz.fortran@t-online.de
2015-10-26 19:02 ` kargl at gcc dot gnu.org
2015-10-29  9:47 ` dominiq at lps dot ens.fr
2015-10-29 17:07 ` kargl at gcc dot gnu.org
2015-10-29 19:53 ` kargl at gcc dot gnu.org
2015-10-29 19:54 ` kargl 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).