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/99125] [9/10/11 Regression] ICE: gimplification failed (gimplify.c:15068)
Date: Mon, 22 Feb 2021 17:05:09 +0000	[thread overview]
Message-ID: <bug-99125-4-pjdJohoSIP@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99125-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from G. Steinmetz <gscfq@t-online.de> ---

I also checked this invalid (probably a known issue) :


$ cat za.f90
program p
   character(:), allocatable :: a(:)
   character(8) :: c(2) = '12 45 78'
   a = c
   print *, a(7:8)
end

$ gfortran-11-20210221 za.f90 && ./a.out   # surprising
 12 45 7812 45 78


Detected at runtime :

$ gfortran-11-20210221 za.f90 -Wall -fcheck=all && ./a.out
za.f90:2:36:

    2 |    character(:), allocatable :: a(:)
      |                                    ^
Warning: '.a' may be used uninitialized [-Wmaybe-uninitialized]
za.f90:4:8:

    4 |    a = c
      |        ^
Warning: 'a.offset' may be used uninitialized [-Wmaybe-uninitialized]
za.f90:2:36:

    2 |    character(:), allocatable :: a(:)
      |                                    ^
note: 'a' declared here
za.f90:4:8:

    4 |    a = c
      |        ^
Warning: 'a.dim[0].lbound' may be used uninitialized [-Wmaybe-uninitialized]
za.f90:2:36:

    2 |    character(:), allocatable :: a(:)
      |                                    ^
note: 'a' declared here
za.f90:4:8:

    4 |    a = c
      |        ^
Warning: 'a.dim[0].ubound' may be used uninitialized [-Wmaybe-uninitialized]
za.f90:2:36:

    2 |    character(:), allocatable :: a(:)
      |                                    ^
note: 'a' declared here
za.f90:4:8:

    4 |    a = c
      |        ^
Warning: 'a.dim[0].lbound' may be used uninitialized [-Wmaybe-uninitialized]
za.f90:2:36:

    2 |    character(:), allocatable :: a(:)
      |                                    ^
note: 'a' declared here
za.f90:4:8:

    4 |    a = c
      |        ^
Warning: 'a.dim[0].ubound' may be used uninitialized [-Wmaybe-uninitialized]
za.f90:2:36:

    2 |    character(:), allocatable :: a(:)
      |                                    ^
note: 'a' declared here
za.f90:4:8:

    4 |    a = c
      |        ^
Warning: 'a.dim[0].ubound' may be used uninitialized [-Wmaybe-uninitialized]
za.f90:2:36:

    2 |    character(:), allocatable :: a(:)
      |                                    ^
note: 'a' declared here
za.f90:4:8:

    4 |    a = c
      |        ^
Warning: 'a.dim[0].lbound' may be used uninitialized [-Wmaybe-uninitialized]
za.f90:2:36:

    2 |    character(:), allocatable :: a(:)
      |                                    ^
note: 'a' declared here
At line 5 of file za.f90
Fortran runtime error: Index '7' of dimension 1 of array 'a' outside of
expected range (1:2)

Error termination. Backtrace:
#0  0x4025d1 in ???
#1  0x402738 in ???
#2  0x7fa0f5697f89 in ???
#3  0x4022b9 in ???
        at ../sysdeps/x86_64/start.S:120
#4  0xffffffffffffffff in ???


---

The very basic simplification gives :

$ cat zc.f90
program p
   character(8) :: c(2) = '12 45 78'
   print *, c(7:8)
end

$ gfortran-11-20210221 zc.f90 -Wall -fcheck=all && ./a.out
zc.f90:3:14:

    3 |    print *, c(7:8)
      |              1
Warning: Lower array reference at (1) is out of bounds (7 > 2) in dimension 1
At line 3 of file zc.f90
Fortran runtime error: Index '7' of dimension 1 of array 'c' outside of
expected range (1:2)

Error termination. Backtrace:
#0  0x4023f7 in ???
#1  0x40242b in ???
#2  0x7fc15fc2af89 in ???
#3  0x4022b9 in ???
        at ../sysdeps/x86_64/start.S:120
#4  0xffffffffffffffff in ???

  parent reply	other threads:[~2021-02-22 17:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 17:46 [Bug fortran/99125] New: " gscfq@t-online.de
2021-02-16 17:46 ` [Bug fortran/99125] " gscfq@t-online.de
2021-02-16 18:39 ` marxin at gcc dot gnu.org
2021-02-18  9:11 ` rguenth at gcc dot gnu.org
2021-02-21 18:12 ` pault at gcc dot gnu.org
2021-02-22 17:04 ` gscfq@t-online.de
2021-02-22 17:05 ` gscfq@t-online.de [this message]
2021-03-13 11:40 ` cvs-commit at gcc dot gnu.org
2021-05-04 12:31 ` [Bug fortran/99125] [9/10/11/12 " rguenth at gcc dot gnu.org
2021-06-01  8:19 ` rguenth at gcc dot gnu.org
2021-08-25 21:12 ` anlauf at gcc dot gnu.org
2021-08-28 18:46 ` cvs-commit at gcc dot gnu.org
2021-08-28 18:48 ` [Bug fortran/99125] [9 " anlauf at gcc dot gnu.org
2021-09-06 18:45 ` cvs-commit at gcc dot gnu.org
2021-09-06 18:49 ` anlauf at gcc dot gnu.org

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-99125-4-pjdJohoSIP@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: link
Be 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).