public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/57530] New: [OOP] Wrongly rejects  type_pointer => class_target (which have identical declared type)
@ 2013-06-04 19:06 burnus at gcc dot gnu.org
  2013-06-05 12:50 ` [Bug fortran/57530] " burnus at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-06-04 19:06 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57530

            Bug ID: 57530
           Summary: [OOP] Wrongly rejects  type_pointer => class_target
                    (which have identical declared type)
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: janus at gcc dot gnu.org

Found in the examples to http://www.cambridge.org/rouson (->
ssdSource/chapter05/hermetic). According to comments, the original program is
accepted by xlf2003 and nagf95.

The following simplified code is accepted by Crayftn, ifort and pgf95, but
rejected by gfortran with:

    ptr => tgt  ! TYPE => CLASS
    1
Error: Different types in pointer assignment at (1); attempted assignment of
CLASS(t) to TYPE(t)


>From F2008:

"C714 (R733) If data-target is not unlimited polymorphic, data-pointer-object
shall be type compatible (4.3.1.3) with it and the corresponding kind type
parameters shall be equal."

There (4.3.1.3): "A nonpolymorphic entity is type compatible only with entities
of the same declared type. A polymorphic entity that is not an unlimited
polymorphic entity is type compatible with entities of the same declared type
or any of its extensions."


In the example below, TYPE(t) and CLASS(t) have same declared type.


module m
  type t
  end type t
contains
  subroutine sub (tgt)
    class(t), target :: tgt
    type(t), pointer :: ptr
    ptr => tgt  ! TYPE => CLASS
  end subroutine sub
end module m


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

* [Bug fortran/57530] [OOP] Wrongly rejects  type_pointer => class_target (which have identical declared type)
  2013-06-04 19:06 [Bug fortran/57530] New: [OOP] Wrongly rejects type_pointer => class_target (which have identical declared type) burnus at gcc dot gnu.org
@ 2013-06-05 12:50 ` burnus at gcc dot gnu.org
  2013-06-05 14:31 ` burnus at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-06-05 12:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57530

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Patch: http://gcc.gnu.org/ml/fortran/2013-06/msg00045.html


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

* [Bug fortran/57530] [OOP] Wrongly rejects  type_pointer => class_target (which have identical declared type)
  2013-06-04 19:06 [Bug fortran/57530] New: [OOP] Wrongly rejects type_pointer => class_target (which have identical declared type) burnus at gcc dot gnu.org
  2013-06-05 12:50 ` [Bug fortran/57530] " burnus at gcc dot gnu.org
@ 2013-06-05 14:31 ` burnus at gcc dot gnu.org
  2013-06-05 17:59 ` burnus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-06-05 14:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57530

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #1)
> Patch: http://gcc.gnu.org/ml/fortran/2013-06/msg00045.html

Sigh, the patch isn't sufficient as the trans*.c code associate the TYPE with
the CLASS container - not its content. Test case below.

! { dg-do run }
!
! PR fortran/57530
!
module m
  implicit none
  type t
    integer :: ii = 55
  end type t
contains
  subroutine sub (tgt, tgt2)
    class(t), target :: tgt, tgt2(:)
    type(t), pointer :: ptr, ptr2(:)

    if (tgt%ii /= 43) call abort()
    if (size (tgt2) /= 3) call abort()
    if (any (tgt2(:)%ii /= [11,22,33])) call abort()

    ptr => tgt  ! TYPE => CLASS
    ptr2 => tgt2  ! TYPE => CLASS

    if (.not. associated(ptr)) call abort()
    if (.not. associated(ptr2)) call abort()
    if (.not. associated(ptr,tgt)) call abort()
    if (.not. associated(ptr2,tgt2)) call abort()
    if (ptr%ii /= 43) call abort()
    if (size (ptr2) /= 3) call abort()
    if (any (ptr2(:)%ii /= [11,22,33])) call abort()
  end subroutine sub
end module m

use m
type(t), target :: x
type(t), target :: y(3)
x%ii = 43
y(:)%ii = [11,22,33]
call sub(x,y)
end


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

* [Bug fortran/57530] [OOP] Wrongly rejects  type_pointer => class_target (which have identical declared type)
  2013-06-04 19:06 [Bug fortran/57530] New: [OOP] Wrongly rejects type_pointer => class_target (which have identical declared type) burnus at gcc dot gnu.org
  2013-06-05 12:50 ` [Bug fortran/57530] " burnus at gcc dot gnu.org
  2013-06-05 14:31 ` burnus at gcc dot gnu.org
@ 2013-06-05 17:59 ` burnus at gcc dot gnu.org
  2013-06-06 15:06 ` burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-06-05 17:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57530

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Created attachment 30262
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30262&action=edit
Draft patch - does not fully work, yet

Currently fails for
  x = func1()
in assign_11.f90


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

* [Bug fortran/57530] [OOP] Wrongly rejects  type_pointer => class_target (which have identical declared type)
  2013-06-04 19:06 [Bug fortran/57530] New: [OOP] Wrongly rejects type_pointer => class_target (which have identical declared type) burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-06-05 17:59 ` burnus at gcc dot gnu.org
@ 2013-06-06 15:06 ` burnus at gcc dot gnu.org
  2013-07-25 22:15 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-06-06 15:06 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57530

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #3)
The resolve patch has been approved (but not yet committed):
  http://gcc.gnu.org/ml/fortran/2013-06/msg00049.html

