public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/107424] [13 Regression] ICE in gfc_trans_omp_do, at fortran/trans-openmp.cc:5397 - and wrong code - with non-rectangular loops
Date: Wed, 11 Jan 2023 15:30:28 +0000	[thread overview]
Message-ID: <bug-107424-4-4Dxn4xzZFr@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107424-4@http.gcc.gnu.org/bugzilla/>

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org
           Keywords|                            |ice-on-valid-code,
                   |                            |wrong-code
            Summary|[13 Regression] ICE in      |[13 Regression] ICE in
                   |gfc_trans_omp_do, at        |gfc_trans_omp_do, at
                   |fortran/trans-openmp.cc:539 |fortran/trans-openmp.cc:539
                   |7                           |7 - and wrong code - with
                   |                            |non-rectangular loops

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The following program does not ICE but it shows with -Wall:
  Warning: ‘i’ is used uninitialized
the code is as above (comment 0) except for:

   do i = 1, 9, 1   !  <<< only change: Stride == 1; ICE has stride == 2.
      do j = 1, i

Looking at the dump:

    integer(kind=4) D.4264;

    D.4264 = i;  // BAD: Uninitialized variable
    #pragma omp for collapse(2)
      {
        {
          #pragma omp simd collapse(2)
          for (i = 1; i <= 9; i = i + 1)
            for (j = 1; j <= D.4264; j = j + 1)  // Wrong: use loop war 'i' not
'D.4264'!
              {
                L.1:;
              }

--------------

Draft patch for this issue – but not for the original issue (the ICE):

--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -5224 +5224 @@ gfc_trans_omp_do (gfc_code *code, gfc_exec_op op, stmtblock_t
*pblock,
-      from = gfc_evaluate_now (se.expr, pblock);
+      from = DECL_P (se.expr) ? se.expr : gfc_evaluate_now (se.expr, pblock);
@@ -5229 +5229 @@ gfc_trans_omp_do (gfc_code *code, gfc_exec_op op, stmtblock_t
*pblock,
-      to = gfc_evaluate_now (se.expr, pblock);
+      to = DECL_P (se.expr) ? se.expr : gfc_evaluate_now (se.expr, pblock);
@@ -5234 +5234 @@ gfc_trans_omp_do (gfc_code *code, gfc_exec_op op, stmtblock_t
*pblock,
-      step = gfc_evaluate_now (se.expr, pblock);
+      step = DECL_P (se.expr) ? se.expr : gfc_evaluate_now (se.expr, pblock);

  parent reply	other threads:[~2023-01-11 15:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26 18:37 [Bug fortran/107424] New: [13 Regression] ICE in gfc_trans_omp_do, at fortran/trans-openmp.cc:5397 gscfq@t-online.de
2022-10-27  8:50 ` [Bug fortran/107424] " marxin at gcc dot gnu.org
2022-10-28 11:35 ` rguenth at gcc dot gnu.org
2023-01-11 15:30 ` burnus at gcc dot gnu.org [this message]
2023-01-11 15:59 ` [Bug fortran/107424] [13 Regression] ICE in gfc_trans_omp_do, at fortran/trans-openmp.cc:5397 - and wrong code - with non-rectangular loops burnus at gcc dot gnu.org
2023-01-13 10:46 ` burnus at gcc dot gnu.org
2023-01-13 10:53 ` burnus at gcc dot gnu.org
2023-01-13 11:07 ` jakub at gcc dot gnu.org
2023-01-13 11:46 ` burnus at gcc dot gnu.org
2023-01-13 11:51 ` jakub at gcc dot gnu.org
2023-01-18 22:24 ` burnus at gcc dot gnu.org
2023-01-25 14:50 ` burnus at gcc dot gnu.org
2023-02-09 14:51 ` cvs-commit at gcc dot gnu.org
2023-02-09 14:54 ` burnus at gcc dot gnu.org
2023-04-26  6:56 ` [Bug fortran/107424] [13/14 " rguenth at gcc dot gnu.org
2023-07-17 11:15 ` burnus at gcc dot gnu.org
2023-07-19  8:19 ` cvs-commit at gcc dot gnu.org
2023-07-19  8:27 ` burnus 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-107424-4-4Dxn4xzZFr@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).