public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/97694] New: ICE with optional assumed rank class(*) argument
@ 2020-11-03 11:36 mscfd at gmx dot net
  2020-11-03 11:40 ` [Bug fortran/97694] " mscfd at gmx dot net
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: mscfd at gmx dot net @ 2020-11-03 11:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97694
           Summary: ICE with optional assumed rank class(*) argument
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mscfd at gmx dot net
  Target Milestone: ---

Created attachment 49494
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49494&action=edit
Fortran source code

The attached code crashs with an ICE. It requires that the argument has type
class(*) and is optional.

classstar_rank.f90:14:0:

   14 |          s = '0'
      | 
internal compiler error: Segmentation fault
0xbe205f crash_signal
        ../../gcc-repo/gcc/toplev.c:328
0x793007 trans_associate_var
        ../../gcc-repo/gcc/fortran/trans-stmt.c:1765
0x798fe1 gfc_trans_block_construct(gfc_code*)
        ../../gcc-repo/gcc/fortran/trans-stmt.c:2283
0x724950 trans_code
        ../../gcc-repo/gcc/fortran/trans.c:1960
0x79a89f gfc_trans_select_rank_cases
        ../../gcc-repo/gcc/fortran/trans-stmt.c:3703
0x79a89f gfc_trans_select_rank(gfc_code*)
        ../../gcc-repo/gcc/fortran/trans-stmt.c:3758
0x724aa3 trans_code
        ../../gcc-repo/gcc/fortran/trans.c:1984
0x798f70 gfc_trans_block_construct(gfc_code*)
        ../../gcc-repo/gcc/fortran/trans-stmt.c:2276
0x724950 trans_code
        ../../gcc-repo/gcc/fortran/trans.c:1960
0x791065 gfc_trans_if_1
        ../../gcc-repo/gcc/fortran/trans-stmt.c:1448
0x798a8b gfc_trans_if(gfc_code*)
        ../../gcc-repo/gcc/fortran/trans-stmt.c:1480
0x724b23 trans_code
        ../../gcc-repo/gcc/fortran/trans.c:1952
0x74dd44 gfc_generate_function_code(gfc_namespace*)
        ../../gcc-repo/gcc/fortran/trans-decl.c:6835
0x728571 gfc_generate_module_code(gfc_namespace*)
        ../../gcc-repo/gcc/fortran/trans.c:2264
0x6ca905 translate_all_program_units
        ../../gcc-repo/gcc/fortran/parse.c:6293
0x6ca905 gfc_parse_file()
        ../../gcc-repo/gcc/fortran/parse.c:6545
0x721c4f gfc_be_parse_file
        ../../gcc-repo/gcc/fortran/f95-lang.c:210

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

* [Bug fortran/97694] ICE with optional assumed rank class(*) argument
  2020-11-03 11:36 [Bug fortran/97694] New: ICE with optional assumed rank class(*) argument mscfd at gmx dot net
@ 2020-11-03 11:40 ` mscfd at gmx dot net
  2020-11-04  9:37 ` marxin at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mscfd at gmx dot net @ 2020-11-03 11:40 UTC (permalink / raw)
  To: gcc-bugs

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

martin <mscfd at gmx dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=91926

--- Comment #1 from martin <mscfd at gmx dot net> ---
There are two resolved bug reports which are very similar, bug 61881 and bug
91926. At least bug 91926 is working fine. The other is pretty old and lacks
the optional attribute.

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

* [Bug fortran/97694] ICE with optional assumed rank class(*) argument
  2020-11-03 11:36 [Bug fortran/97694] New: ICE with optional assumed rank class(*) argument mscfd at gmx dot net
  2020-11-03 11:40 ` [Bug fortran/97694] " mscfd at gmx dot net
@ 2020-11-04  9:37 ` marxin at gcc dot gnu.org
  2020-12-11 13:40 ` pault at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-11-04  9:37 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kcy at codesourcery dot com,
                   |                            |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2020-11-04
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started to ICE with r10-3563-g73a28634098cb1ab.

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

* [Bug fortran/97694] ICE with optional assumed rank class(*) argument
  2020-11-03 11:36 [Bug fortran/97694] New: ICE with optional assumed rank class(*) argument mscfd at gmx dot net
  2020-11-03 11:40 ` [Bug fortran/97694] " mscfd at gmx dot net
  2020-11-04  9:37 ` marxin at gcc dot gnu.org
@ 2020-12-11 13:40 ` pault at gcc dot gnu.org
  2020-12-11 13:52 ` pault at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu.org @ 2020-12-11 13:40 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

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

