public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/66366] New: ICE on invalid with non-allocatable CLASS variable [OOP]
@ 2015-06-01 19:19 abensonca at gmail dot com
  2015-06-03 13:46 ` [Bug fortran/66366] " dominiq at lps dot ens.fr
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: abensonca at gmail dot com @ 2015-06-01 19:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66366
           Summary: ICE on invalid with non-allocatable CLASS variable
                    [OOP]
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: abensonca at gmail dot com
  Target Milestone: ---

The following invalid code causes an ICE with gfortran 6.0.0 223992:

module bug

  type :: t1d
   contains
     procedure :: interpolate => interp
  end type t1d

  type :: tff
     class(t1d) :: transfer
  end type tff

contains

  double precision function interp(self)
    implicit none
    class(t1d), intent(inout) :: self
    return
  end function interp

  double precision function fvb(self)
    implicit none
    class(tff), intent(inout) :: self
    fvb=self%transfer%interpolate()
    return
  end function fvb

end module bug

$ gfortran -v                                                                  
                              Using built-in specs.
COLLECT_GCC=/opt/gcc-trunk/bin/gfortran
COLLECT_LTO_WRAPPER=/opt/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/opt/gcc-trunk
--enable-languages=c,c++,fortran --disable-multilib
Thread model: posix
gcc version 6.0.0 20150517 (experimental) (GCC) 


 gfortran -c bug.F90 -o bug.o
bug.F90:9:27:

      class(t1d) :: transfer
                            1
Error: Component ‘transfer’ with CLASS at (1) must be allocatable or pointer
f951: internal compiler error: in check_typebound_baseobject, at
fortran/resolve.c:5521
0x637465 check_typebound_baseobject
        ../../gcc-trunk/gcc/fortran/resolve.c:5521
0x63791e resolve_compcall
        ../../gcc-trunk/gcc/fortran/resolve.c:5812
0x63404e resolve_typebound_function
        ../../gcc-trunk/gcc/fortran/resolve.c:5954
0x63404e gfc_resolve_expr(gfc_expr*)
        ../../gcc-trunk/gcc/fortran/resolve.c:6265
0x63a8b6 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/resolve.c:10095
0x63d2d2 resolve_codes
        ../../gcc-trunk/gcc/fortran/resolve.c:15055
0x63d1d7 resolve_codes
        ../../gcc-trunk/gcc/fortran/resolve.c:15040
0x63d3b2 gfc_resolve(gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/resolve.c:15083
0x628cb6 gfc_parse_file()
        ../../gcc-trunk/gcc/fortran/parse.c:5477
0x669445 gfc_be_parse_file
        ../../gcc-trunk/gcc/fortran/f95-lang.c:228
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.


The code is invalid as the CLASS variable in "tff" is neither allocatable nor a
pointer. The call to the "interpolate" function of the "t1d" class seems to be
necessary to trigger the ICE.
>From gcc-bugs-return-487747-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jun 01 19:40:35 2015
Return-Path: <gcc-bugs-return-487747-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 101826 invoked by alias); 1 Jun 2015 19:40:34 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 101781 invoked by uid 48); 1 Jun 2015 19:40:31 -0000
From: "dimhen at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/66354] [UBSAN] stl_algobase.h:708:7: runtime error: null pointer passed as argument
Date: Mon, 01 Jun 2015 19:40:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dimhen at gmail dot com
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: redi at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66354-4-3SYY6SIBF6@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66354-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66354-4@http.gcc.gnu.org/bugzilla/>
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: 2015-06/txt/msg00079.txt.bz2
Content-length: 431

https://gcc.gnu.org/bugzilla/show_bug.cgi?idf354

--- Comment #4 from Dmitry G. Dyachenko <dimhen at gmail dot com> ---
(In reply to Jonathan Wakely from comment #1)
> (In reply to Dmitry G. Dyachenko from comment #0)
> > Sorry, I have no compact testcase.
>
> Could you at least use -fno-sanitize-recover=undefined and look at the stack
> trace where it happens?

Alas, there are no stack with -fno-sanitize-recover=undefined


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

* [Bug fortran/66366] ICE on invalid with non-allocatable CLASS variable [OOP]
  2015-06-01 19:19 [Bug fortran/66366] New: ICE on invalid with non-allocatable CLASS variable [OOP] abensonca at gmail dot com
@ 2015-06-03 13:46 ` dominiq at lps dot ens.fr
  2015-06-22 22:54 ` abensonca at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-06-03 13:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |error-recovery,
                   |                            |ice-on-invalid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-06-03
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
With gfortran 4.5.4 I get

pr66366.f90:9.27:

     class(t1d) :: transfer
                           1
Error: Component 'transfer' with CLASS at (1) must be allocatable or pointer

twice, from 4.6 to 4.8, I get a segmentation fault, and from 4.9 to trunk 6.0,
I get the ICE after the error.


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

* [Bug fortran/66366] ICE on invalid with non-allocatable CLASS variable [OOP]
  2015-06-01 19:19 [Bug fortran/66366] New: ICE on invalid with non-allocatable CLASS variable [OOP] abensonca at gmail dot com
  2015-06-03 13:46 ` [Bug fortran/66366] " dominiq at lps dot ens.fr