The trans*.c patch has still to be fixed and submitted. (Cf. comment 3)


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

* [Bug fortran/57530] [OOP] Wrongly rejects  type_pointer => class_target (which have identical declared type)
  2013-06-04 19:06 [Bug fortran/57530] New: [OOP] Wrongly rejects type_pointer => class_target (which have identical declared type) burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-06-06 15:06 ` burnus at gcc dot gnu.org
@ 2013-07-25 22:15 ` burnus at gcc dot gnu.org
  2013-07-30  7:21 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-07-25 22:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57530

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Resolution patch (approved but not yet committed):
   http://gcc.gnu.org/ml/fortran/2013-06/msg00049.html

trans*.c patch for  TYPE => CLASS (submitted):
   http://gcc.gnu.org/ml/fortran/2013-07/msg00086.html

Outstanding/TODO: trans*c patch for TYPE = CLASS, where CLASS is a scalar or
array variable, function or array constructor.


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

* [Bug fortran/57530] [OOP] Wrongly rejects  type_pointer => class_target (which have identical declared type)
  2013-06-04 19:06 [Bug fortran/57530] New: [OOP] Wrongly rejects type_pointer => class_target (which have identical declared type) burnus at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-07-25 22:15 ` burnus at gcc dot gnu.org
@ 2013-07-30  7:21 ` burnus at gcc dot gnu.org
  2013-07-30  7:24 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-07-30  7:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57530

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Author: burnus
Date: Tue Jul 30 07:20:43 2013
New Revision: 201329

URL: http://gcc.gnu.org/viewcvs?rev=201329&root=gcc&view=rev
Log:
2013-07-30  Tobias Burnus  <burnus@net-b.de>

        PR fortran/57530
        * symbol.c (gfc_type_compatible): A type is type compatible with
        a class if both have the same declared type.
        * interface.c (compare_type): Reject CLASS/TYPE even if they
        are type compatible.


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/interface.c
    trunk/gcc/fortran/symbol.c


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

* [Bug fortran/57530] [OOP] Wrongly rejects  type_pointer => class_target (which have identical declared type)
  2013-06-04 19:06 [Bug fortran/57530] New: [OOP] Wrongly rejects type_pointer => class_target (which have identical declared type) burnus at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2013-07-30  7:21 ` burnus at gcc dot gnu.org
@ 2013-07-30  7:24 ` burnus at gcc dot gnu.org
  2014-09-06 11:04 ` dominiq at lps dot ens.fr
  2015-10-10  9:05 ` dominiq at lps dot ens.fr
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-07-30  7:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57530

--- Comment #8 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The original test case (cf. comment 0) is now solved.

However, only "type => class" is handled. Still missing is "type = class",
where CLASS is a (coarray) scalar or (coarray) array variable, function or an
array constructor. See also comment 3.


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

* [Bug fortran/57530] [OOP] Wrongly rejects  type_pointer => class_target (which have identical declared type)
  2013-06-04 19:06 [Bug fortran/57530] New: [OOP] Wrongly rejects type_pointer => class_target (which have identical declared type) burnus at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2013-07-30  7:24 ` burnus at gcc dot gnu.org
@ 2014-09-06 11:04 ` dominiq at lps dot ens.fr
  2015-10-10  9:05 ` dominiq at lps dot ens.fr
  8 siblings, 0 replies; 10+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-09-06 11:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2014-09-06
     Ever confirmed|0                           |1

--- Comment #9 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
The codes in comments 0 and 2 compile with gfortran 4.9.1 and trunk (5.0).
Should not this PR resolved as FIXED and a new PR open for the remaining issue
in comment 8?


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

* [Bug fortran/57530] [OOP] Wrongly rejects  type_pointer => class_target (which have identical declared type)
  2013-06-04 19:06 [Bug fortran/57530] New: [OOP] Wrongly rejects type_pointer => class_target (which have identical declared type) burnus at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2014-09-06 11:04 ` dominiq at lps dot ens.fr
@ 2015-10-10  9:05 ` dominiq at lps dot ens.fr
  8 siblings, 0 replies; 10+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-10  9:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |FIXED

--- Comment #10 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> The codes in comments 0 and 2 compile with gfortran 4.9.1 and trunk (5.0).
> Should not this PR resolved as FIXED and a new PR open for the remaining
> issue in comment 8?

No feedback for over a year. Closing as FIXED. Please open new PR(s) with a
test case if there are remaining issue(s).


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

end of thread, other threads:[~2015-10-10  9:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-04 19:06 [Bug fortran/57530] New: [OOP] Wrongly rejects type_pointer => class_target (which have identical declared type) burnus at gcc dot gnu.org
2013-06-05 12:50 ` [Bug fortran/57530] " burnus at gcc dot gnu.org
2013-06-05 14:31 ` burnus at gcc dot gnu.org
2013-06-05 17:59 ` burnus at gcc dot gnu.org
2013-06-06 15:06 ` burnus at gcc dot gnu.org
2013-07-25 22:15 ` burnus at gcc dot gnu.org
2013-07-30  7:21 ` burnus at gcc dot gnu.org
2013-07-30  7:24 ` burnus at gcc dot gnu.org
2014-09-06 11:04 ` dominiq at lps dot ens.fr
2015-10-10  9:05 ` 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).