public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/98661] New: Valgrind errors during error recovery of invalid derived type declarations
@ 2021-01-13 20:02 anlauf at gcc dot gnu.org
  2021-01-13 20:03 ` [Bug fortran/98661] " anlauf at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-01-13 20:02 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98661
           Summary: Valgrind errors during error recovery of invalid
                    derived type declarations
           Product: gcc
           Version: 11.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 invalid code exhibits valgrind issues during error recovery
(based on charlen_03.f90 which was removed from the testsuite, see PR78746)

program p
  implicit none
  type t
     character(:), allocatable :: x(n) ! { dg-error "must have a deferred
shape" }
  end type
end
! { dg-excess-errors "must be of INTEGER type" }

and similarly with "implicit none" commented out.

Simpler versions, with "character(:)" replaced by "character(1)",
produce similar valgrind output, so may be easier to debug.

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

* [Bug fortran/98661] Valgrind errors during error recovery of invalid derived type declarations
  2021-01-13 20:02 [Bug fortran/98661] New: Valgrind errors during error recovery of invalid derived type declarations anlauf at gcc dot gnu.org
@ 2021-01-13 20:03 ` anlauf at gcc dot gnu.org
  2021-01-13 20:26 ` dominiq at lps dot ens.fr
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-01-13 20:03 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |error-recovery
           Priority|P3                          |P4

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

* [Bug fortran/98661] Valgrind errors during error recovery of invalid derived type declarations
  2021-01-13 20:02 [Bug fortran/98661] New: Valgrind errors during error recovery of invalid derived type declarations anlauf at gcc dot gnu.org
  2021-01-13 20:03 ` [Bug fortran/98661] " anlauf at gcc dot gnu.org
@ 2021-01-13 20:26 ` dominiq at lps dot ens.fr
  2021-01-13 20:47 ` anlauf at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2021-01-13 20:26 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-01-13
             Blocks|                            |86656, 89891
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
I don't see the need to open a new PR for that.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86656
[Bug 86656] [meta-bug] Issues found with -fsanitize=address
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89891
[Bug 89891] [meta-bug] Accessing memory in rejected statements or expressions

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

* [Bug fortran/98661] Valgrind errors during error recovery of invalid derived type declarations
  2021-01-13 20:02 [Bug fortran/98661] New: Valgrind errors during error recovery of invalid derived type declarations anlauf at gcc dot gnu.org
  2021-01-13 20:03 ` [Bug fortran/98661] " anlauf at gcc dot gnu.org
  2021-01-13 20:26 ` dominiq at lps dot ens.fr
@ 2021-01-13 20:47 ` anlauf at gcc dot gnu.org
  2021-01-13 21:25 ` anlauf at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-01-13 20:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
This has nothing to do with character at all.  Same issue with:

program p
  implicit none
  type t
     integer, allocatable :: x(n) ! { dg-error "must have a deferred shape" }
  end type
end


I am regtesting the following patch:

diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 3929ddff849..d1ba20cc3c0 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -14723,6 +14735,9 @@ resolve_component (gfc_component *c, gfc_symbol *sym)
         && sym != c->ts.u.derived)
     add_dt_to_dt_list (c->ts.u.derived);

+  if (c->as && c->as->type != AS_DEFERRED && c->attr.allocatable)
+    return false;
+
   if (!gfc_resolve_array_spec (c->as,
                                !(c->attr.pointer || c->attr.proc_pointer
                                  || c->attr.allocatable)))

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

* [Bug fortran/98661] Valgrind errors during error recovery of invalid derived type declarations
  2021-01-13 20:02 [Bug fortran/98661] New: Valgrind errors during error recovery of invalid derived type declarations anlauf at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-01-13 20:47 ` anlauf at gcc dot gnu.org
@ 2021-01-13 21:25 ` anlauf at gcc dot gnu.org
  2021-01-14 18:14 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-01-13 21:25 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #3 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2021-January/055595.html

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

* [Bug fortran/98661] Valgrind errors during error recovery of invalid derived type declarations
  2021-01-13 20:02 [Bug fortran/98661] New: Valgrind errors during error recovery of invalid derived type declarations anlauf at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-01-13 21:25 ` anlauf at gcc dot gnu.org
@ 2021-01-14 18:14 ` cvs-commit at gcc dot gnu.org
  2021-01-14 18:21 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-14 18:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:d0d2becf2dfe8316c9014d962e7f77773ec5c27e

