public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gscfq@t-online.de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/106047] ICE in structure_alloc_comps, at fortran/trans-array.cc:9574 Date: Thu, 23 Jun 2022 15:41:47 +0000 [thread overview] Message-ID: <bug-106047-4-M0R5QMhLN0@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-106047-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106047 --- Comment #2 from G. Steinmetz <gscfq@t-online.de> --- Hmm, exploring some more test cases; z2 gives same ICE, z3 prints 128, z4 gives an error, z5 is ok/works : $ cat z2.f90 program p type t character(:), allocatable :: c end type type(t) :: x ! without = t() integer, parameter :: n = storage_size(x) end $ cat z3.f90 program p type t character(:), allocatable :: c end type type(t), parameter :: x = t() ! that is t(null()) integer :: n = storage_size(x) print *, n end $ cat z4.f90 program p type t character(:), allocatable :: c end type type(t), parameter :: x = t('abc') ! instead of t(null()) integer :: n = storage_size(x) print *, n end $ cat z5.f90 program p type t character(:), allocatable :: c end type type(t) :: x integer :: n n = storage_size(x) print *, n end --- Some examples without "type" : $ cat zz1.f90 program p character(:), allocatable :: c integer :: n = storage_size(c) print *, n end $ cat zz2.f90 program p character(:), allocatable :: c integer, parameter :: n = storage_size(c) print *, n end $ cat zz3.f90 program p character(:), allocatable :: c print *, storage_size(c) end $ gfortran-13-20220619 -c zz1.f90 zz1.f90:3:31: 3 | integer :: n = storage_size(c) | 1 Error: Parameter 'c' at (1) has not been declared or is a variable, which does not reduce to a constant expression $ $ gfortran-13-20220619 -c zz2.f90 zz2.f90:3:42: 3 | integer, parameter :: n = storage_size(c) | 1 Error: Parameter 'c' at (1) has not been declared or is a variable, which does not reduce to a constant expression $ $ gfortran-13-20220619 zz3.f90 ; a.out 0 $ Via Compiler Explorer : Latest ifort/ifx indeed compiles z1/2/3/5, rejects z4 with an error (ok). Latest ifort/ifx rejects zz1/zz2 with an error, accepts zz3 and prints 0.
next prev parent reply other threads:[~2022-06-23 15:41 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-21 18:49 [Bug fortran/106047] New: " gscfq@t-online.de 2022-06-22 20:44 ` [Bug fortran/106047] " anlauf at gcc dot gnu.org 2022-06-23 15:41 ` gscfq@t-online.de [this message] 2022-06-24 6:12 ` gscfq@t-online.de
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-106047-4-M0R5QMhLN0@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).