public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mikael at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/116196] New: Missing temporary with WHERE and aliasing TARGET array references
Date: Fri, 02 Aug 2024 14:36:47 +0000	[thread overview]
Message-ID: <bug-116196-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 116196
           Summary: Missing temporary with WHERE and aliasing TARGET array
                    references
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mikael at gcc dot gnu.org
  Target Milestone: ---

The following example outputs:
           1           1           2           3           5
while I think it should output:
           1           1           2           4           5

I found it looking for an example exercising gfc_check_dependency with aliasing
arrays, after the analysis posted as followup to Jakub's recent pasto fix:
https://gcc.gnu.org/pipermail/gcc-patches/2024-August/658971.html


MODULE m
  IMPLICIT NONE
  INTEGER, TARGET :: arr(5)
END MODULE m

PROGRAM main
  USE m
  IMPLICIT NONE
  arr = (/ 1, 2, 3, 4, 5 /)
  CALL bar(arr)
  PRINT *, arr
  IF (ANY(arr /= (/ 1, 1, 2, 4, 5 /))) STOP 1
CONTAINS
  SUBROUTINE bar(x)
    INTEGER, TARGET :: x(:)
    WHERE (arr(1:4) < 3) x(2:5) = x(2:5) - 1
  END SUBROUTINE bar
END PROGRAM main

             reply	other threads:[~2024-08-02 14:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-02 14:36 mikael at gcc dot gnu.org [this message]
2024-08-02 15:52 ` [Bug fortran/116196] " mikael at gcc dot gnu.org
2024-08-21 18:06 ` mikael at gcc dot gnu.org
2024-08-21 18:11 ` mikael 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-116196-4@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).