public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/56385] New: ICE with allocatable function result in a type-bound procedure
@ 2013-02-18 21:54 vladimir.fuka at gmail dot com
  2013-02-18 22:15 ` [Bug fortran/56385] [OOP] ICE with allocatable function result in a procedure-pointer component janus at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: vladimir.fuka at gmail dot com @ 2013-02-18 21:54 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56385
           Summary: ICE with allocatable function result in a type-bound
                    procedure
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vladimir.fuka@gmail.com


Created attachment 29488
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29488
reproduction case source

I got an internal compiler error for the attached source. Workaround is to
define the scalar_flux_interface to return an array with explicit size.

> gfortran ice2.f90 -c -v
Using built-in specs.
COLLECT_GCC=gfortran
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.8-20130217/configure --enable-languages=c,c++,fortran
--prefix=/usr/local/gcc-4.8
Thread model: posix
gcc version 4.8.0 20130217 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-c' '-v' '-mtune=generic' '-march=x86-64'
 /usr/local/gcc-4.8/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/f951 ice2.f90 -quiet
-dumpbase ice2.f90 -mtune=generic -march=x86-64 -auxbase ice2 -version
-fintrinsic-modules-path
/usr/local/gcc-4.8/lib64/gcc/x86_64-unknown-linux-gnu/4.8.0/finclude -o
/tmp/ccpwiWpj.s
GNU Fortran (GCC) version 4.8.0 20130217 (experimental)
(x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.8.0 20130217 (experimental), GMP version
5.0.5, MPFR version 3.1.0-p1, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU Fortran (GCC) version 4.8.0 20130217 (experimental)
(x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.8.0 20130217 (experimental), GMP version
5.0.5, MPFR version 3.1.0-p1, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ice2.f90: In function ‘__copy_volumesources_Tvolumesourcebody’:
ice2.f90:59:0: internal compiler error: in gfc_conv_descriptor_data_set, at
fortran/trans-array.c:171
       class(TVolumeSourceBody),intent(in) :: self
 ^
0x5bf8c8 gfc_conv_descriptor_data_set(stmtblock_t*, tree_node*, tree_node*)
        ../../gcc-4.8-20130217/gcc/fortran/trans-array.c:171
0x5c07d9 duplicate_allocatable
        ../../gcc-4.8-20130217/gcc/fortran/trans-array.c:7347
0x5ca037 gfc_duplicate_allocatable
        ../../gcc-4.8-20130217/gcc/fortran/trans-array.c:7394
0x5ca037 structure_alloc_comps
        ../../gcc-4.8-20130217/gcc/fortran/trans-array.c:7736
0x5e9532 gfc_trans_scalar_assign(gfc_se*, gfc_se*, gfc_typespec, bool, bool,
bool)
        ../../gcc-4.8-20130217/gcc/fortran/trans-expr.c:6866
0x5f5522 gfc_trans_assignment_1
        ../../gcc-4.8-20130217/gcc/fortran/trans-expr.c:7782
0x5bc175 trans_code
        ../../gcc-4.8-20130217/gcc/fortran/trans.c:1446
0x5e312e gfc_generate_function_code(gfc_namespace*)
        ../../gcc-4.8-20130217/gcc/fortran/trans-decl.c:5395
0x5bceb1 gfc_generate_module_code(gfc_namespace*)
        ../../gcc-4.8-20130217/gcc/fortran/trans.c:1755
0x57c10b translate_all_program_units
        ../../gcc-4.8-20130217/gcc/fortran/parse.c:4455
0x57c10b gfc_parse_file()
        ../../gcc-4.8-20130217/gcc/fortran/parse.c:4682
0x5b79f5 gfc_be_parse_file
        ../../gcc-4.8-20130217/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.


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

* [Bug fortran/56385] [OOP] ICE with allocatable function result in a procedure-pointer component
  2013-02-18 21:54 [Bug fortran/56385] New: ICE with allocatable function result in a type-bound procedure vladimir.fuka at gmail dot com
@ 2013-02-18 22:15 ` janus at gcc dot gnu.org
  2013-02-18 22:25 ` [Bug fortran/56385] [4.6/4.7/4.8 Regression] " dominiq at lps dot ens.fr
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu.org @ 2013-02-18 22:15 UTC (permalink / raw)
  To: gcc-bugs


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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-02-18
                 CC|                            |janus at gcc dot gnu.org
            Summary|ICE with allocatable        |[OOP] ICE with allocatable
                   |function result in a        |function result in a
                   |type-bound procedure        |procedure-pointer component
     Ever Confirmed|0                           |1

--- Comment #1 from janus at gcc dot gnu.org 2013-02-18 22:14:55 UTC ---
ICE confirmed with 4.6, 4.7 and trunk. Reduced test case:


module VolumeSources
  implicit none

  type :: TGeometricShape
  end type

  type :: TVolumeSourceBody
    class(TGeometricShape), allocatable :: GeometricShape
    procedure(scalar_flux_interface), pointer :: get_scalar_flux
  end type TVolumeSourceBody

  abstract interface
    function scalar_flux_interface(self) result(res)
      import
      real, allocatable :: res(:)
      class(TVolumeSourceBody), intent(in) :: self
    end function
  end interface

end module


Note: 'get_scalar_flux' is actually not a type-bound procedure, but a
procedure-pointer component.


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

* [Bug fortran/56385] [4.6/4.7/4.8 Regression] [OOP] ICE with allocatable function result in a procedure-pointer component
  2013-02-18 21:54 [Bug fortran/56385] New: ICE with allocatable function result in a type-bound procedure vladimir.fuka at gmail dot com
  2013-02-18 22:15 ` [Bug fortran/56385] [OOP] ICE with allocatable function result in a procedure-pointer component janus at gcc dot gnu.org
