This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/60718] Test case gfortran.dg/select_type_4.f90 fails on ARM
- From: "bernd.edlinger at hotmail dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 07 Apr 2014 12:36:48 +0000
- Subject: [Bug fortran/60718] Test case gfortran.dg/select_type_4.f90 fails on ARM
- Auto-submitted: auto-generated
- References: <bug-60718-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60718
--- Comment #11 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to Bernd Edlinger from comment #6)
> hmm,
>
> gfc_build_class_symbol creates different types,
> if a class has the allocatable, target or pointer attribute.
>
> get_unique_hashed_string (tname, ts->u.derived);
> if ((*as) && attr->allocatable)
> sprintf (name, "__class_%s_%d_%da", tname, rank, (*as)->corank);
> else if ((*as) && attr->pointer)
> sprintf (name, "__class_%s_%d_%dp", tname, rank, (*as)->corank);
> else if ((*as))
> sprintf (name, "__class_%s_%d_%d", tname, rank, (*as)->corank);
> else if (attr->pointer)
> sprintf (name, "__class_%s_p", tname);
> else if (attr->allocatable)
> sprintf (name, "__class_%s_a", tname);
> else
> sprintf (name, "__class_%s", tname);
>
>
One other thing, should be noted:
the above code causes name clashes, if the class name ends with "_p"
as demonstrated in the following test example:
cat unique_name.f90
! { dg-do run }
!
module test_module
implicit none
type, public :: test_p
private
class(test_p), pointer :: next => null()
end type test_p
type, public :: test
! call do_it (x)
! Error: Type mismatch in argument 'x' at (1); passed CLASS(test_p) to
CLASS(test)
class(test), pointer :: next => null()
end type test
contains
subroutine do_it (x)
class(test_p), target :: x
x%next => x
return
end subroutine do_it
end module test_module
use test_module
class(test_p), pointer :: x
allocate (x)
call do_it (x)
deallocate (x)
end