public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mikael Morin <mikael@gcc.gnu.org>
To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [PATCH v2 0/3] libgfortran: empty array fixes
Date: Tue,  7 Nov 2023 11:24:01 +0100	[thread overview]
Message-ID: <20231107102404.1723120-1-mikael@gcc.gnu.org> (raw)

Hello,

Harald's review of the previous version [1] of these patches spotted a possible
misbehaving case in one patch, and a latent bug in the area of the second
patch.
So here is the second try, bootstraped and regression tested on x86_64-pc-linux-gnu.
OK for master?

Mikael

[1]:
https://gcc.gnu.org/pipermail/fortran/2023-November/059896.html
https://gcc.gnu.org/pipermail/gcc-patches/2023-November/635305.html

Changes from version 1:
 * Add patch 1/3 to the series fixing the unallocated empty result issue.
 * In patch 2/3 (formerly 1/2) clamp negative extent to zero.


Mikael Morin (3):
  libgfortran: Don't skip allocation if size is zero [PR112412]
  libgfortran: Remove early return if extent is zero [PR112371]
  libgfortran: Remove empty array descriptor first dimension overwrite
    [PR112371]

 gcc/testsuite/gfortran.dg/allocated_4.f90 | 195 +++++++
 gcc/testsuite/gfortran.dg/bound_10.f90    | 207 ++++++++
 gcc/testsuite/gfortran.dg/bound_11.f90    | 588 ++++++++++++++++++++++
 libgfortran/generated/all_l1.c            |   9 +-
 libgfortran/generated/all_l16.c           |   9 +-
 libgfortran/generated/all_l2.c            |   9 +-
 libgfortran/generated/all_l4.c            |   9 +-
 libgfortran/generated/all_l8.c            |   9 +-
 libgfortran/generated/any_l1.c            |   9 +-
 libgfortran/generated/any_l16.c           |   9 +-
 libgfortran/generated/any_l2.c            |   9 +-
 libgfortran/generated/any_l4.c            |   9 +-
 libgfortran/generated/any_l8.c            |   9 +-
 libgfortran/generated/count_16_l.c        |   9 +-
 libgfortran/generated/count_1_l.c         |   9 +-
 libgfortran/generated/count_2_l.c         |   9 +-
 libgfortran/generated/count_4_l.c         |   9 +-
 libgfortran/generated/count_8_l.c         |   9 +-
 libgfortran/generated/findloc1_c10.c      |  18 +-
 libgfortran/generated/findloc1_c16.c      |  18 +-
 libgfortran/generated/findloc1_c17.c      |  18 +-
 libgfortran/generated/findloc1_c4.c       |  18 +-
 libgfortran/generated/findloc1_c8.c       |  18 +-
 libgfortran/generated/findloc1_i1.c       |  18 +-
 libgfortran/generated/findloc1_i16.c      |  18 +-
 libgfortran/generated/findloc1_i2.c       |  18 +-
 libgfortran/generated/findloc1_i4.c       |  18 +-
 libgfortran/generated/findloc1_i8.c       |  18 +-
 libgfortran/generated/findloc1_r10.c      |  18 +-
 libgfortran/generated/findloc1_r16.c      |  18 +-
 libgfortran/generated/findloc1_r17.c      |  18 +-
 libgfortran/generated/findloc1_r4.c       |  18 +-
 libgfortran/generated/findloc1_r8.c       |  18 +-
 libgfortran/generated/findloc1_s1.c       |  18 +-
 libgfortran/generated/findloc1_s4.c       |  18 +-
 libgfortran/generated/iall_i1.c           |  30 +-
 libgfortran/generated/iall_i16.c          |  30 +-
 libgfortran/generated/iall_i2.c           |  30 +-
 libgfortran/generated/iall_i4.c           |  30 +-
 libgfortran/generated/iall_i8.c           |  30 +-
 libgfortran/generated/iany_i1.c           |  30 +-
 libgfortran/generated/iany_i16.c          |  30 +-
 libgfortran/generated/iany_i2.c           |  30 +-
 libgfortran/generated/iany_i4.c           |  30 +-
 libgfortran/generated/iany_i8.c           |  30 +-
 libgfortran/generated/iparity_i1.c        |  30 +-
 libgfortran/generated/iparity_i16.c       |  30 +-
 libgfortran/generated/iparity_i2.c        |  30 +-
 libgfortran/generated/iparity_i4.c        |  30 +-
 libgfortran/generated/iparity_i8.c        |  30 +-
 libgfortran/generated/maxloc1_16_i1.c     |  30 +-
 libgfortran/generated/maxloc1_16_i16.c    |  30 +-
 libgfortran/generated/maxloc1_16_i2.c     |  30 +-
 libgfortran/generated/maxloc1_16_i4.c     |  30 +-
 libgfortran/generated/maxloc1_16_i8.c     |  30 +-
 libgfortran/generated/maxloc1_16_r10.c    |  30 +-
 libgfortran/generated/maxloc1_16_r16.c    |  30 +-
 libgfortran/generated/maxloc1_16_r17.c    |  30 +-
 libgfortran/generated/maxloc1_16_r4.c     |  30 +-
 libgfortran/generated/maxloc1_16_r8.c     |  30 +-
 libgfortran/generated/maxloc1_16_s1.c     |  30 +-
 libgfortran/generated/maxloc1_16_s4.c     |  30 +-
 libgfortran/generated/maxloc1_4_i1.c      |  30 +-
 libgfortran/generated/maxloc1_4_i16.c     |  30 +-
 libgfortran/generated/maxloc1_4_i2.c      |  30 +-
 libgfortran/generated/maxloc1_4_i4.c      |  30 +-
 libgfortran/generated/maxloc1_4_i8.c      |  30 +-
 libgfortran/generated/maxloc1_4_r10.c     |  30 +-
 libgfortran/generated/maxloc1_4_r16.c     |  30 +-
 libgfortran/generated/maxloc1_4_r17.c     |  30 +-
 libgfortran/generated/maxloc1_4_r4.c      |  30 +-
 libgfortran/generated/maxloc1_4_r8.c      |  30 +-
 libgfortran/generated/maxloc1_4_s1.c      |  30 +-
 libgfortran/generated/maxloc1_4_s4.c      |  30 +-
 libgfortran/generated/maxloc1_8_i1.c      |  30 +-
 libgfortran/generated/maxloc1_8_i16.c     |  30 +-
 libgfortran/generated/maxloc1_8_i2.c      |  30 +-
 libgfortran/generated/maxloc1_8_i4.c      |  30 +-
 libgfortran/generated/maxloc1_8_i8.c      |  30 +-
 libgfortran/generated/maxloc1_8_r10.c     |  30 +-
 libgfortran/generated/maxloc1_8_r16.c     |  30 +-
 libgfortran/generated/maxloc1_8_r17.c     |  30 +-
 libgfortran/generated/maxloc1_8_r4.c      |  30 +-
 libgfortran/generated/maxloc1_8_r8.c      |  30 +-
 libgfortran/generated/maxloc1_8_s1.c      |  30 +-
 libgfortran/generated/maxloc1_8_s4.c      |  30 +-
 libgfortran/generated/maxval1_s1.c        |  30 +-
 libgfortran/generated/maxval1_s4.c        |  30 +-
 libgfortran/generated/maxval_i1.c         |  30 +-
 libgfortran/generated/maxval_i16.c        |  30 +-
 libgfortran/generated/maxval_i2.c         |  30 +-
 libgfortran/generated/maxval_i4.c         |  30 +-
 libgfortran/generated/maxval_i8.c         |  30 +-
 libgfortran/generated/maxval_r10.c        |  30 +-
 libgfortran/generated/maxval_r16.c        |  30 +-
 libgfortran/generated/maxval_r17.c        |  30 +-
 libgfortran/generated/maxval_r4.c         |  30 +-
 libgfortran/generated/maxval_r8.c         |  30 +-
 libgfortran/generated/minloc1_16_i1.c     |  30 +-
 libgfortran/generated/minloc1_16_i16.c    |  30 +-
 libgfortran/generated/minloc1_16_i2.c     |  30 +-
 libgfortran/generated/minloc1_16_i4.c     |  30 +-
 libgfortran/generated/minloc1_16_i8.c     |  30 +-
 libgfortran/generated/minloc1_16_r10.c    |  30 +-
 libgfortran/generated/minloc1_16_r16.c    |  30 +-
 libgfortran/generated/minloc1_16_r17.c    |  30 +-
 libgfortran/generated/minloc1_16_r4.c     |  30 +-
 libgfortran/generated/minloc1_16_r8.c     |  30 +-
 libgfortran/generated/minloc1_16_s1.c     |  30 +-
 libgfortran/generated/minloc1_16_s4.c     |  30 +-
 libgfortran/generated/minloc1_4_i1.c      |  30 +-
 libgfortran/generated/minloc1_4_i16.c     |  30 +-
 libgfortran/generated/minloc1_4_i2.c      |  30 +-
 libgfortran/generated/minloc1_4_i4.c      |  30 +-
 libgfortran/generated/minloc1_4_i8.c      |  30 +-
 libgfortran/generated/minloc1_4_r10.c     |  30 +-
 libgfortran/generated/minloc1_4_r16.c     |  30 +-
 libgfortran/generated/minloc1_4_r17.c     |  30 +-
 libgfortran/generated/minloc1_4_r4.c      |  30 +-
 libgfortran/generated/minloc1_4_r8.c      |  30 +-
 libgfortran/generated/minloc1_4_s1.c      |  30 +-
 libgfortran/generated/minloc1_4_s4.c      |  30 +-
 libgfortran/generated/minloc1_8_i1.c      |  30 +-
 libgfortran/generated/minloc1_8_i16.c     |  30 +-
 libgfortran/generated/minloc1_8_i2.c      |  30 +-
 libgfortran/generated/minloc1_8_i4.c      |  30 +-
 libgfortran/generated/minloc1_8_i8.c      |  30 +-
 libgfortran/generated/minloc1_8_r10.c     |  30 +-
 libgfortran/generated/minloc1_8_r16.c     |  30 +-
 libgfortran/generated/minloc1_8_r17.c     |  30 +-
 libgfortran/generated/minloc1_8_r4.c      |  30 +-
 libgfortran/generated/minloc1_8_r8.c      |  30 +-
 libgfortran/generated/minloc1_8_s1.c      |  30 +-
 libgfortran/generated/minloc1_8_s4.c      |  30 +-
 libgfortran/generated/minval1_s1.c        |  30 +-
 libgfortran/generated/minval1_s4.c        |  30 +-
 libgfortran/generated/minval_i1.c         |  30 +-
 libgfortran/generated/minval_i16.c        |  30 +-
 libgfortran/generated/minval_i2.c         |  30 +-
 libgfortran/generated/minval_i4.c         |  30 +-
 libgfortran/generated/minval_i8.c         |  30 +-
 libgfortran/generated/minval_r10.c        |  30 +-
 libgfortran/generated/minval_r16.c        |  30 +-
 libgfortran/generated/minval_r17.c        |  30 +-
 libgfortran/generated/minval_r4.c         |  30 +-
 libgfortran/generated/minval_r8.c         |  30 +-
 libgfortran/generated/norm2_r10.c         |   7 +-
 libgfortran/generated/norm2_r16.c         |   7 +-
 libgfortran/generated/norm2_r17.c         |   7 +-
 libgfortran/generated/norm2_r4.c          |   7 +-
 libgfortran/generated/norm2_r8.c          |   7 +-
 libgfortran/generated/parity_l1.c         |   7 +-
 libgfortran/generated/parity_l16.c        |   7 +-
 libgfortran/generated/parity_l2.c         |   7 +-
 libgfortran/generated/parity_l4.c         |   7 +-
 libgfortran/generated/parity_l8.c         |   7 +-
 libgfortran/generated/product_c10.c       |  30 +-
 libgfortran/generated/product_c16.c       |  30 +-
 libgfortran/generated/product_c17.c       |  30 +-
 libgfortran/generated/product_c4.c        |  30 +-
 libgfortran/generated/product_c8.c        |  30 +-
 libgfortran/generated/product_i1.c        |  30 +-
 libgfortran/generated/product_i16.c       |  30 +-
 libgfortran/generated/product_i2.c        |  30 +-
 libgfortran/generated/product_i4.c        |  30 +-
 libgfortran/generated/product_i8.c        |  30 +-
 libgfortran/generated/product_r10.c       |  30 +-
 libgfortran/generated/product_r16.c       |  30 +-
 libgfortran/generated/product_r17.c       |  30 +-
 libgfortran/generated/product_r4.c        |  30 +-
 libgfortran/generated/product_r8.c        |  30 +-
 libgfortran/generated/sum_c10.c           |  30 +-
 libgfortran/generated/sum_c16.c           |  30 +-
 libgfortran/generated/sum_c17.c           |  30 +-
 libgfortran/generated/sum_c4.c            |  30 +-
 libgfortran/generated/sum_c8.c            |  30 +-
 libgfortran/generated/sum_i1.c            |  30 +-
 libgfortran/generated/sum_i16.c           |  30 +-
 libgfortran/generated/sum_i2.c            |  30 +-
 libgfortran/generated/sum_i4.c            |  30 +-
 libgfortran/generated/sum_i8.c            |  30 +-
 libgfortran/generated/sum_r10.c           |  30 +-
 libgfortran/generated/sum_r16.c           |  30 +-
 libgfortran/generated/sum_r17.c           |  30 +-
 libgfortran/generated/sum_r4.c            |  30 +-
 libgfortran/generated/sum_r8.c            |  30 +-
 libgfortran/m4/ifindloc1.m4               |  18 +-
 libgfortran/m4/ifunction-s.m4             |  30 +-
 libgfortran/m4/ifunction-s2.m4            |  30 +-
 libgfortran/m4/ifunction.m4               |  30 +-
 libgfortran/m4/ifunction_logical.m4       |   9 +-
 191 files changed, 2094 insertions(+), 3754 deletions(-)
 create mode 100644 gcc/testsuite/gfortran.dg/allocated_4.f90
 create mode 100644 gcc/testsuite/gfortran.dg/bound_10.f90
 create mode 100644 gcc/testsuite/gfortran.dg/bound_11.f90

-- 
2.42.0


             reply	other threads:[~2023-11-07 10:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-07 10:24 Mikael Morin [this message]
2023-11-07 10:24 ` [PATCH v2 1/3] libgfortran: Don't skip allocation if size is zero [PR112412] Mikael Morin
2023-11-07 10:24 ` [PATCH v2 2/3] libgfortran: Remove early return if extent is zero [PR112371] Mikael Morin
2023-11-07 10:24 ` [PATCH v2 3/3] libgfortran: Remove empty array descriptor first dimension overwrite [PR112371] Mikael Morin
2023-11-07 18:16 ` [PATCH v2 0/3] libgfortran: empty array fixes Harald Anlauf
2023-11-07 19:10   ` Fwd: " John Koval
2023-11-08 13:06   ` Mikael Morin

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=20231107102404.1723120-1-mikael@gcc.gnu.org \
    --to=mikael@gcc.gnu.org \
    --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).