public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/65889] New: ICE on invalid(?) with sizeof polymorphic variable [OOP]
@ 2015-04-25 16:29 abensonca at gmail dot com
  2015-09-08 10:36 ` [Bug fortran/65889] " dominiq at lps dot ens.fr
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: abensonca at gmail dot com @ 2015-04-25 16:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65889
           Summary: ICE on invalid(?) with sizeof polymorphic 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

The following testcase causes an ICE with gfortran 6.0 (r222432):

module m
  type n
  end type n
contains
  subroutine g(ns)
    class(n), intent(out), allocatable, dimension(:) :: ns
    write (0,*) sizeof(ns)
  end subroutine g
end module m

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

$ gfortran -c small.f90 -o small.o                                              
small.f90:7:0:

     write (0,*) sizeof(ns)
 1
internal compiler error: tree check: expected tree that contains ‘decl common’
structure, have ‘indirect_ref’ in gfc_conv_intrinsic_sizeof, at
fortran/trans-intrinsic.c:5928
0xdd8994 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ../../gcc-trunk/gcc/tree.c:9471
0x706628 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
        ../../gcc-trunk/gcc/tree.h:2960
0x706628 gfc_conv_intrinsic_sizeof
        ../../gcc-trunk/gcc/fortran/trans-intrinsic.c:5928
0x70e24f gfc_conv_intrinsic_function(gfc_se*, gfc_expr*)
        ../../gcc-trunk/gcc/fortran/trans-intrinsic.c:8185
0x6ece32 gfc_conv_expr(gfc_se*, gfc_expr*)
        ../../gcc-trunk/gcc/fortran/trans-expr.c:7361
0x6f3685 gfc_conv_expr_reference(gfc_se*, gfc_expr*)
        ../../gcc-trunk/gcc/fortran/trans-expr.c:7496
0x7150c1 gfc_trans_transfer(gfc_code*)
        ../../gcc-trunk/gcc/fortran/trans-io.c:2394
0x6b18d7 trans_code
        ../../gcc-trunk/gcc/fortran/trans.c:1885
0x7121b0 build_dt
        ../../gcc-trunk/gcc/fortran/trans-io.c:1921
0x6b18f7 trans_code
        ../../gcc-trunk/gcc/fortran/trans.c:1857
0x6de1df gfc_generate_function_code(gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/trans-decl.c:5896
0x6b6149 gfc_generate_module_code(gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/trans.c:2053
0x66e3ad translate_all_program_units
        ../../gcc-trunk/gcc/fortran/parse.c:5328
0x66e3ad gfc_parse_file()
        ../../gcc-trunk/gcc/fortran/parse.c:5538
0x6ae745 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.

It's not clear to me if this is invalid code - see the discussion for PR57305
on how SIZEOF() should work on variables without a declared type. I checked
that the testcase for PR57305 still compiles successfully.

Wrapping the call to SIZEOF() inside a "SELECT TYPE" block removes the ICE. 

Replacing SIZEOF() with STORAGE_SIZE() (as suggested in PR57305) results in a
slightly different backtrace:

$ gfortran -c small.f90 -o small.o
small.f90:7:0:

     write (0,*) storage_size(ns)
 1
internal compiler error: Segmentation fault
0xb7572f crash_signal
        ../../gcc-trunk/gcc/toplev.c:383
0x70689e gfc_conv_intrinsic_storage_size
        ../../gcc-trunk/gcc/fortran/trans-intrinsic.c:6067
0x70e8b9 gfc_conv_intrinsic_function(gfc_se*, gfc_expr*)
        ../../gcc-trunk/gcc/fortran/trans-intrinsic.c:8189
0x6ece32 gfc_conv_expr(gfc_se*, gfc_expr*)
        ../../gcc-trunk/gcc/fortran/trans-expr.c:7361
0x6f3685 gfc_conv_expr_reference(gfc_se*, gfc_expr*)
        ../../gcc-trunk/gcc/fortran/trans-expr.c:7496
0x7150c1 gfc_trans_transfer(gfc_code*)
        ../../gcc-trunk/gcc/fortran/trans-io.c:2394
0x6b18d7 trans_code
        ../../gcc-trunk/gcc/fortran/trans.c:1885
0x7121b0 build_dt
        ../../gcc-trunk/gcc/fortran/trans-io.c:1921
0x6b18f7 trans_code
        ../../gcc-trunk/gcc/fortran/trans.c:1857
0x6de1df gfc_generate_function_code(gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/trans-decl.c:5896
0x6b6149 gfc_generate_module_code(gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/trans.c:2053
0x66e3ad translate_all_program_units
        ../../gcc-trunk/gcc/fortran/parse.c:5328
0x66e3ad gfc_parse_file()
        ../../gcc-trunk/gcc/fortran/parse.c:5538
0x6ae745 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.
>From gcc-bugs-return-484633-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Apr 25 16:33:04 2015
Return-Path: <gcc-bugs-return-484633-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 95572 invoked by alias); 25 Apr 2015 16:33:04 -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 95457 invoked by uid 48); 25 Apr 2015 16:33:00 -0000
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/65888] Need a way to disable copy relocations
Date: Sat, 25 Apr 2015 16:33:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hjl.tools at gmail dot com
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution
Message-ID: <bug-65888-4-9SYM54PfcQ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65888-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65888-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-04/txt/msg02185.txt.bz2
Content-length: 478

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
Dup.

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


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

* [Bug fortran/65889] ICE on invalid(?) with sizeof polymorphic variable [OOP]
  2015-04-25 16:29 [Bug fortran/65889] New: ICE on invalid(?) with sizeof polymorphic variable [OOP] abensonca at gmail dot com
@ 2015-09-08 10:36 ` dominiq at lps dot ens.fr
  2015-09-13  0:08 ` [Bug fortran/65889] [6 Regressions] [OOP] ICE with sizeof a polymorphic variable dominiq at lps dot ens.fr
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-09-08 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2015-09-08
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed for trunk (6.0). The code compiles with 4.8 up to 5.2 and AFAICT
gives a sensible result. Thus this PR is a regression if the use of sizeof is
valid. If it is invalid then the behavior of 4.9 and 5.2 is wrong.


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

* [Bug fortran/65889] [6 Regressions] [OOP] ICE with sizeof a polymorphic variable.
  2015-04-25 16:29 [Bug fortran/65889] New: ICE on invalid(?) with sizeof polymorphic variable [OOP] abensonca at gmail dot com
  2015-09-08 10:36 ` [Bug fortran/65889] " dominiq at lps dot ens.fr
