public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/51052] New: Internal compiler error in gfc_conv_component
@ 2011-11-09 11:18 arjen.markus at deltares dot nl
  2011-11-09 13:23 ` [Bug fortran/51052] [OOP] " burnus at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: arjen.markus at deltares dot nl @ 2011-11-09 11:18 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51052
           Summary: Internal compiler error in gfc_conv_component
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: arjen.markus@deltares.nl


Created attachment 25767
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25767
Compressed tar file with two source files.

The attached program source causes the compiler to stop with the message:

particles.f90: In function 'position_oil_particle':
particles.f90:142:0: internal compiler error: in gfc_conv_component_ref, at
fortran/trans-expr.c:523
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

The version information of the compiler is:

Built by Equation Solution <http://www.Equation.com>.
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=d:/gcc4.6.2/bin/../libexec/gcc/i686-pc-mingw32/4.6.2/lto-wrapper.exe
Target: i686-pc-mingw32
Configured with: ../gcc-4.6.2-mingw/configure --host=i686-pc-mingw32
--build=x86_64-unknown-linux-gnu --target=i686-pc-mingw32
--prefix=/home/gfortran/gcc-home/binary/mingw32/native/x86_32/gcc/4.6.2
--with-gcc --with-gnu-as --with-gnu-ld --with-host-libstdcxx='-lstdc++ -lsupc++
-lm' --with-ppl=/home/gfortran/gcc-home/binary/mingw32/native/x86_32/ppl
--with-cloog=/home/gfortran/gcc-home/binary/mingw32/native/x86_32/cloog
--with-gmp=/home/gfortran/gcc-home/binary/mingw32/native/x86_32/gmp
--with-mpfr=/home/gfortran/gcc-home/binary/mingw32/native/x86_32/mpfr
--with-mpc=/home/gfortran/gcc-home/binary/mingw32/native/x86_32/mpc
--with-sysroot=/home/gfortran/gcc-home/binary/mingw32/cross/x86_32/gcc/4.6.2
--disable-shared --disable-nls --disable-tls --disable-win32-registry
--enable-libquadmath-support --enable-libquadmath
--enable-languages=c,c++,fortran --enable-libgomp --enable-threads=win32
--enable-lto --enable-static --enable-shared=lto-plugin --enable-plugins
--enable-ld=yes --enable-cloog-backend=ppl
Thread model: win32
gcc version 4.6.2 (GCC) 

The command I used to compile and link the program was:

gfortran -o particles points2d3d.f90 particles.f90


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

* [Bug fortran/51052] [OOP] Internal compiler error in gfc_conv_component
  2011-11-09 11:18 [Bug fortran/51052] New: Internal compiler error in gfc_conv_component arjen.markus at deltares dot nl
@ 2011-11-09 13:23 ` burnus at gcc dot gnu.org
  2011-11-09 13:52 ` janus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-11-09 13:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |janus at gcc dot gnu.org
            Summary|Internal compiler error in  |[OOP] Internal compiler
                   |gfc_conv_component          |error in gfc_conv_component

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-11-09 13:03:56 UTC ---
I can confirm the ICE - I get the same with 4.6 and 4.7.

Note, however, that with GCC 4.7 one has to fix the following coding problem
before one can enjoy the internal error:

particles.f90:102.17:
        procedure, pass(particle) &
                 1
Error: Argument mismatch for the overriding procedure 'new_position' at (1):
INTENT mismatch in argument 'particle'


The issue seems to occur for:

    position = position + deltt * velocity + &
               random_displacement

in subroutine position_oil_particle if particles.f90.


The ICE is in gfc_conv_component_ref for:

  if (DECL_FIELD_CONTEXT (field) != TREE_TYPE (decl))
    {
      tree f2 = c->norestrict_decl;
      if (!f2 || DECL_FIELD_CONTEXT (f2) != TREE_TYPE (decl))
        for (f2 = TYPE_FIELDS (TREE_TYPE (decl)); f2; f2 = DECL_CHAIN (f2))

and fails for "TYPE_FIELDS (TREE_TYPE (decl))" with: "internal compiler error:
tree check: expected record_type or union_type or qual_union_type, have
function_type in gfc_conv_component_ref, at fortran/trans-expr.c:556"

This is called by gfc_conv_variable, which is called by get_proc_ptr_comp. The
expression looks as follow

"position%__class_points2d3d_Point2d_p%__vtype_points2d3d_Point2d%__class_points2d3d_Point2d_a%__vtype_points2d3d_Point2d"

At least that's what I get when printing expr->symtree->n.sym->name and
expr->ref{,->next,->next->next,...}->u.c.sym->name.


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

* [Bug fortran/51052] [OOP] Internal compiler error in gfc_conv_component
  2011-11-09 11:18 [Bug fortran/51052] New: Internal compiler error in gfc_conv_component arjen.markus at deltares dot nl
  2011-11-09 13:23 ` [Bug fortran/51052] [OOP] " burnus at gcc dot gnu.org
