public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/60289] New: allocating class(*) pointer as character gives type-spec requires the same character-length parameter
@ 2014-02-20 10:53 antony at cosmologist dot info
  2014-02-20 11:35 ` [Bug fortran/60289] " janus at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: antony at cosmologist dot info @ 2014-02-20 10:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60289
           Summary: allocating class(*) pointer as character gives
                    type-spec requires the same character-length parameter
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: antony at cosmologist dot info

class(*), pointer :: P
    allocate(character(5)::P)

gives error

Error: Allocating p at (1) with type-spec requires the same character-length
parameter as in the declaration


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

* [Bug fortran/60289] allocating class(*) pointer as character gives type-spec requires the same character-length parameter
  2014-02-20 10:53 [Bug fortran/60289] New: allocating class(*) pointer as character gives type-spec requires the same character-length parameter antony at cosmologist dot info
@ 2014-02-20 11:35 ` janus at gcc dot gnu.org
  2014-02-20 12:00 ` janus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu.org @ 2014-02-20 11:35 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-02-20
                 CC|                            |janus at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from janus at gcc dot gnu.org ---
Confirmed. Doing the same with a deferred-length character pointer works:

character(len=:), pointer :: P
allocate(character(5)::P)
end


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

* [Bug fortran/60289] allocating class(*) pointer as character gives type-spec requires the same character-length parameter
  2014-02-20 10:53 [Bug fortran/60289] New: allocating class(*) pointer as character gives type-spec requires the same character-length parameter antony at cosmologist dot info
  2014-02-20 11:35 ` [Bug fortran/60289] " janus at gcc dot gnu.org
@ 2014-02-20 12:00 ` janus at gcc dot gnu.org
  2014-02-27 12:50 ` mvondomaros at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu.org @ 2014-02-20 12:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from janus at gcc dot gnu.org ---
The error can easily be silenced with this patch:


Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c    (revision 207896)
+++ gcc/fortran/resolve.c    (working copy)
@@ -6834,7 +6834,9 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code
       goto failure;
     }

-  if (code->ext.alloc.ts.type == BT_CHARACTER && !e->ts.deferred)
+  /* Check F08:C632.  */
+  if (code->ext.alloc.ts.type == BT_CHARACTER && !e->ts.deferred
+      && !UNLIMITED_POLY (e))
     {
       int cmp = gfc_dep_compare_expr (e->ts.u.cl->length,
                       code->ext.alloc.ts.u.cl->length);


But then one runs into an ICE in gimplify.c:


internal compiler error: Segmentation fault
   class(*), pointer :: P
 ^
0x93ec0f crash_signal
    /home/jweil/gcc49/trunk/gcc/toplev.c:337
0x7c9647 copy_if_shared_r
    /home/jweil/gcc49/trunk/gcc/gimplify.c:769
0xaf404b walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, pointer_set_t*, tree_node* (*)(tree_node**, int*, tree_node*
(*)(tree_node**, int*, void*), void*, pointer_set_t*))
    /home/jweil/gcc49/trunk/gcc/tree.c:10920
0xaf4208 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, pointer_set_t*, tree_node* (*)(tree_node**, int*, tree_node*
(*)(tree_node**, int*, void*), void*, pointer_set_t*))
    /home/jweil/gcc49/trunk/gcc/tree.c:11201
0xaf4208 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, pointer_set_t*, tree_node* (*)(tree_node**, int*, tree_node*
(*)(tree_node**, int*, void*), void*, pointer_set_t*))
    /home/jweil/gcc49/trunk/gcc/tree.c:11201
0xaf4254 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, pointer_set_t*, tree_node* (*)(tree_node**, int*, tree_node*
(*)(tree_node**, int*, void*), void*, pointer_set_t*))
    /home/jweil/gcc49/trunk/gcc/tree.c:11025
0x7c9383 copy_if_shared
    /home/jweil/gcc49/trunk/gcc/gimplify.c:800
