From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28941 invoked by alias); 7 Dec 2013 11:56:47 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 28916 invoked by uid 48); 7 Dec 2013 11:56:43 -0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/59414] [OOP] Class array pointers: compile error on valid code (Different ranks in pointer assignment) Date: Sat, 07 Dec 2013 11:56:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: blocker X-Bugzilla-Who: janus at gcc dot gnu.org X-Bugzilla-Status: NEW 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: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-12/txt/msg00597.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D59414 --- Comment #2 from janus at gcc dot gnu.org --- This draft patch fixes the error (but has not been regtested yet): Index: gcc/fortran/resolve.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/fortran/resolve.c (revision 205782) +++ gcc/fortran/resolve.c (working copy) @@ -2616,6 +2616,8 @@ found: expr->ts =3D sym->ts; expr->value.function.name =3D sym->name; expr->value.function.esym =3D sym; + if (sym->ts.type =3D=3D BT_CLASS && CLASS_DATA (sym)->as) + expr->rank =3D CLASS_DATA (sym)->as->rank; if (sym->as !=3D NULL) expr->rank =3D sym->as->rank; With the patch the reduced test case in comment 1 compiles cleanly, but the full code in comment 0 then gives an ICE on a different location: ObjectLists.f90: In function =E2=80=98addarray=E2=80=99: ObjectLists.f90:240:0: internal compiler error: in gfc_conv_expr_descriptor= , at fortran/trans-array.c:6473 allocate(Pt%P(1:SIZE(P)), source=3D P) ^ 0x636b4b gfc_conv_expr_descriptor(gfc_se*, gfc_expr*) /home/jweil/gcc49/trunk/gcc/fortran/trans-array.c:6473 0x65597e gfc_trans_pointer_assignment(gfc_expr*, gfc_expr*) /home/jweil/gcc49/trunk/gcc/fortran/trans-expr.c:6609 0x676cd1 gfc_trans_allocate(gfc_code*) /home/jweil/gcc49/trunk/gcc/fortran/trans-stmt.c:5124 0x6269c7 trans_code /home/jweil/gcc49/trunk/gcc/fortran/trans.c:1778 0x66df53 gfc_trans_if_1 /home/jweil/gcc49/trunk/gcc/fortran/trans-stmt.c:986 0x673d2a gfc_trans_if(gfc_code*) /home/jweil/gcc49/trunk/gcc/fortran/trans-stmt.c:1017 0x626aa7 trans_code /home/jweil/gcc49/trunk/gcc/fortran/trans.c:1720 0x674088 gfc_trans_block_construct(gfc_code*) /home/jweil/gcc49/trunk/gcc/fortran/trans-stmt.c:1344 0x626a37 trans_code /home/jweil/gcc49/trunk/gcc/fortran/trans.c:1728 0x66df53 gfc_trans_if_1 /home/jweil/gcc49/trunk/gcc/fortran/trans-stmt.c:986 0x673d2a gfc_trans_if(gfc_code*) /home/jweil/gcc49/trunk/gcc/fortran/trans-stmt.c:1017 0x626aa7 trans_code /home/jweil/gcc49/trunk/gcc/fortran/trans.c:1720 0x67585d gfc_trans_integer_select /home/jweil/gcc49/trunk/gcc/fortran/trans-stmt.c:1992 0x67585d gfc_trans_select(gfc_code*) /home/jweil/gcc49/trunk/gcc/fortran/trans-stmt.c:2486 0x626a47 trans_code /home/jweil/gcc49/trunk/gcc/fortran/trans.c:1744 0x674088 gfc_trans_block_construct(gfc_code*) /home/jweil/gcc49/trunk/gcc/fortran/trans-stmt.c:1344 0x626a37 trans_code /home/jweil/gcc49/trunk/gcc/fortran/trans.c:1728 0x646382 gfc_generate_function_code(gfc_namespace*) /home/jweil/gcc49/trunk/gcc/fortran/trans-decl.c:5604 0x627ed1 gfc_generate_module_code(gfc_namespace*) /home/jweil/gcc49/trunk/gcc/fortran/trans.c:1956 0x5da09b translate_all_program_units /home/jweil/gcc49/trunk/gcc/fortran/parse.c:4523 >>From gcc-bugs-return-436943-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Dec 07 12:05:35 2013 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 2158 invoked by alias); 7 Dec 2013 12:05:35 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 2144 invoked by uid 48); 7 Dec 2013 12:05:30 -0000 From: "ville.voutilainen at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/59416] New: A nested template reusing the template arguments of the enclosing type in a template template argument not working Date: Sat, 07 Dec 2013 12:05:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ville.voutilainen at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-12/txt/msg00598.txt.bz2 Content-length: 1661 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D59416 Bug ID: 59416 Summary: A nested template reusing the template arguments of the enclosing type in a template template argument not working Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ville.voutilainen at gmail dot com Test: template struct Obj;=20 template struct A { template class> struct B { }; }; int main() {=20 A::B x{ };=20 }=20 edoceo3.cpp:8:20: error: type/value mismatch at argument 1 in template parameter list for =E2=80=98template template > class > template template > class > struct A::= B=E2=80=99 A::B x{ };=20 ^ edoceo3.cpp:8:20: error: expected a template of type =E2=80=98template template > class=E2=80=99, got = =E2=80=98template, int > struct Obj=E2=80=99 edoceo3.cpp:8:23: error: invalid type in declaration before =E2=80=98{=E2= =80=99 token A::B x{ };=20 clang compiles this code. It certainly looks valid to me, since in the attempted instantiation, A's template arguments are 'int,int', and then the template argument for A::B should be 'template class', and Obj is such a template. >>From gcc-bugs-return-436944-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Dec 07 12:25:21 2013 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 14145 invoked by alias); 7 Dec 2013 12:25:21 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 14105 invoked by uid 48); 7 Dec 2013 12:25:17 -0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/59414] [OOP] Class array pointers: compile error on valid code (Different ranks in pointer assignment) Date: Sat, 07 Dec 2013 12:25:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: blocker X-Bugzilla-Who: janus at gcc dot gnu.org X-Bugzilla-Status: NEW 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: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-12/txt/msg00599.txt.bz2 Content-length: 985 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D59414 --- Comment #3 from janus at gcc dot gnu.org --- (In reply to janus from comment #2) > With the patch the reduced test case in comment 1 compiles cleanly, but t= he > full code in comment 0 then gives an ICE on a different location: >=20 > ObjectLists.f90: In function =E2=80=98addarray=E2=80=99: > ObjectLists.f90:240:0: internal compiler error: in gfc_conv_expr_descript= or, > at fortran/trans-array.c:6473 > allocate(Pt%P(1:SIZE(P)), source=3D P) Here is a reduced test case for the ICE (which seems unrelated to the origi= nal error): module ObjectLists implicit none type :: t end type type Object_array_pointer class(t), pointer :: p(:) end type contains subroutine AddArray (P, Pt) class(t) :: P(:) class(Object_array_pointer) :: Pt select type (Pt) class is (Object_array_pointer) allocate(Pt%P(1:SIZE(P)), source=3DP) end select end subroutine end module >>From gcc-bugs-return-436945-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Dec 07 12:30:23 2013 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 20505 invoked by alias); 7 Dec 2013 12:30:23 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 20440 invoked by uid 48); 7 Dec 2013 12:30:18 -0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/59414] [OOP] Class array pointers: compile error on valid code (Different ranks in pointer assignment) Date: Sat, 07 Dec 2013 12:30:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: blocker X-Bugzilla-Who: janus at gcc dot gnu.org X-Bugzilla-Status: NEW 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: In-Reply-To: References: 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: 2013-12/txt/msg00600.txt.bz2 Content-length: 298 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59414 --- Comment #4 from janus at gcc dot gnu.org --- Btw, when using the second (commented-out) version of 'AddArray' (which apparently crashes with ifort), the full code in comment 0 compiles cleanly with gfortran trunk plus the patch in comment 2.