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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #4 from anlauf at gcc dot gnu.org ---
As there is no ICE with -fcheck=bounds -fwrapv but with -fcheck=bounds -ftrapv,
there might be a wrapping issue with the bounds checking code.

Difference of the dump-trees:

--- pr106945-z1.f90.005t.original.wrapv 2023-03-10 22:15:44.992525716 +0100
+++ pr106945-z1.f90.005t.original.trapv 2023-03-10 22:15:24.892582362 +0100
@@ -268,7 +268,7 @@
             D.4395 = (unsigned long) src->a._vptr->_size;
             D.4396 = (unsigned long) src->a._len;
             D.4397 = D.4396 != 0 ? D.4395 * D.4396 : D.4395;
-            if (src->a._data.dim[0].ubound != src->a._data.dim[0].lbound)
+            if ((src->a._data.dim[0].ubound - src->a._data.dim[0].lbound) + 1
!= 1)
               {
                 _gfortran_runtime_error_at (&"At line 9 of file
pr106945-z1.f90"[1]{lb: 1 sz: 1}, &"Array bound mismatch for dimension 1 of
array \'<<unknown>>\' (%ld/%ld)"[1]{lb: 1 sz: 1}, 1, MAX_EXPR
<(src->a._data.dim[0].ubound - src->a._data.dim[0].lbound) + 1, 0>);
               }


I am having difficulties to understand the code generated for -ftrapv.

Reply via email to