public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/56765] New: compilation errors/ICE with unlimited polymorphic array
@ 2013-03-28 13:42 escout20 at gmail dot com
  2013-03-28 22:37 ` [Bug fortran/56765] [OOP] " burnus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: escout20 at gmail dot com @ 2013-03-28 13:42 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56765
           Summary: compilation errors/ICE with unlimited polymorphic
                    array
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: escout20@gmail.com


When compiling following program:

program t_unlimited_2
    implicit none
    class(*), dimension(:), pointer :: u
    u => sub()
contains
    function sub() result(r)
        class(*), dimension(:), pointer :: r
        integer, dimension(3), target :: x = [1,2,3]
        r => x
    end function
end program

I get the output:
----------------------------------------------------------
$gfortran -Wall -Wextra t_unlimited_2.f90
t_unlimited_2.f90:4.4:

    u => sub()
    1
Error: Different ranks in pointer assignment at (1)
---------------------------------------------------------

u and sub are both of rank 1.

When compiling the following (u is scalar here):

program t_unlimited_3
    implicit none
    class(*), pointer :: u
    u => sub()
contains
    function sub() result(r)
        class(*), dimension(:), pointer :: r
        integer, dimension(3), target :: x = [1,2,3]
        r => x
    end function
end program  

I get an ICE:

------------------------------------------------------------
$gfortran -Wall -Wextra t_unlimited_3.f90
t_unlimited_3.f90: In function ‘t_unlimited_3’:
t_unlimited_3.f90:4:0: internal compiler error: in fold_convert_loc, at
fold-const.c:1862
     u => sub()
 ^

t_unlimited_3.f90:4:0: internal compiler error: Abort trap
gfortran: internal compiler error: Abort trap (program f951)
Abort trap
-------------------------------------------------------------

Version:

$gfortran -v
Using built-in specs.
COLLECT_GCC=/xsw/gf48/bin/gfortran
COLLECT_LTO_WRAPPER=/xsw/gcc-4.8-20130321/install/libexec/gcc/x86_64-apple-darwin10.8.0/4.8.0/lto-wrapper
Target: x86_64-apple-darwin10.8.0
Configured with: ../src/configure --prefix=/xsw/gcc-4.8-20130321/install
--enable-languages=c,fortran --with-gmp=/opt/local --with-mpfr=/opt/local
--with-mpc=/opt/local --with-libiconv-prefix=/opt/local
Thread model: posix
gcc version 4.8.0 20130321 (prerelease) (GCC) 


Running on Mac OS X 10.6.8
>From gcc-bugs-return-418665-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Mar 28 13:46:08 2013
Return-Path: <gcc-bugs-return-418665-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 5354 invoked by alias); 28 Mar 2013 13:46:08 -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 5284 invoked by uid 48); 28 Mar 2013 13:46:03 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/52748] [4.9 Regression][C++11] N3276 changes to decltype
Date: Thu, 28 Mar 2013 13:46: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-Keywords: rejects-valid
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: REOPENED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: jason at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.8.1
X-Bugzilla-Changed-Fields:
Message-ID: <bug-52748-4-1udBlVJ73F@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-52748-4@http.gcc.gnu.org/bugzilla/>
References: <bug-52748-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-03/txt/msg02106.txt.bz2
Content-length: 252


http://gcc.gnu.org/bugzilla/show_bug.cgi?idR748

--- Comment #11 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-03-28 13:46:02 UTC ---
Thanks Jason. Looks like to be safe we should also add Nathan's testcase as-is
to the testsuite.


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

* [Bug fortran/56765] [OOP] compilation errors/ICE with unlimited polymorphic array
  2013-03-28 13:42 [Bug fortran/56765] New: compilation errors/ICE with unlimited polymorphic array escout20 at gmail dot com
@ 2013-03-28 22:37 ` burnus at gcc dot gnu.org
  2013-03-29 21:30 ` janus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-03-28 22:37 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |pault at gcc dot gnu.org

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-03-28 22:37:08 UTC ---
Regarding the rank error (and "expr->rank = "), it seems as if one has to
review the following functions in result.c:  resolve_generic_f0,
expression_rank, check_host_association, resolve_unknown_f,
resolve_specific_f0, resolve_compcall,resolve_expr_ppc, resolve_assoc_var,
add_comp_ref, resolve_structure_cons.


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

* [Bug fortran/56765] [OOP] compilation errors/ICE with unlimited polymorphic array
  2013-03-28 13:42 [Bug fortran/56765] New: compilation errors/ICE with unlimited polymorphic array escout20 at gmail dot com
  2013-03-28 22:37 ` [Bug fortran/56765] [OOP] " burnus at gcc dot gnu.org
