[Bug middle-end/92952] [10 regression] gfortran.dg/lto/pr87689 FAILs at -O2

2019-12-18 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92952

Martin Sebor  changed:

   What|Removed |Added

 CC||seurer at gcc dot gnu.org

--- Comment #5 from Martin Sebor  ---
*** Bug 92958 has been marked as a duplicate of this bug. ***

[Bug middle-end/92952] [10 regression] gfortran.dg/lto/pr87689 FAILs at -O2

2019-12-16 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92952

Martin Sebor  changed:

   What|Removed |Added

 CC||tschwinge at gcc dot gnu.org

--- Comment #4 from Martin Sebor  ---
*** Bug 92956 has been marked as a duplicate of this bug. ***

[Bug middle-end/92952] [10 regression] gfortran.dg/lto/pr87689 FAILs at -O2

2019-12-16 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92952

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Martin Sebor  ---
This should be fixed now.

[Bug middle-end/92952] [10 regression] gfortran.dg/lto/pr87689 FAILs at -O2

2019-12-16 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92952

--- Comment #2 from Martin Sebor  ---
Author: msebor
Date: Mon Dec 16 22:24:15 2019
New Revision: 279445

URL: https://gcc.gnu.org/viewcvs?rev=279445&root=gcc&view=rev
Log:
PR middle-end/92952 - gfortran.dg/lto/pr87689 FAILs at -O2

gcc/ChangeLog:
* builtins.c (compute_objsize): Adjust offset by the array low bound.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c

[Bug middle-end/92952] [10 regression] gfortran.dg/lto/pr87689 FAILs at -O2

2019-12-16 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92952

Martin Sebor  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org

[Bug middle-end/92952] [10 regression] gfortran.dg/lto/pr87689 FAILs at -O2

2019-12-16 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92952

Martin Sebor  changed:

   What|Removed |Added

   Keywords||diagnostic
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-12-16
 Ever confirmed|0   |1

--- Comment #1 from Martin Sebor  ---
-Wstringop-overflow is enabled only for the C family of languages (and for LTO)
so it shouldn't be issued for Fortran code (see also pr80545).  I think the
problem might be making the distinction between languages during LTO builds.

I can reproduce the warning but have no idea how to actually step into the LTO
code.  My best guess is that the size computation doesn't account for the
non-zero low bound in Fortran arrays.  The following avoids the warning so let
me go with it.

Index: gcc/builtins.c
===
--- gcc/builtins.c  (revision 279443)
+++ gcc/builtins.c  (working copy)
@@ -3999,6 +3999,16 @@ compute_objsize (tree dest, int ostype, tree *pdec
 above.  */
  if (TREE_CODE (dest) == ARRAY_REF)
{
+ tree lowbnd = array_ref_low_bound (dest);
+ if (!integer_zerop (lowbnd) && tree_fits_uhwi_p (lowbnd))
+   {
+ /* Adjust the offset by the low bound of the array
+domain (normally zero but 1 in Fortran).  */
+ unsigned HOST_WIDE_INT lb = tree_to_uhwi (lowbnd);
+ offrng[0] -= lb;
+ offrng[1] -= lb;
+   }
+
  /* Convert the array index into a byte offset.  */
  tree eltype = TREE_TYPE (dest);
  tree tpsize = TYPE_SIZE_UNIT (eltype);

[Bug middle-end/92952] [10 regression] gfortran.dg/lto/pr87689 FAILs at -O2

2019-12-16 Thread ro at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92952

Rainer Orth  changed:

   What|Removed |Added

   Target Milestone|--- |10.0