0x7c9383 unshare_body
    /home/jweil/gcc49/trunk/gcc/gimplify.c:815
0x7d0b9c gimplify_body(tree_node*, bool)
    /home/jweil/gcc49/trunk/gcc/gimplify.c:8539
0x7d0f37 gimplify_function_tree(tree_node*)
    /home/jweil/gcc49/trunk/gcc/gimplify.c:8708
0x6ce2f7 analyze_function
    /home/jweil/gcc49/trunk/gcc/cgraphunit.c:649
0x6cf337 analyze_functions
    /home/jweil/gcc49/trunk/gcc/cgraphunit.c:1017
0x6d0275 finalize_compilation_unit()
    /home/jweil/gcc49/trunk/gcc/cgraphunit.c:2320
0x837a74 write_global_declarations()
    /home/jweil/gcc49/trunk/gcc/langhooks.c:323


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

* [Bug fortran/60289] allocating class(*) pointer as character gives type-spec requires the same character-length parameter
  2014-02-20 10:53 [Bug fortran/60289] New: allocating class(*) pointer as character gives type-spec requires the same character-length parameter antony at cosmologist dot info
  2014-02-20 11:35 ` [Bug fortran/60289] " janus at gcc dot gnu.org
  2014-02-20 12:00 ` janus at gcc dot gnu.org
@ 2014-02-27 12:50 ` mvondomaros at gmail dot com
  2014-12-09 22:54 ` ondrej.certik at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mvondomaros at gmail dot com @ 2014-02-27 12:50 UTC (permalink / raw)
  To: gcc-bugs

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

Mike <mvondomaros at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mvondomaros at gmail dot com

--- Comment #3 from Mike <mvondomaros at gmail dot com> ---
Same problem in 4.8.2


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

* [Bug fortran/60289] allocating class(*) pointer as character gives type-spec requires the same character-length parameter
  2014-02-20 10:53 [Bug fortran/60289] New: allocating class(*) pointer as character gives type-spec requires the same character-length parameter antony at cosmologist dot info
                   ` (2 preceding siblings ...)
  2014-02-27 12:50 ` mvondomaros at gmail dot com
@ 2014-12-09 22:54 ` ondrej.certik at gmail dot com
  2014-12-29 17:40 ` vehre at gmx dot de
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ondrej.certik at gmail dot com @ 2014-12-09 22:54 UTC (permalink / raw)
  To: gcc-bugs

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

Ondřej Čertík <ondrej.certik at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ondrej.certik at gmail dot com

--- Comment #4 from Ondřej Čertík <ondrej.certik at gmail dot com> ---
Is there any workaround for this bug?

I am porting a code to gfortran and hit this bug. "P" in my code has various
types, so it needs to be class(*). I then need to allocate it and gfortran
prevents it due to this bug.

Still present in gfortran 4.9.2.
>From gcc-bugs-return-469977-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Dec 09 22:59:07 2014
Return-Path: <gcc-bugs-return-469977-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 6250 invoked by alias); 9 Dec 2014 22:59:07 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 6235 invoked by uid 48); 9 Dec 2014 22:59:04 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/64232] Derived class with implicitly declared assignment operator is std::is_assignable though base class is not std::is_assignable
Date: Tue, 09 Dec 2014 22:59:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.8.3
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: redi at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64232-4-sxuSraRdAC@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64232-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64232-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-12/txt/msg00984.txt.bz2
Content-length: 174

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd232

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Not just GCC, but clang/libc++ gives the same results.


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

* [Bug fortran/60289] allocating class(*) pointer as character gives type-spec requires the same character-length parameter
  2014-02-20 10:53 [Bug fortran/60289] New: allocating class(*) pointer as character gives type-spec requires the same character-length parameter antony at cosmologist dot info
                   ` (3 preceding siblings ...)
  2014-12-09 22:54 ` ondrej.certik at gmail dot com
