public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/107559] New: ICE in resolve_equivalence, at fortran/resolve.cc:17230
@ 2022-11-07 18:15 gscfq@t-online.de
  2022-11-07 19:59 ` [Bug fortran/107559] " anlauf at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gscfq@t-online.de @ 2022-11-07 18:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107559
           Summary: ICE in resolve_equivalence, at
                    fortran/resolve.cc:17230
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Affects versions down to at least r5 :


$ cat z1.f90
module m
   implicit none
   integer, protected :: a
   integer :: b
   equivalence (a, b)
end


$ gfortran-13-20221106 -c z1.f90
z1.f90:5:18:

    5 |    equivalence (a, b)
      |                  1
Error: Either all or none of the objects in the EQUIVALENCE set at (1) shall
have the PROTECTED attribute


$ gfortran-13-20221106 -c z1.f90 -std=f95
z1.f90:3:25:

    3 |    integer, protected :: a
      |                         1
Error: Fortran 2003: PROTECTED attribute at (1)
z1.f90:5:17:

    5 |    equivalence (a, b)
      |                 1
Error: Symbol 'a' at (1) has no IMPLICIT type

Segmentation fault
0xf4697f crash_signal
        ../../gcc/toplev.cc:314
0x7faa18 gfc_format_decoder
        ../../gcc/fortran/error.cc:1071
0x1f8bff0 pp_format(pretty_printer*, text_info*)
        ../../gcc/pretty-print.cc:1475
0x1f6af10 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
        ../../gcc/diagnostic.cc:1548
0x7fabd9 gfc_report_diagnostic
        ../../gcc/fortran/error.cc:883
0x7fad68 gfc_error_opt
        ../../gcc/fortran/error.cc:1453
0x7fbb20 gfc_notify_std(int, char const*, ...)
        ../../gcc/fortran/error.cc:1037
0x87f5de resolve_equivalence
        ../../gcc/fortran/resolve.cc:17230
0x87f5de resolve_types
        ../../gcc/fortran/resolve.cc:17575
0x87a43c gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.cc:17657
0x862012 gfc_parse_file()
        ../../gcc/fortran/parse.cc:6837
0x8b0c8f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:229

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

* [Bug fortran/107559] ICE in resolve_equivalence, at fortran/resolve.cc:17230
  2022-11-07 18:15 [Bug fortran/107559] New: ICE in resolve_equivalence, at fortran/resolve.cc:17230 gscfq@t-online.de
@ 2022-11-07 19:59 ` anlauf at gcc dot gnu.org
  2022-11-09 20:11 ` cvs-commit at gcc dot gnu.org
  2022-11-09 20:20 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-11-07 19:59 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-11-07
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #1 from anlauf at gcc dot gnu.org ---
Another NULL pointer dereference.  Potential fix:

diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 9202e2f10ad..5ff1cd070ac 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -17218,6 +17218,7 @@ resolve_equivalence (gfc_equiv *eq)
            "statement at %L with different type objects";
       if ((object ==2
           && last_eq_type == SEQ_MIXED
+          && last_where
           && !gfc_notify_std (GFC_STD_GNU, msg, first_sym->name, last_where))
          || (eq_type == SEQ_MIXED
              && !gfc_notify_std (GFC_STD_GNU, msg, sym->name, &e->where)))
@@ -17227,6 +17228,7 @@ resolve_equivalence (gfc_equiv *eq)
            "statement at %L with objects of different type";
       if ((object ==2
           && last_eq_type == SEQ_NONDEFAULT
+          && last_where
           && !gfc_notify_std (GFC_STD_GNU, msg, first_sym->name, last_where))
          || (eq_type == SEQ_NONDEFAULT
              && !gfc_notify_std (GFC_STD_GNU, msg, sym->name, &e->where)))

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

* [Bug fortran/107559] ICE in resolve_equivalence, at fortran/resolve.cc:17230
  2022-11-07 18:15 [Bug fortran/107559] New: ICE in resolve_equivalence, at fortran/resolve.cc:17230 gscfq@t-online.de
  2022-11-07 19:59 ` [Bug fortran/107559] " anlauf at gcc dot gnu.org
@ 2022-11-09 20:11 ` cvs-commit at gcc dot gnu.org
  2022-11-09 20:20 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-09 20:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:e505f7493bed1395d121d2f53137ec11706fa42e

commit r13-3865-ge505f7493bed1395d121d2f53137ec11706fa42e
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Nov 9 21:05:28 2022 +0100

    Fortran: avoid NULL pointer dereference on bad EQUIVALENCEs [PR107559]

    gcc/fortran/ChangeLog:

            PR fortran/107559
            * resolve.cc (resolve_equivalence): Avoid NULL pointer dereference
            while emitting diagnostics for bad EQUIVALENCEs.

    gcc/testsuite/ChangeLog:

            PR fortran/107559
            * gfortran.dg/pr107559.f90: New test.

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

* [Bug fortran/107559] ICE in resolve_equivalence, at fortran/resolve.cc:17230
  2022-11-07 18:15 [Bug fortran/107559] New: ICE in resolve_equivalence, at fortran/resolve.cc:17230 gscfq@t-online.de
  2022-11-07 19:59 ` [Bug fortran/107559] " anlauf at gcc dot gnu.org
  2022-11-09 20:11 ` cvs-commit at gcc dot gnu.org
@ 2022-11-09 20:20 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-11-09 20:20 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |13.0
         Resolution|---                         |FIXED

--- Comment #3 from anlauf at gcc dot gnu.org ---
Fixed on mainline.  Closing.

Thanks for the report!

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

end of thread, other threads:[~2022-11-09 20:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07 18:15 [Bug fortran/107559] New: ICE in resolve_equivalence, at fortran/resolve.cc:17230 gscfq@t-online.de
2022-11-07 19:59 ` [Bug fortran/107559] " anlauf at gcc dot gnu.org
2022-11-09 20:11 ` cvs-commit at gcc dot gnu.org
2022-11-09 20:20 ` 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).