public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gmx.de>
To: fortran <fortran@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [Committed] PR fortran/104999 - [12 Regression] runtime error: pointer index expression with base 0x00000cf67720 overflowed to 0xffffffffea627728
Date: Tue, 22 Mar 2022 21:05:05 +0100	[thread overview]
Message-ID: <trinity-f2a19b3d-8f6e-452b-9cb8-f987d8422fef-1647979505136@3c-app-gmx-bap14> (raw)

[-- Attachment #1: Type: text/plain, Size: 357 bytes --]

Dear all,

as reported by Martin Liška, a sanitized compiler hits an uninitialized stride
value when simplifying CSHIFT in testcase gfortran.dg/simplify_cshift_1.f90.
Committed as obvious after confirmation in the PR by Martin that the attached
patch fixes the issue.

commit r12-7771-g774ab2edcb5f3a24ed3a5cffd1143bd49a69f1ee

Thanks,
Harald


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pr104999.diff --]
[-- Type: text/x-patch, Size: 819 bytes --]

From 774ab2edcb5f3a24ed3a5cffd1143bd49a69f1ee Mon Sep 17 00:00:00 2001
From: Harald Anlauf <anlauf@gmx.de>
Date: Tue, 22 Mar 2022 20:54:18 +0100
Subject: [PATCH] Fortran: ensure intialization of stride array

gcc/fortran/ChangeLog:

	PR fortran/104999
	* simplify.cc (gfc_simplify_cshift): Ensure temporary holding
	source array stride is initialized.
---
 gcc/fortran/simplify.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc
index 0c15bcb2b0a..233cc42137f 100644
--- a/gcc/fortran/simplify.cc
+++ b/gcc/fortran/simplify.cc
@@ -2134,6 +2134,7 @@ gfc_simplify_cshift (gfc_expr *array, gfc_expr *shift, gfc_expr *dim)

   resultvec = XCNEWVEC (gfc_expr *, arraysize);

+  sstride[0] = 0;
   extent[0] = 1;
   count[0] = 0;

--
2.34.1


                 reply	other threads:[~2022-03-22 20:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=trinity-f2a19b3d-8f6e-452b-9cb8-f987d8422fef-1647979505136@3c-app-gmx-bap14 \
    --to=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@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).