@ 2014-12-29 17:40 ` vehre at gmx dot de
  2015-01-23 11:26 ` vehre at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vehre at gmx dot de @ 2014-12-29 17:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andre Vehreschild <vehre at gmx dot de> ---
Patch available in:
https://gcc.gnu.org/ml/fortran/2014-12/msg00133.html


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

* [Bug fortran/60289] allocating class(*) pointer as character gives type-spec requires the same character-length parameter
  2014-02-20 10:53 [Bug fortran/60289] New: allocating class(*) pointer as character gives type-spec requires the same character-length parameter antony at cosmologist dot info
                   ` (4 preceding siblings ...)
  2014-12-29 17:40 ` vehre at gmx dot de
@ 2015-01-23 11:26 ` vehre at gcc dot gnu.org
  2015-02-06 11:23 ` vehre at gcc dot gnu.org
  2015-02-11 16:51 ` vehre at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vehre at gcc dot gnu.org @ 2015-01-23 11:26 UTC (permalink / raw)
  To: gcc-bugs

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

vehre at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |vehre at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |vehre at gcc dot gnu.org


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

* [Bug fortran/60289] allocating class(*) pointer as character gives type-spec requires the same character-length parameter
  2014-02-20 10:53 [Bug fortran/60289] New: allocating class(*) pointer as character gives type-spec requires the same character-length parameter antony at cosmologist dot info
                   ` (5 preceding siblings ...)
  2015-01-23 11:26 ` vehre at gcc dot gnu.org
@ 2015-02-06 11:23 ` vehre at gcc dot gnu.org
  2015-02-11 16:51 ` vehre at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vehre at gcc dot gnu.org @ 2015-02-06 11:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from vehre at gcc dot gnu.org ---
Author: vehre
Date: Fri Feb  6 11:22:54 2015
New Revision: 220474

URL: https://gcc.gnu.org/viewcvs?rev=220474&root=gcc&view=rev
Log:
    PR fortran/60289
    Initial patch by Janus Weil
    * resolve.c (resolve_allocate_expr): Add check for comp. only when 
    target is not unlimited polymorphic.
    * trans-stmt.c (gfc_trans_allocate): Assign correct value to _len
    component of unlimited polymorphic entities.

    * gfortran.dg/unlimited_polymorphic_22.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/unlimited_polymorphic_22.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-stmt.c


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

* [Bug fortran/60289] allocating class(*) pointer as character gives type-spec requires the same character-length parameter
  2014-02-20 10:53 [Bug fortran/60289] New: allocating class(*) pointer as character gives type-spec requires the same character-length parameter antony at cosmologist dot info
                   ` (6 preceding siblings ...)
  2015-02-06 11:23 ` vehre at gcc dot gnu.org
@ 2015-02-11 16:51 ` vehre at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vehre at gcc dot gnu.org @ 2015-02-11 16:51 UTC (permalink / raw)
  To: gcc-bugs

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

vehre at gcc dot gnu.org changed:

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

--- Comment #7 from vehre at gcc dot gnu.org ---
The patch in comment #6 fixes the issue.


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

end of thread, other threads:[~2015-02-11 16:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-20 10:53 [Bug fortran/60289] New: allocating class(*) pointer as character gives type-spec requires the same character-length parameter antony at cosmologist dot info
2014-02-20 11:35 ` [Bug fortran/60289] " janus at gcc dot gnu.org
2014-02-20 12:00 ` janus at gcc dot gnu.org
2014-02-27 12:50 ` mvondomaros at gmail dot com
2014-12-09 22:54 ` ondrej.certik at gmail dot com
2014-12-29 17:40 ` vehre at gmx dot de
2015-01-23 11:26 ` vehre at gcc dot gnu.org
2015-02-06 11:23 ` vehre at gcc dot gnu.org
2015-02-11 16:51 ` vehre 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).