@ 2015-09-13  0:08 ` dominiq at lps dot ens.fr
  2015-10-06 15:06 ` vehre at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-09-13  0:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
                 CC|                            |vehre at gcc dot gnu.org
            Summary|ICE on invalid(?) with      |[6 Regressions] [OOP] ICE
                   |sizeof polymorphic variable |with sizeof a polymorphic
                   |[OOP]                       |variable.

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
AFAIU PR57305 it is about the sizeof CLASS(*) and I don't see why the code
should be invalid. 

The ICE occurred between revisions r222352 (2015-04-23, no ICE) and r222398
(2015-04-24, ICE), likely r222361 for pr60322.


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

* [Bug fortran/65889] [6 Regressions] [OOP] ICE with sizeof a polymorphic variable.
  2015-04-25 16:29 [Bug fortran/65889] New: ICE on invalid(?) with sizeof polymorphic variable [OOP] abensonca at gmail dot com
  2015-09-08 10:36 ` [Bug fortran/65889] " dominiq at lps dot ens.fr
  2015-09-13  0:08 ` [Bug fortran/65889] [6 Regressions] [OOP] ICE with sizeof a polymorphic variable dominiq at lps dot ens.fr
@ 2015-10-06 15:06 ` vehre at gcc dot gnu.org
  2015-10-16  8:30 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vehre at gcc dot gnu.org @ 2015-10-06 15:06 UTC (permalink / raw)
  To: gcc-bugs

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

vehre at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |vehre at gcc dot gnu.org

--- Comment #3 from vehre at gcc dot gnu.org ---
First patch available at:

https://gcc.gnu.org/ml/fortran/2015-10/msg00033.html


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

* [Bug fortran/65889] [6 Regressions] [OOP] ICE with sizeof a polymorphic variable.
  2015-04-25 16:29 [Bug fortran/65889] New: ICE on invalid(?) with sizeof polymorphic variable [OOP] abensonca at gmail dot com
                   ` (2 preceding siblings ...)
  2015-10-06 15:06 ` vehre at gcc dot gnu.org
@ 2015-10-16  8:30 ` rguenth at gcc dot gnu.org
  2015-10-16  8:34 ` rguenth at gcc dot gnu.org
  2015-10-16 10:40 ` vehre at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-10-16  8:30 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |6.0


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

* [Bug fortran/65889] [6 Regressions] [OOP] ICE with sizeof a polymorphic variable.
  2015-04-25 16:29 [Bug fortran/65889] New: ICE on invalid(?) with sizeof polymorphic variable [OOP] abensonca at gmail dot com
                   ` (3 preceding siblings ...)
  2015-10-16  8:30 ` rguenth at gcc dot gnu.org
@ 2015-10-16  8:34 ` rguenth at gcc dot gnu.org
  2015-10-16 10:40 ` vehre at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-10-16  8:34 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4


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

* [Bug fortran/65889] [6 Regressions] [OOP] ICE with sizeof a polymorphic variable.
  2015-04-25 16:29 [Bug fortran/65889] New: ICE on invalid(?) with sizeof polymorphic variable [OOP] abensonca at gmail dot com
                   ` (4 preceding siblings ...)
  2015-10-16  8:34 ` rguenth at gcc dot gnu.org
@ 2015-10-16 10:40 ` vehre at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vehre at gcc dot gnu.org @ 2015-10-16 10:40 UTC (permalink / raw)
  To: gcc-bugs

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

vehre at gcc dot gnu.org changed:

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

--- Comment #5 from vehre at gcc dot gnu.org ---
No complaints so far. Setting to be fixed with r228566.


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

end of thread, other threads:[~2015-10-16 10:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-25 16:29 [Bug fortran/65889] New: ICE on invalid(?) with sizeof polymorphic variable [OOP] abensonca at gmail dot com
2015-09-08 10:36 ` [Bug fortran/65889] " dominiq at lps dot ens.fr
2015-09-13  0:08 ` [Bug fortran/65889] [6 Regressions] [OOP] ICE with sizeof a polymorphic variable dominiq at lps dot ens.fr
2015-10-06 15:06 ` vehre at gcc dot gnu.org
2015-10-16  8:30 ` rguenth at gcc dot gnu.org
2015-10-16  8:34 ` rguenth at gcc dot gnu.org
2015-10-16 10:40 ` 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).