public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/58658] New: Pointer assignment to allocatable unlimited polymorphic accepted
@ 2013-10-07 14:13 vladimir.fuka at gmail dot com
  2013-10-07 15:20 ` [Bug fortran/58658] [OOP] " burnus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vladimir.fuka at gmail dot com @ 2013-10-07 14:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58658
           Summary: Pointer assignment to allocatable unlimited
                    polymorphic accepted
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vladimir.fuka at gmail dot com

subroutine sub(a)
  class(*),allocatable :: a
  a => null()
end subroutine

is accepted by

gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.8/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.8-20130509/configure --enable-languages=c,c++,fortran
--with-cloog --prefix=/usr/local/gcc-4.8
Thread model: posix
gcc version 4.8.1 20130509 (prerelease) (GCC)


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

* [Bug fortran/58658] [OOP] Pointer assignment to allocatable unlimited polymorphic accepted
  2013-10-07 14:13 [Bug fortran/58658] New: Pointer assignment to allocatable unlimited polymorphic accepted vladimir.fuka at gmail dot com
@ 2013-10-07 15:20 ` burnus at gcc dot gnu.org
  2013-10-07 19:31 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-10-07 15:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-07
                 CC|                            |burnus at gcc dot gnu.org
            Summary|Pointer assignment to       |[OOP] Pointer assignment to
                   |allocatable unlimited       |allocatable unlimited
                   |polymorphic accepted        |polymorphic accepted
     Ever confirmed|0                           |1
      Known to fail|                            |4.8.1, 4.9.0

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Confirmed. Untested patch:

--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -2147,5 +2147,5 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts)
   attr = sym->attr;

-  if (sym->ts.type == BT_CLASS && sym->attr.class_ok)
+  if (sym->ts.type == BT_CLASS && (sym->attr.class_ok || UNLIMITED_POLY
(sym)))
     {
       dimension = CLASS_DATA (sym)->attr.dimension;


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

* [Bug fortran/58658] [OOP] Pointer assignment to allocatable unlimited polymorphic accepted
  2013-10-07 14:13 [Bug fortran/58658] New: Pointer assignment to allocatable unlimited polymorphic accepted vladimir.fuka at gmail dot com
  2013-10-07 15:20 ` [Bug fortran/58658] [OOP] " burnus at gcc dot gnu.org
@ 2013-10-07 19:31 ` burnus at gcc dot gnu.org
  2013-10-14 17:26 ` burnus at gcc dot gnu.org
  2013-10-14 17:26 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-10-07 19:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #1)
> Confirmed. Untested patch:

Which of course doesn't work. What helps is the following patch (not
regtested). I wonder why there is the unlimited check. - It looks completely
bogus.

--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -4693,7 +4693,6 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool
alloc_obj,
   bool is_pointer;
   bool check_intentin;
   bool ptr_component;
-  bool unlimited;
   symbol_attribute attr;
   gfc_ref* ref;
   int i;
@@ -4709,8 +4708,6 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool
alloc_obj,
       sym = e->value.function.esym ? e->value.function.esym :
e->symtree->n.sym;
     }

-  unlimited = e->ts.type == BT_CLASS && UNLIMITED_POLY (sym);
-
   attr = gfc_expr_attr (e);
   if (!pointer && e->expr_type == EXPR_FUNCTION && attr.pointer)
     {
@@ -4750,7 +4747,7 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool
alloc_obj,
   /* Find out whether the expr is a pointer; this also means following
      component references to the last one.  */
   is_pointer = (attr.pointer || attr.proc_pointer);
-  if (pointer && !is_pointer && !unlimited)
+  if (pointer && !is_pointer)
     {
       if (context)
        gfc_error ("Non-POINTER in pointer association context (%s)"


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

* [Bug fortran/58658] [OOP] Pointer assignment to allocatable unlimited polymorphic accepted
  2013-10-07 14:13 [Bug fortran/58658] New: Pointer assignment to allocatable unlimited polymorphic accepted vladimir.fuka at gmail dot com
                   ` (2 preceding siblings ...)
  2013-10-14 17:26 ` burnus at gcc dot gnu.org
@ 2013-10-14 17:26 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-10-14 17:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Author: burnus
Date: Mon Oct 14 17:26:17 2013
New Revision: 203572

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

        PR fortran/58658
        * expr.c (gfc_check_vardef_context): Fix pointer diagnostic
        for CLASS(*).

2013-10-14  Tobias Burnus  <burnus@net-b.de>

        PR fortran/58658
        * gfortran.dg/unlimited_polymorphic_10.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/unlimited_polymorphic_10.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/58658] [OOP] Pointer assignment to allocatable unlimited polymorphic accepted
  2013-10-07 14:13 [Bug fortran/58658] New: Pointer assignment to allocatable unlimited polymorphic accepted vladimir.fuka at gmail dot com
  2013-10-07 15:20 ` [Bug fortran/58658] [OOP] " burnus at gcc dot gnu.org
  2013-10-07 19:31 ` burnus at gcc dot gnu.org
@ 2013-10-14 17:26 ` burnus at gcc dot gnu.org
  2013-10-14 17:26 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-10-14 17:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
FIXED on the trunk (4.9).

Thanks for the report!


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

end of thread, other threads:[~2013-10-14 17:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-07 14:13 [Bug fortran/58658] New: Pointer assignment to allocatable unlimited polymorphic accepted vladimir.fuka at gmail dot com
2013-10-07 15:20 ` [Bug fortran/58658] [OOP] " burnus at gcc dot gnu.org
2013-10-07 19:31 ` burnus at gcc dot gnu.org
2013-10-14 17:26 ` burnus at gcc dot gnu.org
2013-10-14 17:26 ` 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).