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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-07-27
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #5 from kargl at gcc dot gnu.org ---
(In reply to Kirill Chilikin from comment #3)
> I tested the reduced test case. It also compiles successfully with version
> 10.2.0, while it should not. With 8.3.0, an error is reported:
> 
> $ /usr/bin/gfortran -c -o test.o test2.f90
> test2.f90:14:9:
> 
>           a = t%r1%get(i)
>          1
> Error: Unclassifiable statement at (1)

Whoops.  I misread which version compiled the code and which one
issued the error.  This is, indeed a bug, a very strange bug!

For this code,

module m2

   implicit none

   type t2
      integer r1
   end type

   contains

      subroutine s(t, a)
         type(t2), intent(in) :: t
         integer, intent(out) :: a
         integer i
         i = t%r1
         a = t%r1%foo(i)
      end subroutine

end module

if I change t%r1%foo(i) to either t%r1(i) or t%r1%foo%bar(i), gfortran
will generate the unclassifiable statement error.  Compiling the code
with -fdump-tree-original reveals


s (struct t2 & restrict t, integer(kind=4) & restrict a)
{
  integer(kind=4) i;

  i = t->r1;
  *a = i;
}

i = t->r1 is correctly referencing the component of t.
*a = i is as-if t->r1->foo is an identity operator i

Reply via email to