public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/105381] New: [12 Regression] Memory-hog since r12-8230
@ 2022-04-25 19:19 anlauf at gcc dot gnu.org
  2022-04-25 19:20 ` [Bug fortran/105381] " anlauf at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-04-25 19:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105381
           Summary: [12 Regression] Memory-hog since r12-8230
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anlauf at gcc dot gnu.org
  Target Milestone: ---

The following reduced code shows an issue with an apparently infinite
compile-time loop.

MODULE m
  implicit none
  integer,  parameter :: ncrit  =  8
  integer,  parameter :: nterm  =  7
contains

  subroutine new_thin_rule (rule1)
    character(*),intent(in) ,optional :: rule1(ncrit)
    character(len=8) :: rules (ncrit,nterm)
    rules = ''
    if (present (rule1)) rules(:,1) = rule1  ! <-- compile time hog
  end subroutine new_thin_rule

end module m

This eats lots of memory...

Fails with r12-8230, works with r12-8223.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/105381] [12 Regression] Memory-hog since r12-8230
  2022-04-25 19:19 [Bug fortran/105381] New: [12 Regression] Memory-hog since r12-8230 anlauf at gcc dot gnu.org
@ 2022-04-25 19:20 ` anlauf at gcc dot gnu.org
  2022-04-25 20:39 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-04-25 19:20 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |compile-time-hog
   Target Milestone|---                         |12.0
                 CC|                            |mikael at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/105381] [12 Regression] Memory-hog since r12-8230
  2022-04-25 19:19 [Bug fortran/105381] New: [12 Regression] Memory-hog since r12-8230 anlauf at gcc dot gnu.org
  2022-04-25 19:20 ` [Bug fortran/105381] " anlauf at gcc dot gnu.org
@ 2022-04-25 20:39 ` marxin at gcc dot gnu.org
  2022-04-25 21:24 ` mikael at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-04-25 20:39 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-04-25
                 CC|                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/105381] [12 Regression] Memory-hog since r12-8230
  2022-04-25 19:19 [Bug fortran/105381] New: [12 Regression] Memory-hog since r12-8230 anlauf at gcc dot gnu.org
  2022-04-25 19:20 ` [Bug fortran/105381] " anlauf at gcc dot gnu.org
  2022-04-25 20:39 ` marxin at gcc dot gnu.org
@ 2022-04-25 21:24 ` mikael at gcc dot gnu.org
  2022-04-25 21:24 ` mikael at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mikael at gcc dot gnu.org @ 2022-04-25 21:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Mikael Morin <mikael at gcc dot gnu.org> ---
Draft patch.

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index e4b6270ccf8..e0070aa080d 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -3698,7 +3698,8 @@ non_negative_strides_array_p (tree expr)
   if (DECL_P (expr)
       && DECL_LANG_SPECIFIC (expr))
     if (tree orig_decl = GFC_DECL_SAVED_DESCRIPTOR (expr))
-      return non_negative_strides_array_p (orig_decl);
+      if (orig_decl != expr)
+       return non_negative_strides_array_p (orig_decl);

   return true;
 }

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/105381] [12 Regression] Memory-hog since r12-8230
  2022-04-25 19:19 [Bug fortran/105381] New: [12 Regression] Memory-hog since r12-8230 anlauf at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-04-25 21:24 ` mikael at gcc dot gnu.org
@ 2022-04-25 21:24 ` mikael at gcc dot gnu.org
  2022-04-26  8:31 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mikael at gcc dot gnu.org @ 2022-04-25 21:24 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |mikael at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/105381] [12 Regression] Memory-hog since r12-8230
  2022-04-25 19:19 [Bug fortran/105381] New: [12 Regression] Memory-hog since r12-8230 anlauf at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-04-25 21:24 ` mikael at gcc dot gnu.org
@ 2022-04-26  8:31 ` rguenth at gcc dot gnu.org
  2022-04-27  9:36 ` cvs-commit at gcc dot gnu.org
  2022-04-27  9:40 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-26  8:31 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/105381] [12 Regression] Memory-hog since r12-8230
  2022-04-25 19:19 [Bug fortran/105381] New: [12 Regression] Memory-hog since r12-8230 anlauf at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-04-26  8:31 ` rguenth at gcc dot gnu.org
@ 2022-04-27  9:36 ` cvs-commit at gcc dot gnu.org
  2022-04-27  9:40 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-27  9:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Mikael Morin <mikael@gcc.gnu.org>:

https://gcc.gnu.org/g:3e0c9fdfd00b5b5cbff1a0bd6ac012a10fe81348

commit r12-8280-g3e0c9fdfd00b5b5cbff1a0bd6ac012a10fe81348
Author: Mikael Morin <mikael@gcc.gnu.org>
Date:   Wed Apr 27 11:36:00 2022 +0200

    fortran: Avoid infinite self-recursion [PR105381]

    Dummy array decls are local decls different from the argument decl
    accessible through GFC_DECL_SAVED_DESCRIPTOR.  If the argument decl has
    a DECL_LANG_SPECIFIC set, it is copied over to the local decl at the
    time the latter is created, so that the DECL_LANG_SPECIFIC object is
    shared between local dummy decl and argument decl, and thus the
    GFC_DECL_SAVED_DESCRIPTOR of the argument decl is the argument decl
    itself.

    The r12-8230-g7964ab6c364c410c34efe7ca2eba797d36525349 change introduced
    the non_negative_strides_array_p predicate which recurses through
    GFC_DECL_SAVED_DESCRIPTOR to avoid seeing dummy decls as purely local
    decls.  As the GFC_DECL_SAVED_DESCRIPTOR of the argument decl is itself,
    this can cause infinite recursion.

    This change adds a check to avoid infinite recursion.

            PR fortran/102043
            PR fortran/105381

    gcc/fortran/ChangeLog:

            * trans-array.cc (non_negative_strides_array_p): Inline variable
            orig_decl and merge nested if conditions.  Add condition to not
            recurse if the next argument is the same as the current.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/character_array_dummy_1.f90: New test.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/105381] [12 Regression] Memory-hog since r12-8230
  2022-04-25 19:19 [Bug fortran/105381] New: [12 Regression] Memory-hog since r12-8230 anlauf at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-04-27  9:36 ` cvs-commit at gcc dot gnu.org
@ 2022-04-27  9:40 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-27  9:40 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-04-27  9:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-25 19:19 [Bug fortran/105381] New: [12 Regression] Memory-hog since r12-8230 anlauf at gcc dot gnu.org
2022-04-25 19:20 ` [Bug fortran/105381] " anlauf at gcc dot gnu.org
2022-04-25 20:39 ` marxin at gcc dot gnu.org
2022-04-25 21:24 ` mikael at gcc dot gnu.org
2022-04-25 21:24 ` mikael at gcc dot gnu.org
2022-04-26  8:31 ` rguenth at gcc dot gnu.org
2022-04-27  9:36 ` cvs-commit at gcc dot gnu.org
2022-04-27  9:40 ` rguenth at gcc dot gnu.org

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).