public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/48887] New: [OOP] SELECT TYPE:  Associate name shall not be a pointer/allocatable
@ 2011-05-05 13:11 burnus at gcc dot gnu.org
  2011-05-06 17:28 ` [Bug fortran/48887] " domob at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-05-05 13:11 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [OOP] SELECT TYPE:  Associate name shall not be a
                    pointer/allocatable
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: janus@gcc.gnu.org, domob@gcc.gnu.org


>From F2008, 16.5.1.6 Construct association:

"If the selector is allocatable, it shall be allocated; the associate name is
associated with the data object and does not have the ALLOCATABLE attribute.

"If the selector has the POINTER attribute, it shall be associated; the
associate name is associated with the target of the pointer and does not have
the POINTER attribute."


However, gfortran accepts the following, ifort and NAG don't.

It works if the associate name is explicitly given using "associate-name =>
selector"; however, it does not change the POINTER/ALLOCATABLE issue as: "The
associate name of a SELECT TYPE construct is the associate-name if specified;
otherwise it is the name that constitutes the selector."


type t
end type t
class(t), allocatable :: alloc
class(t), pointer     :: ptr

select type(alloc)
type is (t)
  allocate(alloc) ! INVALID: "alloc" is not allocatable
end select

select type(ptr)
type is (t)
  nullify(ptr) ! INVALID: "ptr" is not a pointer
end select

end

For an longer example, see 
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/88b65a2c9024e95f


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

* [Bug fortran/48887] [OOP] SELECT TYPE:  Associate name shall not be a pointer/allocatable
  2011-05-05 13:11 [Bug fortran/48887] New: [OOP] SELECT TYPE: Associate name shall not be a pointer/allocatable burnus at gcc dot gnu.org
@ 2011-05-06 17:28 ` domob at gcc dot gnu.org
  2011-05-27 11:04 ` domob at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: domob at gcc dot gnu.org @ 2011-05-06 17:28 UTC (permalink / raw)
  To: gcc-bugs

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

Daniel Kraft <domob at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot       |domob at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #1 from Daniel Kraft <domob at gcc dot gnu.org> 2011-05-06 17:10:47 UTC ---
Taking this.


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

* [Bug fortran/48887] [OOP] SELECT TYPE:  Associate name shall not be a pointer/allocatable
  2011-05-05 13:11 [Bug fortran/48887] New: [OOP] SELECT TYPE: Associate name shall not be a pointer/allocatable burnus at gcc dot gnu.org
  2011-05-06 17:28 ` [Bug fortran/48887] " domob at gcc dot gnu.org
@ 2011-05-27 11:04 ` domob at gcc dot gnu.org
  2011-06-16 14:33 ` janus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: domob at gcc dot gnu.org @ 2011-05-27 11:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Daniel Kraft <domob at gcc dot gnu.org> 2011-05-27 10:59:01 UTC ---
In match.c:select_type_set_tmp we have around line 4536:

  if (select_type_stack->selector->ts.type == BT_CLASS &&
      CLASS_DATA (select_type_stack->selector)->attr.allocatable)
    gfc_add_allocatable (&tmp->n.sym->attr, NULL);
  else
    gfc_add_pointer (&tmp->n.sym->attr, NULL);

Simply removing those gives ICEs in some SELECT TYPE test cases.

In resolve.c:resolve_select_type around line 7937 (the resolve_assoc_var call),
st->n.sym shows the respective attributes which lead to the problem later on.

Note that it we simply use ASSOCIATE, the attributes are not set (as is
expected and should be).


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

* [Bug fortran/48887] [OOP] SELECT TYPE:  Associate name shall not be a pointer/allocatable
  2011-05-05 13:11 [Bug fortran/48887] New: [OOP] SELECT TYPE: Associate name shall not be a pointer/allocatable burnus at gcc dot gnu.org
  2011-05-06 17:28 ` [Bug fortran/48887] " domob at gcc dot gnu.org
  2011-05-27 11:04 ` domob at gcc dot gnu.org
@ 2011-06-16 14:33 ` janus at gcc dot gnu.org
  2011-12-02 16:22 ` [Bug fortran/48887] [4.7 Regression][OOP] " burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2011-06-16 14:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from janus at gcc dot gnu.org 2011-06-16 14:32:38 UTC ---
Note: Apparenty "select_type_23.f03" in the testsuite is invalid due to this PR
(cf. PR 48699).


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