commit r11-6679-gd0d2becf2dfe8316c9014d962e7f77773ec5c27e
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Thu Jan 14 19:13:16 2021 +0100

    PR fortran/98661 - valgrind issues with error recovery

    During error recovery after an invalid derived type specification it was
    possible to try to resolve an invalid array specification.  We now skip
    this if the component has the ALLOCATABLE or POINTER attribute and the
    shape is not deferred.

    gcc/fortran/ChangeLog:

            PR fortran/98661
            * resolve.c (resolve_component): Derived type components with
            ALLOCATABLE or POINTER attribute shall have a deferred shape.

    gcc/testsuite/ChangeLog:

            PR fortran/98661
            * gfortran.dg/pr98661.f90: New test.

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

* [Bug fortran/98661] Valgrind errors during error recovery of invalid derived type declarations
  2021-01-13 20:02 [Bug fortran/98661] New: Valgrind errors during error recovery of invalid derived type declarations anlauf at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-01-14 18:14 ` cvs-commit at gcc dot gnu.org
@ 2021-01-14 18:21 ` cvs-commit at gcc dot gnu.org
  2021-01-14 18:24 ` anlauf at gcc dot gnu.org
  2021-01-15 20:52 ` anlauf at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-14 18:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:9e1e6e631045c7eed2c72738b7084986d39ca09f

commit r11-6681-g9e1e6e631045c7eed2c72738b7084986d39ca09f
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Thu Jan 14 19:21:05 2021 +0100

    PR fortran/98661 - valgrind issues with error recovery

    During error recovery after an invalid derived type specification it was
    possible to try to resolve an invalid array specification.  We now skip
    this if the component has the ALLOCATABLE or POINTER attribute and the
    shape is not deferred.

    gcc/fortran/ChangeLog:

            PR fortran/98661
            * resolve.c (resolve_component): Derived type components with
            ALLOCATABLE or POINTER attribute shall have a deferred shape.

    gcc/testsuite/ChangeLog:

            PR fortran/98661
            * gfortran.dg/pr98661.f90: New test.

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

* [Bug fortran/98661] Valgrind errors during error recovery of invalid derived type declarations
  2021-01-13 20:02 [Bug fortran/98661] New: Valgrind errors during error recovery of invalid derived type declarations anlauf at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-01-14 18:21 ` cvs-commit at gcc dot gnu.org
@ 2021-01-14 18:24 ` anlauf at gcc dot gnu.org
  2021-01-15 20:52 ` anlauf at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-01-14 18:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from anlauf at gcc dot gnu.org ---
The commit in comment#4 unfortunately contained debugging stuff that should
never have been pushed.  Thus reverted and created the new commit in comment#5.

Sorry for that.

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

* [Bug fortran/98661] Valgrind errors during error recovery of invalid derived type declarations
  2021-01-13 20:02 [Bug fortran/98661] New: Valgrind errors during error recovery of invalid derived type declarations anlauf at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-01-14 18:24 ` anlauf at gcc dot gnu.org
@ 2021-01-15 20:52 ` anlauf at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-01-15 20:52 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #7 from anlauf at gcc dot gnu.org ---
Closing.

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

end of thread, other threads:[~2021-01-15 20:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-13 20:02 [Bug fortran/98661] New: Valgrind errors during error recovery of invalid derived type declarations anlauf at gcc dot gnu.org
2021-01-13 20:03 ` [Bug fortran/98661] " anlauf at gcc dot gnu.org
2021-01-13 20:26 ` dominiq at lps dot ens.fr
2021-01-13 20:47 ` anlauf at gcc dot gnu.org
2021-01-13 21:25 ` anlauf at gcc dot gnu.org
2021-01-14 18:14 ` cvs-commit at gcc dot gnu.org
2021-01-14 18:21 ` cvs-commit at gcc dot gnu.org
2021-01-14 18:24 ` anlauf at gcc dot gnu.org
2021-01-15 20:52 ` anlauf 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).