@ 2011-11-09 13:52 ` janus at gcc dot gnu.org
  2011-11-09 14:08 ` janus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2011-11-09 13:52 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-11-09
     Ever Confirmed|0                           |1

--- Comment #2 from janus at gcc dot gnu.org 2011-11-09 13:45:12 UTC ---
Here is an very much reduced (and corrected) test case. This is another case of
"non-trivial polymorphic operands", cf. PR46262 and PR46328.

Arjen, why do you need those workarounds for 4.6?



module points2d3d

  implicit none

  type point2d
      real :: x, y
  contains
      procedure               :: add_vector_2d
      procedure               :: assign_2d
      generic                 :: operator(+)     => add_vector_2d
      generic                 :: assignment(=)   => assign_2d
  end type

contains

  subroutine assign_2d( point1, point2 )
    class(point2d), intent(inout) :: point1
    class(point2d), intent(in)    :: point2
    point1%x = point2%x
    point1%y = point2%y
  end subroutine

  function add_vector_2d( point, vector )
    class(point2d), intent(in)  :: point, vector
    class(point2d), allocatable :: add_vector_2d
    ! Workaround for gfortran 4.6
    if ( allocated( add_vector_2d ) ) then
        deallocate( add_vector_2d )
    endif
    allocate( add_vector_2d )
    add_vector_2d%x = point%x + vector%x
    add_vector_2d%y = point%y + vector%y
  end function

end module points2d3d



  use points2d3d
  implicit none

contains

  subroutine position_oil_particle()
    class(point2d), pointer      :: position
    type(point2d)                :: p1, p2
    position = position + p1 + p2
  end subroutine

end


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

* [Bug fortran/51052] [OOP] Internal compiler error in gfc_conv_component
  2011-11-09 11:18 [Bug fortran/51052] New: Internal compiler error in gfc_conv_component arjen.markus at deltares dot nl
  2011-11-09 13:23 ` [Bug fortran/51052] [OOP] " burnus at gcc dot gnu.org
  2011-11-09 13:52 ` janus at gcc dot gnu.org
@ 2011-11-09 14:08 ` janus at gcc dot gnu.org
  2011-11-09 15:34 ` janus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2011-11-09 14:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from janus at gcc dot gnu.org 2011-11-09 13:56:39 UTC ---