@ 2013-03-29 21:30 ` janus at gcc dot gnu.org
  2013-03-31 17:35 ` janus at gcc dot gnu.org
  2013-04-13 12:31 ` [Bug fortran/56765] [OOP] compilation errors/ICE with " janus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu.org @ 2013-03-29 21:30 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from janus at gcc dot gnu.org 2013-03-29 21:30:03 UTC ---
With this patch ...


Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c    (revision 196862)
+++ gcc/fortran/resolve.c    (working copy)
@@ -2538,7 +2538,9 @@ found:
     expr->ts = sym->ts;
   expr->value.function.name = sym->name;
   expr->value.function.esym = sym;
-  if (sym->as != NULL)
+  if (sym->result->ts.type == BT_CLASS && CLASS_DATA (sym->result)->as)
+    expr->rank = CLASS_DATA (sym->result)->as->rank;
+  else if (sym->as != NULL)
     expr->rank = sym->as->rank;

   return MATCH_YES;


... the behavior of the two test cases is swapped: The second one is
(correctly) rejected, while the first one ends up with the ICE.


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

* [Bug fortran/56765] [OOP] compilation errors/ICE with unlimited polymorphic array
  2013-03-28 13:42 [Bug fortran/56765] New: compilation errors/ICE with unlimited polymorphic array escout20 at gmail dot com
  2013-03-28 22:37 ` [Bug fortran/56765] [OOP] " burnus at gcc dot gnu.org
  2013-03-29 21:30 ` janus at gcc dot gnu.org
@ 2013-03-31 17:35 ` janus at gcc dot gnu.org
  2013-04-13 12:31 ` [Bug fortran/56765] [OOP] compilation errors/ICE with " janus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu.org @ 2013-03-31 17:35 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from janus at gcc dot gnu.org 2013-03-31 17:35:13 UTC ---
Btw, this bug does not require unlimited polymorphism, but also shows up with
normal ('limited'?) CLASS definitions:


program t_limited
    implicit none
    type :: t
      integer :: i = 0
    end type
    class(t), dimension(:), pointer :: u
    u => sub()
contains
    function sub() result(r)
        class(t), dimension(:), pointer :: r
        type(t), dimension(3), target :: x = t(1)
        r => x
    end function
end program


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

* [Bug fortran/56765] [OOP] compilation errors/ICE with polymorphic array
  2013-03-28 13:42 [Bug fortran/56765] New: compilation errors/ICE with unlimited polymorphic array escout20 at gmail dot com
                   ` (2 preceding siblings ...)
  2013-03-31 17:35 ` janus at gcc dot gnu.org
@ 2013-04-13 12:31 ` janus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu.org @ 2013-04-13 12:31 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from janus at gcc dot gnu.org 2013-04-13 12:31:42 UTC ---
Note: The patch in comment 3 regtests cleanly.


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

end of thread, other threads:[~2013-04-13 12:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-28 13:42 [Bug fortran/56765] New: compilation errors/ICE with unlimited polymorphic array escout20 at gmail dot com
2013-03-28 22:37 ` [Bug fortran/56765] [OOP] " burnus at gcc dot gnu.org
2013-03-29 21:30 ` janus at gcc dot gnu.org
2013-03-31 17:35 ` janus at gcc dot gnu.org
2013-04-13 12:31 ` [Bug fortran/56765] [OOP] compilation errors/ICE with " janus 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).