public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/56136] New: Compiler fails when code contains lhs-reallocation of an object with overloaded (elemental) Assignment operator
@ 2013-01-29  3:12 alipasha.celeris at gmail dot com
  2013-01-29  8:39 ` [Bug fortran/56136] [OOP] ICE on lhs-reallocation of an object with overloaded (elemental) assignment operator janus at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: alipasha.celeris at gmail dot com @ 2013-01-29  3:12 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56136
           Summary: Compiler fails when code contains lhs-reallocation of
                    an object with overloaded (elemental) Assignment
                    operator
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: alipasha.celeris@gmail.com


Created attachment 29299
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29299
The code that causes compiler crash

Upon compiling the following code using GNU Fortran (GCC) 4.8.0 20130128
(experimental):

      MODULE A_TEST_M
        TYPE :: A_TYPE
          CONTAINS
          GENERIC :: ASSIGNMENT (=) => ASGN_A
          PROCEDURE, PRIVATE :: ASGN_A
        END TYPE

        CONTAINS

        ELEMENTAL SUBROUTINE ASGN_A (A, B)
          CLASS (A_TYPE), INTENT (INOUT) :: A
          CLASS (A_TYPE), INTENT (IN) :: B
        END SUBROUTINE
      END MODULE A_TEST_M

      PROGRAM ASGN_REALLOC_TEST
        USE A_TEST_M
        TYPE (A_TYPE), ALLOCATABLE :: A(:)

        ALLOCATE (A(100))
        A(1:50) = A(51:100)
        A = A(1:50)
      END PROGRAM

placed in file "asgn_realloc_test.f" with compile call:

      user@machine:~/../quicktest$ gfortran asgn_realloc_test.f

causes compiler to crash with the following messages: 

asgn_realloc_test.f: In function ‘test’:
asgn_realloc_test.f:22:0: internal compiler error: in gfc_conv_variable, at
fortran/trans-expr.c:1658
         A = A(1:50)
 ^
0x5db000 gfc_conv_variable
    ../.././gcc/fortran/trans-expr.c:1658
0x5d75ca gfc_conv_expr(gfc_se*, gfc_expr*)
    ../.././gcc/fortran/trans-expr.c:6263
0x5dbef3 gfc_conv_expr_reference(gfc_se*, gfc_expr*)
    ../.././gcc/fortran/trans-expr.c:6357
0x5dc2fa gfc_conv_derived_to_class(gfc_se*, gfc_expr*, gfc_typespec,
tree_node*, bool, bool)
    ../.././gcc/fortran/trans-expr.c:305
0x5d426a gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*,
gfc_expr*, vec<tree_node*, va_gc, vl_embed>*)
    ../.././gcc/fortran/trans-expr.c:4087
0x5ff84c gfc_trans_call(gfc_code*, bool, tree_node*, tree_node*, bool)
    ../.././gcc/fortran/trans-stmt.c:491
0x5a4663 trans_code
    ../.././gcc/fortran/trans.c:1511
0x5cb57e gfc_generate_function_code(gfc_namespace*)
    ../.././gcc/fortran/trans-decl.c:5390
0x564390 translate_all_program_units
    ../.././gcc/fortran/parse.c:4463
0x564390 gfc_parse_file()
    ../.././gcc/fortran/parse.c:4677
0x59fe75 gfc_be_parse_file
    ../.././gcc/fortran/f95-lang.c:189
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Note that the line before the reallocating assignment (A(1:50) = A(51:100))
will not cause errors.

Compiler was configured using:

      sudo LIBRARY_PATH=/usr/lib/x86_64-linux-gnu ./configure
--enable-languages=c,c++,fortran --enable-libgomp --enable-lto --enable-gold
--with-plugin-ld=/usr/bin/gold

on Ubuntu:

      Release 12.04 (precise) 64-bit
      Kernel Linux 3.2.0-36-generic


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

* [Bug fortran/56136] [OOP] ICE on lhs-reallocation of an object with overloaded (elemental) assignment operator
  2013-01-29  3:12 [Bug fortran/56136] New: Compiler fails when code contains lhs-reallocation of an object with overloaded (elemental) Assignment operator alipasha.celeris at gmail dot com
@ 2013-01-29  8:39 ` janus at gcc dot gnu.org
  2013-06-14 15:17 ` dominiq at lps dot ens.fr
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2013-01-29  8:39 UTC (permalink / raw)
  To: gcc-bugs


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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|                            |2013-01-29
                 CC|                            |janus at gcc dot gnu.org
     Ever Confirmed|0                           |1
            Summary|Compiler fails when code    |[OOP] ICE on
                   |contains lhs-reallocation   |lhs-reallocation of an
                   |of an object with           |object with overloaded
                   |overloaded (elemental)      |(elemental) assignment
                   |Assignment operator         |operator

--- Comment #1 from janus at gcc dot gnu.org 2013-01-29 08:38:36 UTC ---
Confirmed with 4.7 and trunk. 4.6 yields:

  A = A(1:50)
             1
Error: Non-scalar base object at (1) currently not implemented


This slightly different variant also ICEs with 4.6:

MODULE A_TEST_M

  TYPE :: A_TYPE
  END TYPE

  INTERFACE ASSIGNMENT (=)
    MODULE PROCEDURE ASGN_A
  END INTERFACE

 CONTAINS

  ELEMENTAL SUBROUTINE ASGN_A (A, B)
    CLASS (A_TYPE), INTENT (INOUT) :: A
    CLASS (A_TYPE), INTENT (IN) :: B
  END SUBROUTINE

END MODULE A_TEST_M

PROGRAM ASGN_REALLOC_TEST
  USE A_TEST_M
  TYPE (A_TYPE), ALLOCATABLE :: A(:)

  ALLOCATE (A(100))
  A = A(1:50)
END PROGRAM


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

* [Bug fortran/56136] [OOP] ICE on lhs-reallocation of an object with overloaded (elemental) assignment operator
  2013-01-29  3:12 [Bug fortran/56136] New: Compiler fails when code contains lhs-reallocation of an object with overloaded (elemental) Assignment operator alipasha.celeris at gmail dot com
  2013-01-29  8:39 ` [Bug fortran/56136] [OOP] ICE on lhs-reallocation of an object with overloaded (elemental) assignment operator janus at gcc dot gnu.org