(In reply to comment #3)
> that may be from an older version of 4.6 (I now have 4.6.2,
> previously 4.6.1). When running a program that used that
> module, I got error messages about trying to allocate and
> already allocated array.

ah, I guess that was PR50225 (which was fixed only in 4.7, so 4.6.2 probably
does not help here).


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

* [Bug fortran/51052] [OOP] Internal compiler error in gfc_conv_component
  2011-11-09 11:18 [Bug fortran/51052] New: Internal compiler error in gfc_conv_component arjen.markus at deltares dot nl
                   ` (2 preceding siblings ...)
  2011-11-09 14:08 ` janus at gcc dot gnu.org
@ 2011-11-09 15:34 ` janus at gcc dot gnu.org
  2012-01-02 12:49 ` pault at gcc dot gnu.org
  2012-01-02 13:00 ` pault at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2011-11-09 15:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from janus at gcc dot gnu.org 2011-11-09 15:20:55 UTC ---
(In reply to comment #6)
> yes, that is the one :). I am really examining the borders of
> gfortran at the moment.

Right. Thanks for your continued bug reporting. That sort of user feedback
helps us a lot.


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

* [Bug fortran/51052] [OOP] Internal compiler error in gfc_conv_component
  2011-11-09 11:18 [Bug fortran/51052] New: Internal compiler error in gfc_conv_component arjen.markus at deltares dot nl
                   ` (3 preceding siblings ...)
  2011-11-09 15:34 ` janus at gcc dot gnu.org
@ 2012-01-02 12:49 ` pault at gcc dot gnu.org
  2012-01-02 13:00 ` pault at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu.org @ 2012-01-02 12:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Paul Thomas <pault at gcc dot gnu.org> 2012-01-02 12:46:16 UTC ---
Author: pault
Date: Mon Jan  2 12:46:08 2012
New Revision: 182796

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182796
Log:
2012-01-02  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/51529
    * trans-array.c (gfc_array_allocate): Null allocated memory of
    newly allocted class arrays.

    PR fortran/46262
    PR fortran/46328
    PR fortran/51052
    * interface.c(build_compcall_for_operator): Add a type to the
    expression.
    * trans-expr.c (conv_base_obj_fcn_val): New function.
    (gfc_conv_procedure_call): Use base_expr to detect non-variable
    base objects and, ensuring that there is a temporary variable,
    build up the typebound call using conv_base_obj_fcn_val.
    (gfc_trans_class_assign): Pick out class procedure pointer
    assignments and do the assignment with no further prcessing.
    (gfc_trans_class_array_init_assign, gfc_trans_class_init_assign
    gfc_trans_class_assign): Move to top of file.
    * gfortran.h : Add 'base_expr' field to gfc_expr.
    * resolve.c (get_declared_from_expr): Add 'types' argument to
    switch checking of derived types on or off.
    (resolve_typebound_generic_call): Set the new argument.
    (resolve_typebound_function, resolve_typebound_subroutine):
    Set 'types' argument for get_declared_from_expr appropriately.
    Identify base expression, if not a variable, in the argument
    list of class valued calls. Assign it to the 'base_expr' field
    of the final expression. Strip away all references after the
    last class reference.


2012-01-02  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/46262
    PR fortran/46328
    PR fortran/51052
    * gfortran.dg/typebound_operator_7.f03: New.
    * gfortran.dg/typebound_operator_8.f03: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/typebound_operator_7.f03
    trunk/gcc/testsuite/gfortran.dg/typebound_operator_8.f03
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/dump-parse-tree.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/interface.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/51052] [OOP] Internal compiler error in gfc_conv_component
  2011-11-09 11:18 [Bug fortran/51052] New: Internal compiler error in gfc_conv_component arjen.markus at deltares dot nl
                   ` (4 preceding siblings ...)
  2012-01-02 12:49 ` pault at gcc dot gnu.org
@ 2012-01-02 13:00 ` pault at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu.org @ 2012-01-02 13:00 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

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

--- Comment #9 from Paul Thomas <pault at gcc dot gnu.org> 2012-01-02 13:00:36 UTC ---
Fixed on trunk.

Thanks for the report

Paul


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

end of thread, other threads:[~2012-01-02 13:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-09 11:18 [Bug fortran/51052] New: Internal compiler error in gfc_conv_component arjen.markus at deltares dot nl
2011-11-09 13:23 ` [Bug fortran/51052] [OOP] " burnus at gcc dot gnu.org
2011-11-09 13:52 ` janus at gcc dot gnu.org
2011-11-09 14:08 ` janus at gcc dot gnu.org
2011-11-09 15:34 ` janus at gcc dot gnu.org
2012-01-02 12:49 ` pault at gcc dot gnu.org
2012-01-02 13:00 ` pault 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).