* [Bug fortran/48887] [4.7 Regression][OOP] SELECT TYPE:  Associate name shall not be a pointer/allocatable
  2011-05-05 13:11 [Bug fortran/48887] New: [OOP] SELECT TYPE: Associate name shall not be a pointer/allocatable burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-06-16 14:33 ` janus at gcc dot gnu.org
@ 2011-12-02 16:22 ` burnus at gcc dot gnu.org
  2011-12-03 18:32 ` burnus at gcc dot gnu.org
  2011-12-03 18:35 ` burnus at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-12-02 16:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.7.0
            Summary|[OOP] SELECT TYPE:          |[4.7 Regression][OOP]
                   |Associate name shall not be |SELECT TYPE:  Associate
                   |a pointer/allocatable       |name shall not be a
                   |                            |pointer/allocatable

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-02 16:21:50 UTC ---
At least for the following test case there is a regression. While the "must be
ALLOCATABLE" is printed correctly three times with GCC 4.6, with GCC 4.7 I only
get the error for ASSOCIATE (as expected, cf. comment 2) and not for SELECT
TYPE.

type t
end type t
class(t), allocatable :: x

! Expected: An error, but none is printed:
select type(x)
  type is(t)
    print *, allocated (x) ! { dg-error "must be ALLOCATABLE" }
end select

! Expected: An error, but none is printed:
select type(y=>x)
  type is(t)
    print *, allocated (y)  ! { dg-error "must be ALLOCATABLE" }
end select

! Here, the error is printed:
associate (y=>x)
  print *, allocated (y)  ! { dg-error "must be ALLOCATABLE" }
end associate
end


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

* [Bug fortran/48887] [4.7 Regression][OOP] SELECT TYPE:  Associate name shall not be a pointer/allocatable
  2011-05-05 13:11 [Bug fortran/48887] New: [OOP] SELECT TYPE: Associate name shall not be a pointer/allocatable burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-12-02 16:22 ` [Bug fortran/48887] [4.7 Regression][OOP] " burnus at gcc dot gnu.org
@ 2011-12-03 18:32 ` burnus at gcc dot gnu.org
  2011-12-03 18:35 ` burnus at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-12-03 18:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-03 18:30:40 UTC ---
Author: burnus
Date: Sat Dec  3 18:30:36 2011
New Revision: 181975

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181975
Log:
2011-12-03  Tobias Burnus  <burnus@net-b.de>

        PR fortran/48887
        * match.c (select_type_set_tmp): Don't set allocatable/pointer
        attribute.
        * class.c (gfc_build_class_symbol): Handle
        attr.select_type_temporary.

2011-12-03  Tobias Burnus  <burnus@net-b.de>

        PR fortran/48887
        * gfortran.dg/select_type_24.f90: New.
        * gfortran.dg/select_type_23.f03: Add dg-error.
        * gfortran.dg/class_45a.f03: Add missing TARGET attribute.


Added:
    trunk/gcc/testsuite/gfortran.dg/select_type_24.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/class.c
    trunk/gcc/fortran/match.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/class_45a.f03
    trunk/gcc/testsuite/gfortran.dg/select_type_23.f03


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

* [Bug fortran/48887] [4.7 Regression][OOP] SELECT TYPE:  Associate name shall not be a pointer/allocatable
  2011-05-05 13:11 [Bug fortran/48887] New: [OOP] SELECT TYPE: Associate name shall not be a pointer/allocatable burnus at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-12-03 18:32 ` burnus at gcc dot gnu.org
@ 2011-12-03 18:35 ` burnus at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-12-03 18:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-12-03 18:34:13 UTC ---
FIXED on the 4.7 trunk.


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

end of thread, other threads:[~2011-12-03 18:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-05 13:11 [Bug fortran/48887] New: [OOP] SELECT TYPE: Associate name shall not be a pointer/allocatable burnus at gcc dot gnu.org
2011-05-06 17:28 ` [Bug fortran/48887] " domob at gcc dot gnu.org
2011-05-27 11:04 ` domob at gcc dot gnu.org
2011-06-16 14:33 ` janus at gcc dot gnu.org
2011-12-02 16:22 ` [Bug fortran/48887] [4.7 Regression][OOP] " burnus at gcc dot gnu.org
2011-12-03 18:32 ` burnus at gcc dot gnu.org
2011-12-03 18:35 ` burnus 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).