@ 2013-02-18 22:25 ` dominiq at lps dot ens.fr
  2013-02-19 15:21 ` janus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-02-18 22:25 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[OOP] ICE with allocatable  |[4.6/4.7/4.8 Regression]
                   |function result in a        |[OOP] ICE with allocatable
                   |procedure-pointer component |function result in a
                   |                            |procedure-pointer component

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-02-18 22:24:54 UTC ---
The test compiles with 4.5.3, but gives an ICE with 4.6.3. Revision 166367
(2010-11-05) is OK; revision 166401 (2010-11-06) gives the ICE, i.e.,
Author: janus
Date: Fri Nov  5 18:14:52 2010
New Revision: 166368

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166368
Log:
2010-11-05  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/45451
    PR fortran/46174
    * class.c (gfc_find_derived_vtab): Improved search for existing vtab.
    Add component '$copy' to vtype symbol for polymorphic deep copying.
    * expr.c (gfc_check_pointer_assign): Make sure the vtab is generated
    during resolution stage.
    * resolve.c (resolve_codes): Don't resolve code if namespace is already
    resolved.
    * trans-stmt.c (gfc_trans_allocate): Call '$copy' procedure for
    polymorphic ALLOCATE statements with SOURCE.

2010-11-05  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/45451
    PR fortran/46174
    * gfortran.dg/class_19.f03: Modified.
    * gfortran.dg/class_allocate_6.f03: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/class_allocate_6.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/class.c
    trunk/gcc/fortran/expr.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/class_19.f03


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

* [Bug fortran/56385] [4.6/4.7/4.8 Regression] [OOP] ICE with allocatable function result in a procedure-pointer component
  2013-02-18 21:54 [Bug fortran/56385] New: ICE with allocatable function result in a type-bound procedure vladimir.fuka at gmail dot com
  2013-02-18 22:15 ` [Bug fortran/56385] [OOP] ICE with allocatable function result in a procedure-pointer component janus at gcc dot gnu.org
  2013-02-18 22:25 ` [Bug fortran/56385] [4.6/4.7/4.8 Regression] " dominiq at lps dot ens.fr