@ 2015-06-22 22:54 ` abensonca at gmail dot com
  2015-06-22 22:58 ` abensonca at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: abensonca at gmail dot com @ 2015-06-22 22:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Benson <abensonca at gmail dot com> ---
This reduced test case produces an ICE with similar backtrace, although it
doesn't share the problem of having a non-allocatable/pointer CLASS variable
(as far as I can tell):

module sps
  type :: spsf
  end type spsf
  type :: h5
   contains
     procedure :: c => hC
  end type h5
contains
  subroutine frf()
    type(h5) :: spsf
    call spsf%c()
  end subroutine frf
  subroutine hC(s)
    class(h5), intent(inout) :: s
  end subroutine hC
end module sps


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

* [Bug fortran/66366] ICE on invalid with non-allocatable CLASS variable [OOP]
  2015-06-01 19:19 [Bug fortran/66366] New: ICE on invalid with non-allocatable CLASS variable [OOP] abensonca at gmail dot com
  2015-06-03 13:46 ` [Bug fortran/66366] " dominiq at lps dot ens.fr
  2015-06-22 22:54 ` abensonca at gmail dot com
@ 2015-06-22 22:58 ` abensonca at gmail dot com
  2021-01-08 20:37 ` [Bug fortran/66366] [OOP] ICE on invalid with non-allocatable CLASS variable anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: abensonca at gmail dot com @ 2015-06-22 22:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Benson <abensonca at gmail dot com> ---
Note the name conflict between:

  type :: spsf

and

    type(h5) :: spsf

in the previous comment. Changing the name of either to make them distinct
removes the ICE.


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

* [Bug fortran/66366] [OOP] ICE on invalid with non-allocatable CLASS variable
  2015-06-01 19:19 [Bug fortran/66366] New: ICE on invalid with non-allocatable CLASS variable [OOP] abensonca at gmail dot com
                   ` (2 preceding siblings ...)
  2015-06-22 22:58 ` abensonca at gmail dot com
@ 2021-01-08 20:37 ` anlauf at gcc dot gnu.org
  2021-01-08 20:43 ` anlauf at gcc dot gnu.org
  2021-05-14 10:02 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-01-08 20:37 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #11 from anlauf at gcc dot gnu.org ---
(In reply to janus from comment #5)
> The original problem in comment #0 is fixed with r242351.
> 
> The ICE on comment #2 is a separate issue and still persists.

Adding an IMPLICIT NONE to comment#2, we get a strange error (rejects-valid).

module sps
  implicit none
  type :: spsf
  end type spsf
  type :: h5
   contains
     procedure :: c => hC
  end type h5
contains
  subroutine hC(s)
    class(h5), intent(inout) :: s
  end subroutine hC
  subroutine frf()
    type(h5) :: spsf
    call spsf%c()
  end subroutine frf
end module sps


pr66366-c2.f90:3:14:

    3 |   type :: spsf
      |              1
Error: Symbol 'spsf' at (1) has no IMPLICIT type

The error vanishes if the typebound procedure is removed from the type
declaration and the corresponding typebound call.

Maybe close this one and open a new one about typebound procedures (or merge)?

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

* [Bug fortran/66366] [OOP] ICE on invalid with non-allocatable CLASS variable
  2015-06-01 19:19 [Bug fortran/66366] New: ICE on invalid with non-allocatable CLASS variable [OOP] abensonca at gmail dot com
                   ` (3 preceding siblings ...)
  2021-01-08 20:37 ` [Bug fortran/66366] [OOP] ICE on invalid with non-allocatable CLASS variable anlauf at gcc dot gnu.org
@ 2021-01-08 20:43 ` anlauf at gcc dot gnu.org
  2021-05-14 10:02 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-01-08 20:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from anlauf at gcc dot gnu.org ---
(In reply to anlauf from comment #11)
> The error vanishes if the typebound procedure is removed from the type
> declaration and the corresponding typebound call.

Or renaming the local instance:

  subroutine frf()
    type(h5) :: xxx
    call xxx%c()
  end subroutine frf

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

* [Bug fortran/66366] [OOP] ICE on invalid with non-allocatable CLASS variable
  2015-06-01 19:19 [Bug fortran/66366] New: ICE on invalid with non-allocatable CLASS variable [OOP] abensonca at gmail dot com
                   ` (4 preceding siblings ...)
  2021-01-08 20:43 ` anlauf at gcc dot gnu.org
@ 2021-05-14 10:02 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-14 10:02 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
   Target Milestone|8.5                         |---

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

end of thread, other threads:[~2021-05-14 10:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-01 19:19 [Bug fortran/66366] New: ICE on invalid with non-allocatable CLASS variable [OOP] abensonca at gmail dot com
2015-06-03 13:46 ` [Bug fortran/66366] " dominiq at lps dot ens.fr
2015-06-22 22:54 ` abensonca at gmail dot com
2015-06-22 22:58 ` abensonca at gmail dot com
2021-01-08 20:37 ` [Bug fortran/66366] [OOP] ICE on invalid with non-allocatable CLASS variable anlauf at gcc dot gnu.org
2021-01-08 20:43 ` anlauf at gcc dot gnu.org
2021-05-14 10:02 ` jakub 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).