public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/102862] New: CLASS(*) – various issues, esp. with assumed-rank
@ 2021-10-20 19:42 burnus at gcc dot gnu.org
  2021-10-22 13:08 ` [Bug fortran/102862] " dominiq at lps dot ens.fr
  0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-10-20 19:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102862
           Summary: CLASS(*) – various issues, esp. with assumed-rank
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: diagnostic, rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

The following program runs into various issues with CLASS handling in general
and CLASS(*) handling in particular. It compiles when using 'integer' but with
'class(*)' it fails with:


assumed-rank-class.f90:19:13:

   19 |       rank(*)
      |             1
Error: Array pointer ‘__tmp_class___class__STAR_15_0t_rank_m1’ at (1) must have
a deferred shape or assumed rank
assumed-rank-class.f90:22:17:

   22 |          if (any(x(1:10) /= [(i, i=1,10)])) error stop
      |                 1
Error: Operands of comparison operator ‘/=’ at (1) are CLASS(*)/INTEGER(4)
assumed-rank-class.f90:5:14:

    5 |   call caller(A)
      |              1
Error: Rank mismatch in argument ‘y’ at (1) (rank-3 and rank-1)


all of which are bogus.



implicit none
  integer :: i
  integer :: A(10)
  A = [(i, i = 1, 10)]
  call caller(A)
contains
  subroutine caller(y)
    class(*) :: y(5,-3:6,*)
    !integer :: y(5,-3:6,*)
    call foo(y)
  end
  subroutine foo(x)
    class(*) :: x(..) 
    !integer :: x(..) 
    integer :: i
    print *, rank(x)
    print *, shape(x)
    select rank(x)
      rank(*)
         print *,rank(x)
         ! OK - assumed size actual
         if (any(x(1:10) /= [(i, i=1,10)])) error stop
      rank default
         error stop 1
    end select
  end subroutine
end

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

* [Bug fortran/102862] CLASS(*) – various issues, esp. with assumed-rank
  2021-10-20 19:42 [Bug fortran/102862] New: CLASS(*) – various issues, esp. with assumed-rank burnus at gcc dot gnu.org
@ 2021-10-22 13:08 ` dominiq at lps dot ens.fr
  0 siblings, 0 replies; 2+ messages in thread
From: dominiq at lps dot ens.fr @ 2021-10-22 13:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-10-22

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed from gfortan 10 up to master.

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

end of thread, other threads:[~2021-10-22 13:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-20 19:42 [Bug fortran/102862] New: CLASS(*) – various issues, esp. with assumed-rank burnus at gcc dot gnu.org
2021-10-22 13:08 ` [Bug fortran/102862] " dominiq at lps dot ens.fr

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