public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/67044] New: ICE on valid code
@ 2015-07-28 15:22 mrestelli at gmail dot com
  2015-08-29 12:57 ` [Bug fortran/67044] " dominiq at lps dot ens.fr
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: mrestelli at gmail dot com @ 2015-07-28 15:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67044
           Summary: ICE on valid code
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mrestelli at gmail dot com
  Target Milestone: ---

I see and ICE with the attached code.

$ gfortran -c ice.f90 
ice.f90:44:0:

    allocate( z%f , source=unpck(x)+unpck(y) )
^
internal compiler error: in aggregate_value_p, bei function.c:2052
0x819313 aggregate_value_p(tree_node const*, tree_node const*)
        gcc/function.c:2052
0x6fa71a expand_call(tree_node*, rtx_def*, int)
        gcc/calls.c:2578
0x7dc16a expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        gcc/expr.c:10362
0x7e55c6 store_expr_with_bounds(tree_node*, rtx_def*, int, bool, tree_node*)
        gcc/expr.c:5398
0x7e6aec expand_assignment(tree_node*, tree_node*, bool)
        gcc/expr.c:5170
0x709486 expand_call_stmt
        gcc/cfgexpand.c:2350
0x709486 expand_gimple_stmt_1
        gcc/cfgexpand.c:3239
0x709486 expand_gimple_stmt
        gcc/cfgexpand.c:3400
0x70aa91 expand_gimple_basic_block
        gcc/cfgexpand.c:5412
0x70ef06 execute
        gcc/cfgexpand.c:6023


$ gfortran --version
GNU Fortran (GCC) 6.0.0 20150727 (experimental)

(I see the same problem with versions 5.1.0 and 4.9.2)


module m

 implicit none

 public :: t_base, unpck

 private

 type, abstract :: t_base
 contains
  private
  generic, public :: operator(+) => add
  procedure(i_add), pass(x), deferred :: add
 end type t_base

 type, extends(t_base) :: t_cont
  class(t_base), allocatable :: f
 contains
  procedure, pass(x) :: add => cont_add
 end type t_cont

 abstract interface
  elemental function i_add(x,y) result(z)
   import :: t_base, t_cont
   implicit none
   class(t_base), intent(in) :: x, y
   type(t_cont) :: z
  end function i_add
 end interface

contains

 pure recursive function unpck(x) result(y)
  class(t_base), intent(in) :: x
  class(t_base), allocatable :: y

 end function unpck

 elemental function cont_add(x,y) result(z)
  class(t_cont), intent(in) :: x
  class(t_base),  intent(in) :: y
  type(t_cont) :: z

   allocate( z%f , source=unpck(x)+unpck(y) )

 end function cont_add

end module m


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

* [Bug fortran/67044] ICE on valid code
  2015-07-28 15:22 [Bug fortran/67044] New: ICE on valid code mrestelli at gmail dot com
@ 2015-08-29 12:57 ` dominiq at lps dot ens.fr
  2015-08-29 13:28 ` [Bug fortran/67044] ICE: in aggregate_value_p, at function.c:2068 dominiq at lps dot ens.fr
  2015-10-25 12:29 ` vehre at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-08-29 12:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-08-29
                 CC|                            |mikael at gcc dot gnu.org,
                   |                            |pault at gcc dot gnu.org,
                   |                            |vehre at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed from 4.8 up to trunk (6.0 configured with --enable-checking=release).
When 6.0 is configured with the default value of --enable-checking, the ICE is

internal compiler error: tree check: expected function_type or method_type,
have pointer_type in gimplify_call_expr, at gimplify.c:2391

The ICE with 4.7 is

pr67044.f90: In function 'cont_add':
pr67044.f90:39:0: error: non-function in gimple call
D.1930 = unpck.4 (&D.1900, &D.1901);

pr67044.f90:39: confused by earlier errors, bailing out

and with 4.6

pr67044.f90: In function 'cont_add':
pr67044.f90:49:0: internal compiler error: in cgraph_node, at cgraph.c:495

The code compiles if the line

   allocate( z%f , source=unpck(x)+unpck(y) )

is replaced with

   allocate( z%f , source=unpck(x) )


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

* [Bug fortran/67044] ICE: in aggregate_value_p, at function.c:2068
  2015-07-28 15:22 [Bug fortran/67044] New: ICE on valid code mrestelli at gmail dot com
  2015-08-29 12:57 ` [Bug fortran/67044] " dominiq at lps dot ens.fr
@ 2015-08-29 13:28 ` dominiq at lps dot ens.fr
  2015-10-25 12:29 ` vehre at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-08-29 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
            Summary|ICE on valid code           |ICE: in aggregate_value_p,
                   |                            |at function.c:2068
      Known to fail|                            |4.9.3, 5.2.0, 6.0

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Changing the summary to something making duplicates easier to spot.


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

* [Bug fortran/67044] ICE: in aggregate_value_p, at function.c:2068
  2015-07-28 15:22 [Bug fortran/67044] New: ICE on valid code mrestelli at gmail dot com
  2015-08-29 12:57 ` [Bug fortran/67044] " dominiq at lps dot ens.fr
  2015-08-29 13:28 ` [Bug fortran/67044] ICE: in aggregate_value_p, at function.c:2068 dominiq at lps dot ens.fr
@ 2015-10-25 12:29 ` vehre at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vehre at gcc dot gnu.org @ 2015-10-25 12:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from vehre at gcc dot gnu.org ---
Author: vehre
Date: Sun Oct 25 12:28:57 2015
New Revision: 229294

URL: https://gcc.gnu.org/viewcvs?rev=229294&root=gcc&view=rev
Log:
gcc/fortran/ChangeLog:

2015-10-25  Andre Vehreschild  <vehre@gcc.gnu.org>

        PR fortran/66927
        PR fortran/67044
        * trans-array.c (build_array_ref): Modified call to 
        gfc_get_class_array_ref to adhere to new interface.
        (gfc_conv_expr_descriptor): For one-based arrays that
        are filled by a loop starting at one the start index of the
        source array has to be mangled into the offset.
        * trans-expr.c (gfc_get_class_array_ref): When the tree to get
        the _data component is present already, add a way to supply it.
        (gfc_copy_class_to_class): Allow to copy to a derived type also.
        * trans-stmt.c (gfc_trans_allocate): Do not conv_expr_descriptor
        for functions returning a class or derived object. Get the
        reference instead.
        * trans.h: Interface change of gfc_get_class_array_ref.

gcc/testsuite/ChangeLog:

2015-10-25  Andre Vehreschild  <vehre@gmx.de>

        PR fortran/66927
        PR fortran/67044
        * gfortran.dg/allocate_with_source_10.f08: New test.
        * gfortran.dg/allocate_with_source_11.f08: New test.
        * gfortran.dg/class_array_15.f03: Changed count of expected
        _builtin_frees to 11. One step of temporaries is spared, therefore
        the allocatable component of that temporary is not to be freeed.


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/fortran/trans.h
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/class_array_15.f03


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

end of thread, other threads:[~2015-10-25 12:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-28 15:22 [Bug fortran/67044] New: ICE on valid code mrestelli at gmail dot com
2015-08-29 12:57 ` [Bug fortran/67044] " dominiq at lps dot ens.fr
2015-08-29 13:28 ` [Bug fortran/67044] ICE: in aggregate_value_p, at function.c:2068 dominiq at lps dot ens.fr
2015-10-25 12:29 ` 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).