@ 2013-02-19 15:21 ` janus at gcc dot gnu.org
  2013-02-21 12:27 ` janus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu.org @ 2013-02-19 15:21 UTC (permalink / raw)
  To: gcc-bugs


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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |janus at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #3 from janus at gcc dot gnu.org 2013-02-19 15:20:45 UTC ---
(In reply to comment #2)
> Author: janus
> Date: Fri Nov  5 18:14:52 2010
> New Revision: 166368

Mine, obviously (although I don't directly see how this commit is the cause for
the ICE).

In any case, it is easy to fix:

Index: gcc/fortran/trans-array.c
===================================================================
--- gcc/fortran/trans-array.c    (revision 195974)
+++ gcc/fortran/trans-array.c    (working copy)
@@ -7547,8 +7547,8 @@ structure_alloc_comps (gfc_symbol * der_type, tree
       called_dealloc_with_status = false;
       gfc_init_block (&tmpblock);

-      if (c->attr.allocatable
-          && (c->attr.dimension || c->attr.codimension))
+      if (c->attr.allocatable && (c->attr.dimension || c->attr.codimension)
+          && !c->attr.proc_pointer)
         {
           comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
                       decl, cdecl, NULL_TREE);
@@ -7730,7 +7730,8 @@ structure_alloc_comps (gfc_symbol * der_type, tree
           continue;
         }

-      if (c->attr.allocatable && !cmp_has_alloc_comps)
+      if (c->attr.allocatable && !c->attr.proc_pointer
+          && !cmp_has_alloc_comps)
         {
           rank = c->as ? c->as->rank : 0;
           tmp = gfc_duplicate_allocatable (dcmp, comp, ctype, rank);


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

* [Bug fortran/56385] [4.6/4.7/4.8 Regression] [OOP] ICE with allocatable function result in a procedure-pointer component
  2013-02-18 21:54 [Bug fortran/56385] New: ICE with allocatable function result in a type-bound procedure vladimir.fuka at gmail dot com
                   ` (2 preceding siblings ...)
  2013-02-19 15:21 ` janus at gcc dot gnu.org
@ 2013-02-21 12:27 ` janus at gcc dot gnu.org
  2013-02-22 19:48 ` janus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu.org @ 2013-02-21 12:27 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from janus at gcc dot gnu.org 2013-02-21 12:26:54 UTC ---
Author: janus
Date: Thu Feb 21 12:26:44 2013
New Revision: 196202

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196202
Log:
2013-02-21  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/56385
    * trans-array.c (structure_alloc_comps): Handle procedure-pointer
    components with allocatable result.

2013-02-21  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/56385
    * gfortran.dg/proc_ptr_comp_37.f90: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/proc_ptr_comp_37.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/56385] [4.6/4.7/4.8 Regression] [OOP] ICE with allocatable function result in a procedure-pointer component
  2013-02-18 21:54 [Bug fortran/56385] New: ICE with allocatable function result in a type-bound procedure vladimir.fuka at gmail dot com
                   ` (3 preceding siblings ...)
  2013-02-21 12:27 ` janus at gcc dot gnu.org
@ 2013-02-22 19:48 ` janus at gcc dot gnu.org
  2013-02-23 14:41 ` janus at gcc dot gnu.org
  2013-02-23 14:42 ` janus at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu.org @ 2013-02-22 19:48 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from janus at gcc dot gnu.org 2013-02-22 19:48:15 UTC ---
Author: janus
Date: Fri Feb 22 19:48:11 2013
New Revision: 196227

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196227
Log:
2013-02-22  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/56385
    * trans-array.c (structure_alloc_comps): Handle procedure-pointer
    components with allocatable result.

2013-02-22  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/56385
    * gfortran.dg/proc_ptr_comp_37.f90: New.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/proc_ptr_comp_37.f90
Modified:
    branches/gcc-4_7-branch/gcc/fortran/ChangeLog
    branches/gcc-4_7-branch/gcc/fortran/trans-array.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/56385] [4.6/4.7/4.8 Regression] [OOP] ICE with allocatable function result in a procedure-pointer component
  2013-02-18 21:54 [Bug fortran/56385] New: ICE with allocatable function result in a type-bound procedure vladimir.fuka at gmail dot com
                   ` (4 preceding siblings ...)
  2013-02-22 19:48 ` janus at gcc dot gnu.org
@ 2013-02-23 14:41 ` janus at gcc dot gnu.org
  2013-02-23 14:42 ` janus at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu.org @ 2013-02-23 14:41 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #6 from janus at gcc dot gnu.org 2013-02-23 14:40:57 UTC ---
Author: janus
Date: Sat Feb 23 14:40:49 2013
New Revision: 196237

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196237
Log:
2013-02-23  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/56385
    * trans-array.c (structure_alloc_comps): Handle procedure-pointer
    components with allocatable result.

2013-02-23  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/56385
    * gfortran.dg/proc_ptr_comp_37.f90: New.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/proc_ptr_comp_37.f90
Modified:
    branches/gcc-4_6-branch/gcc/fortran/ChangeLog
    branches/gcc-4_6-branch/gcc/fortran/trans-array.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/56385] [4.6/4.7/4.8 Regression] [OOP] ICE with allocatable function result in a procedure-pointer component
  2013-02-18 21:54 [Bug fortran/56385] New: ICE with allocatable function result in a type-bound procedure vladimir.fuka at gmail dot com
                   ` (5 preceding siblings ...)
  2013-02-23 14:41 ` janus at gcc dot gnu.org
@ 2013-02-23 14:42 ` janus at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: janus at gcc dot gnu.org @ 2013-02-23 14:42 UTC (permalink / raw)
  To: gcc-bugs


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

janus at gcc dot gnu.org changed:

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

--- Comment #7 from janus at gcc dot gnu.org 2013-02-23 14:42:07 UTC ---
Fixed on 4.6, 4.7 and trunk. Closing.

Thanks for the report!


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

end of thread, other threads:[~2013-02-23 14:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-18 21:54 [Bug fortran/56385] New: ICE with allocatable function result in a type-bound procedure vladimir.fuka at gmail dot com
2013-02-18 22:15 ` [Bug fortran/56385] [OOP] ICE with allocatable function result in a procedure-pointer component janus at gcc dot gnu.org
2013-02-18 22:25 ` [Bug fortran/56385] [4.6/4.7/4.8 Regression] " dominiq at lps dot ens.fr
2013-02-19 15:21 ` janus at gcc dot gnu.org
2013-02-21 12:27 ` janus at gcc dot gnu.org
2013-02-22 19:48 ` janus at gcc dot gnu.org
2013-02-23 14:41 ` janus at gcc dot gnu.org
2013-02-23 14:42 ` 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).