--- Comment #3 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 49743
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49743&action=edit
Fix for this PR and PR97723

This regtests and fixes both PRs

Paul

select_rank_5.f90:

! { dg-do run }
!
! Test the fixes for PR97723 and PR97694.
!
! Contributed by Martin  <mscfd@gmx.net>
!
module mod
implicit none
private
public cssel

contains

function cssel(x) result(s)
   character(len=:), allocatable :: s
   class(*), dimension(..), optional, intent(in) :: x
   if (present(x)) then
      select rank (x)
      rank (0)
         s = '0' ! PR97723: ‘assign’ at (1) is not a function
                 ! PR97694: ICE in trans-stmt.c(trans_associate_var)
      rank (1)
         s = '1' ! PR97723: ‘assign’ at (1) is not a function
      rank default
         s = '?' ! PR97723: ‘assign’ at (1) is not a function
      end select
   else
      s = '-'
   end if
end function cssel

end module mod

program classstar_rank
use mod
implicit none

integer :: x
real, dimension(1:3) :: y
logical, dimension(1:2,1:2) :: z

if (any ([cssel(x),cssel(y),cssel(z),cssel()] .ne. ['0','1','?','-'])) stop 1

end program classstar_rank

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

* [Bug fortran/97694] ICE with optional assumed rank class(*) argument
  2020-11-03 11:36 [Bug fortran/97694] New: ICE with optional assumed rank class(*) argument mscfd at gmx dot net
                   ` (2 preceding siblings ...)
  2020-12-11 13:40 ` pault at gcc dot gnu.org
@ 2020-12-11 13:52 ` pault at gcc dot gnu.org
  2020-12-11 18:01 ` dominiq at lps dot ens.fr
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu.org @ 2020-12-11 13:52 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

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

--- Comment #4 from Paul Thomas <pault at gcc dot gnu.org> ---
I guess that it's mine :-)

Paul

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

* [Bug fortran/97694] ICE with optional assumed rank class(*) argument
  2020-11-03 11:36 [Bug fortran/97694] New: ICE with optional assumed rank class(*) argument mscfd at gmx dot net
                   ` (3 preceding siblings ...)
  2020-12-11 13:52 ` pault at gcc dot gnu.org
@ 2020-12-11 18:01 ` dominiq at lps dot ens.fr
  2020-12-14  7:07 ` mscfd at gmx dot net
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-12-11 18:01 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

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

* [Bug fortran/97694] ICE with optional assumed rank class(*) argument
  2020-11-03 11:36 [Bug fortran/97694] New: ICE with optional assumed rank class(*) argument mscfd at gmx dot net
                   ` (4 preceding siblings ...)
  2020-12-11 18:01 ` dominiq at lps dot ens.fr
@ 2020-12-14  7:07 ` mscfd at gmx dot net
  2020-12-17  9:18 ` mscfd at gmx dot net
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mscfd at gmx dot net @ 2020-12-14  7:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from martin <mscfd at gmx dot net> ---
Thanks a lot. The patch seems to work great. Tried it with the more complex
code from which the two failed tests were boiled down.

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

* [Bug fortran/97694] ICE with optional assumed rank class(*) argument
  2020-11-03 11:36 [Bug fortran/97694] New: ICE with optional assumed rank class(*) argument mscfd at gmx dot net
                   ` (5 preceding siblings ...)
  2020-12-14  7:07 ` mscfd at gmx dot net
@ 2020-12-17  9:18 ` mscfd at gmx dot net
  2020-12-27 14:59 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mscfd at gmx dot net @ 2020-12-17  9:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from martin <mscfd at gmx dot net> ---
There is still a somewhat related problem if a variable of a derived type with
allocatable component is provided to cssel. See bug 98342 with a simplified
example code (without class(*)).

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

* [Bug fortran/97694] ICE with optional assumed rank class(*) argument
  2020-11-03 11:36 [Bug fortran/97694] New: ICE with optional assumed rank class(*) argument mscfd at gmx dot net
                   ` (6 preceding siblings ...)
  2020-12-17  9:18 ` mscfd at gmx dot net
@ 2020-12-27 14:59 ` cvs-commit at gcc dot gnu.org
  2021-03-01  8:37 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-27 14:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Paul Thomas <pault@gcc.gnu.org>:

https://gcc.gnu.org/g:c4a678981572c12d158709ace0d3f23dd04cf217