@ 2013-06-14 15:17 ` dominiq at lps dot ens.fr
  2013-06-15 10:59 ` mikael at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-06-14 15:17 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael.morin at sfr dot fr

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
This PR seems to have been fixed between revisions 200062 and 200078
(r200069?).


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

* [Bug fortran/56136] [OOP] ICE on lhs-reallocation of an object with overloaded (elemental) assignment operator
  2013-01-29  3:12 [Bug fortran/56136] New: Compiler fails when code contains lhs-reallocation of an object with overloaded (elemental) Assignment operator alipasha.celeris at gmail dot com
  2013-01-29  8:39 ` [Bug fortran/56136] [OOP] ICE on lhs-reallocation of an object with overloaded (elemental) assignment operator janus at gcc dot gnu.org
  2013-06-14 15:17 ` dominiq at lps dot ens.fr
@ 2013-06-15 10:59 ` mikael at gcc dot gnu.org
  2013-06-15 21:25 ` mikael at gcc dot gnu.org
  2013-06-15 21:28 ` mikael at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mikael at gcc dot gnu.org @ 2013-06-15 10:59 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |mikael at gcc dot gnu.org
         Resolution|---                         |FIXED

--- Comment #3 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #2)
> This PR seems to have been fixed between revisions 200062 and 200078
> (r200069?).

Yes it is the same bug as PR49074.
The ingredients are:
 - typebound assignment (though I'm not sure it is necessary),
 - elemental procedure with polymorphic dummies,
 - need for a temporary.


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

* [Bug fortran/56136] [OOP] ICE on lhs-reallocation of an object with overloaded (elemental) assignment operator
  2013-01-29  3:12 [Bug fortran/56136] New: Compiler fails when code contains lhs-reallocation of an object with overloaded (elemental) Assignment operator alipasha.celeris at gmail dot com
                   ` (2 preceding siblings ...)
  2013-06-15 10:59 ` mikael at gcc dot gnu.org
@ 2013-06-15 21:25 ` mikael at gcc dot gnu.org
  2013-06-15 21:28 ` mikael at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mikael at gcc dot gnu.org @ 2013-06-15 21:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Mikael Morin <mikael at gcc dot gnu.org> ---
Author: mikael
Date: Sat Jun 15 21:20:29 2013
New Revision: 200128

URL: http://gcc.gnu.org/viewcvs?rev=200128&root=gcc&view=rev
Log:
fortran/
    PR fortran/49074
    PR fortran/56136
    * dependency.c (gfc_check_argument_var_dependency): Return 0 in the
    array constructor case.

testsuite/
    PR fortran/49074
    PR fortran/56136
    * gfortran.dg/typebound_assignment_5.f03: Check the absence of any
    packing.
    * gfortran.dg/typebound_assignment_6.f03: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/typebound_assignment_6.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/dependency.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/typebound_assignment_5.f03


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

* [Bug fortran/56136] [OOP] ICE on lhs-reallocation of an object with overloaded (elemental) assignment operator
  2013-01-29  3:12 [Bug fortran/56136] New: Compiler fails when code contains lhs-reallocation of an object with overloaded (elemental) Assignment operator alipasha.celeris at gmail dot com
                   ` (3 preceding siblings ...)
  2013-06-15 21:25 ` mikael at gcc dot gnu.org
@ 2013-06-15 21:28 ` mikael at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mikael at gcc dot gnu.org @ 2013-06-15 21:28 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |DUPLICATE

--- Comment #5 from Mikael Morin <mikael at gcc dot gnu.org> ---
Comment #4 removes an unnecessary packing/unpacking and adds a variant of the
testcase of this PR in the testsuite.

(In reply to Mikael Morin from comment #3)
> Yes it is the same bug as PR49074.

So the resolution status should be DUPLICATE.

*** This bug has been marked as a duplicate of bug 49074 ***


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

end of thread, other threads:[~2013-06-15 21:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-29  3:12 [Bug fortran/56136] New: Compiler fails when code contains lhs-reallocation of an object with overloaded (elemental) Assignment operator alipasha.celeris at gmail dot com
2013-01-29  8:39 ` [Bug fortran/56136] [OOP] ICE on lhs-reallocation of an object with overloaded (elemental) assignment operator janus at gcc dot gnu.org
2013-06-14 15:17 ` dominiq at lps dot ens.fr
2013-06-15 10:59 ` mikael at gcc dot gnu.org
2013-06-15 21:25 ` mikael at gcc dot gnu.org
2013-06-15 21:28 ` mikael 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).