commit r11-6346-gc4a678981572c12d158709ace0d3f23dd04cf217
Author: Paul Thomas <pault@gcc.gnu.org>
Date:   Sun Dec 27 14:59:38 2020 +0000

    Fortran: Fix some select rank issues [PR97694 and 97723].

    2020-12-27  Paul Thomas  <pault@gcc.gnu.org>

    gcc/fortran
            PR fortran/97694
            PR fortran/97723
            * check.c (allocatable_check): Select rank temporaries are
            permitted even though they are treated as associate variables.
            * resolve.c (gfc_resolve_code): Break on select rank as well as
            select type so that the block os resolved.
            * trans-stmt.c (trans_associate_var): Class associate variables
            that are optional dummies must use the backend_decl.

    gcc/testsuite/
            PR fortran/97694
            PR fortran/97723
            * gfortran.dg/select_rank_5.f90: New test.

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

* [Bug fortran/97694] ICE with optional assumed rank class(*) argument
  2020-11-03 11:36 [Bug fortran/97694] New: ICE with optional assumed rank class(*) argument mscfd at gmx dot net
                   ` (7 preceding siblings ...)
  2020-12-27 14:59 ` cvs-commit at gcc dot gnu.org
@ 2021-03-01  8:37 ` burnus at gcc dot gnu.org
  2021-09-10 20:16 ` cvs-commit at gcc dot gnu.org
  2021-09-10 20:23 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-03-01  8:37 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

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

--- Comment #8 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Paul – what's the state of this PR? I see a mainline/GCC 11 commit from end of
December. Is there more to do?

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

* [Bug fortran/97694] ICE with optional assumed rank class(*) argument
  2020-11-03 11:36 [Bug fortran/97694] New: ICE with optional assumed rank class(*) argument mscfd at gmx dot net
                   ` (8 preceding siblings ...)
  2021-03-01  8:37 ` burnus at gcc dot gnu.org
@ 2021-09-10 20:16 ` cvs-commit at gcc dot gnu.org
  2021-09-10 20:23 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-10 20:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:25d45b5dd41a9ab005a5ae8ee8e54be17f2467a2

commit r10-10109-g25d45b5dd41a9ab005a5ae8ee8e54be17f2467a2
Author: Paul Thomas <pault@gcc.gnu.org>
Date:   Sun Dec 27 14:59:38 2020 +0000

    Fortran: Fix some select rank issues [PR97694 and 97723].

    2020-12-27  Paul Thomas  <pault@gcc.gnu.org>

    gcc/fortran
            PR fortran/97694
            PR fortran/97723
            * check.c (allocatable_check): Select rank temporaries are
            permitted even though they are treated as associate variables.
            * resolve.c (gfc_resolve_code): Break on select rank as well as
            select type so that the block os resolved.
            * trans-stmt.c (trans_associate_var): Class associate variables
            that are optional dummies must use the backend_decl.

    gcc/testsuite/
            PR fortran/97694
            PR fortran/97723
            * gfortran.dg/select_rank_5.f90: New test.

    (cherry picked from commit c4a678981572c12d158709ace0d3f23dd04cf217)

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

* [Bug fortran/97694] ICE with optional assumed rank class(*) argument
  2020-11-03 11:36 [Bug fortran/97694] New: ICE with optional assumed rank class(*) argument mscfd at gmx dot net
                   ` (9 preceding siblings ...)
  2021-09-10 20:16 ` cvs-commit at gcc dot gnu.org
@ 2021-09-10 20:23 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-09-10 20:23 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #10 from anlauf at gcc dot gnu.org ---
Backported Paul's fix to 10-branch after verifying that it does the job.

The backport to 9-branch would require more work, thus not done.  Closing.

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

end of thread, other threads:[~2021-09-10 20:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-03 11:36 [Bug fortran/97694] New: ICE with optional assumed rank class(*) argument mscfd at gmx dot net
2020-11-03 11:40 ` [Bug fortran/97694] " mscfd at gmx dot net
2020-11-04  9:37 ` marxin at gcc dot gnu.org
2020-12-11 13:40 ` pault at gcc dot gnu.org
2020-12-11 13:52 ` pault at gcc dot gnu.org
2020-12-11 18:01 ` dominiq at lps dot ens.fr
2020-12-14  7:07 ` mscfd at gmx dot net
2020-12-17  9:18 ` mscfd at gmx dot net
2020-12-27 14:59 ` cvs-commit at gcc dot gnu.org
2021-03-01  8:37 ` burnus at gcc dot gnu.org
2021-09-10 20:16 ` cvs-commit at gcc dot gnu.org
2021-09-10 20:23 ` anlauf 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).