public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103259] New: [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956
@ 2021-11-15 18:25 gscfq@t-online.de
  2021-11-15 19:54 ` [Bug fortran/103259] " kargl at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: gscfq@t-online.de @ 2021-11-15 18:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103259
           Summary: [11/12 Regression] ICE in resolve_common_vars, at
                    fortran/resolve.c:956
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Changed between 20201004 and 20201018 :


$ cat z1.f90
module m
   integer :: p
   common /q/ p
end
program p
   use m
end


$ gfortran-12-20211114 -c z1.f90
z1.f90:6:8:

    6 |    use m
      |        1
Error: 'p' of module 'm', imported at (1), is also the name of the current
program unit

Segmentation fault
0xf04a8f crash_signal
        ../../gcc/toplev.c:322
0x7d6bd8 gfc_format_decoder
        ../../gcc/fortran/error.c:1062
0x1d8de90 pp_format(pretty_printer*, text_info*)
        ../../gcc/pretty-print.c:1475
0x1d6ff25 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
        ../../gcc/diagnostic.c:1346
0x7d6d99 gfc_report_diagnostic
        ../../gcc/fortran/error.c:874
0x7d83a0 gfc_error_now(char const*, ...)
        ../../gcc/fortran/error.c:1343
0x84287a resolve_common_vars
        ../../gcc/fortran/resolve.c:956
0x842a5d resolve_common_blocks
        ../../gcc/fortran/resolve.c:1024
0x857e36 resolve_types
        ../../gcc/fortran/resolve.c:17440
0x8533bc gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.c:17568
0x83b684 resolve_all_program_units
        ../../gcc/fortran/parse.c:6573
0x83b684 gfc_parse_file()
        ../../gcc/fortran/parse.c:6829
0x8896bf gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:216

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

* [Bug fortran/103259] [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956
  2021-11-15 18:25 [Bug fortran/103259] New: [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 gscfq@t-online.de
@ 2021-11-15 19:54 ` kargl at gcc dot gnu.org
  2021-11-16  8:27 ` [Bug fortran/103259] [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 since r11-3866-g4d2a56a0f7135469 marxin at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-11-15 19:54 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |kargl at gcc dot gnu.org
           Priority|P3                          |P4
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-11-15

--- Comment #1 from kargl at gcc dot gnu.org ---
Avoid a NULL pointer dereference.

diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 705d2326a29..b0777e27512 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -953,9 +953,15 @@ resolve_common_vars (gfc_common_head *common_block, bool
named_common)
     {
       gsym = gfc_find_gsymbol (gfc_gsym_root, csym->name);
       if (gsym && (gsym->type == GSYM_MODULE || gsym->type == GSYM_PROGRAM))
-       gfc_error_now ("Global entity %qs at %L cannot appear in a "
-                       "COMMON block at %L", gsym->name,
-                       &gsym->where, &csym->common_block->where);
+       {
+         if (csym->common_block)
+           gfc_error_now ("Global entity %qs at %L cannot appear in a "
+                          "COMMON block at %L", gsym->name, &gsym->where,
+                          &csym->common_block->where);
+         else
+           gfc_error_now ("Global entity %qs at %L cannot appear in a "
+                          "COMMON block", gsym->name, &gsym->where);
+       }

       /* gfc_add_in_common may have been called before, but the reported
errors
         have been ignored to continue parsing.

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

* [Bug fortran/103259] [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 since r11-3866-g4d2a56a0f7135469
  2021-11-15 18:25 [Bug fortran/103259] New: [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 gscfq@t-online.de
  2021-11-15 19:54 ` [Bug fortran/103259] " kargl at gcc dot gnu.org
@ 2021-11-16  8:27 ` marxin at gcc dot gnu.org
  2021-11-16  9:36 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-16  8:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |markeggleston at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
            Summary|[11/12 Regression] ICE in   |[11/12 Regression] ICE in
                   |resolve_common_vars, at     |resolve_common_vars, at
                   |fortran/resolve.c:956       |fortran/resolve.c:956 since
                   |                            |r11-3866-g4d2a56a0f7135469

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r11-3866-g4d2a56a0f7135469.

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

* [Bug fortran/103259] [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 since r11-3866-g4d2a56a0f7135469
  2021-11-15 18:25 [Bug fortran/103259] New: [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 gscfq@t-online.de
  2021-11-15 19:54 ` [Bug fortran/103259] " kargl at gcc dot gnu.org
  2021-11-16  8:27 ` [Bug fortran/103259] [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 since r11-3866-g4d2a56a0f7135469 marxin at gcc dot gnu.org
@ 2021-11-16  9:36 ` rguenth at gcc dot gnu.org
  2022-04-21  7:50 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-16  9:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.3

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

* [Bug fortran/103259] [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 since r11-3866-g4d2a56a0f7135469
  2021-11-15 18:25 [Bug fortran/103259] New: [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-11-16  9:36 ` rguenth at gcc dot gnu.org
@ 2022-04-21  7:50 ` rguenth at gcc dot gnu.org
  2023-02-06 21:49 ` [Bug fortran/103259] [11/12/13 " anlauf at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-21  7:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.3                        |11.4

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.3 is being released, retargeting bugs to GCC 11.4.

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

* [Bug fortran/103259] [11/12/13 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 since r11-3866-g4d2a56a0f7135469
  2021-11-15 18:25 [Bug fortran/103259] New: [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2022-04-21  7:50 ` rguenth at gcc dot gnu.org
@ 2023-02-06 21:49 ` anlauf at gcc dot gnu.org
  2023-02-07 19:37 ` anlauf at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-02-06 21:49 UTC (permalink / raw)
  To: gcc-bugs

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

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 ---
The patch looks fine, but we might prefer to avoid gfc_error_now here.
I can take care of it.

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

* [Bug fortran/103259] [11/12/13 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 since r11-3866-g4d2a56a0f7135469
  2021-11-15 18:25 [Bug fortran/103259] New: [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2023-02-06 21:49 ` [Bug fortran/103259] [11/12/13 " anlauf at gcc dot gnu.org
@ 2023-02-07 19:37 ` anlauf at gcc dot gnu.org
  2023-02-08 18:15 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-02-07 19:37 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #5 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2023-February/058893.html

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

* [Bug fortran/103259] [11/12/13 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 since r11-3866-g4d2a56a0f7135469
  2021-11-15 18:25 [Bug fortran/103259] New: [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2023-02-07 19:37 ` anlauf at gcc dot gnu.org
@ 2023-02-08 18:15 ` cvs-commit at gcc dot gnu.org
  2023-02-09 20:13 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-08 18:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 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:7e9f20f5517429cfaadec14d6b04705e59078565

commit r13-5743-g7e9f20f5517429cfaadec14d6b04705e59078565
Author: Steve Kargl <kargl@gcc.gnu.org>
Date:   Tue Feb 7 20:18:42 2023 +0100

    Fortran: error handling of global entity appearing in COMMON block
[PR103259]

    gcc/fortran/ChangeLog:

            PR fortran/103259
            * resolve.cc (resolve_common_vars): Avoid NULL pointer dereference
            when a symbol's location is not set.

    gcc/testsuite/ChangeLog:

            PR fortran/103259
            * gfortran.dg/pr103259.f90: New test.

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

* [Bug fortran/103259] [11/12/13 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 since r11-3866-g4d2a56a0f7135469
  2021-11-15 18:25 [Bug fortran/103259] New: [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2023-02-08 18:15 ` cvs-commit at gcc dot gnu.org
@ 2023-02-09 20:13 ` cvs-commit at gcc dot gnu.org
  2023-02-10 19:30 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-09 20:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:2b3352b5d65bdb3fd612bbe0abe336226987d602

commit r12-9118-g2b3352b5d65bdb3fd612bbe0abe336226987d602
Author: Steve Kargl <kargl@gcc.gnu.org>
Date:   Tue Feb 7 20:18:42 2023 +0100

    Fortran: error handling of global entity appearing in COMMON block
[PR103259]

    gcc/fortran/ChangeLog:

            PR fortran/103259
            * resolve.cc (resolve_common_vars): Avoid NULL pointer dereference
            when a symbol's location is not set.

    gcc/testsuite/ChangeLog:

            PR fortran/103259
            * gfortran.dg/pr103259.f90: New test.

    (cherry picked from commit 7e9f20f5517429cfaadec14d6b04705e59078565)

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

* [Bug fortran/103259] [11/12/13 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 since r11-3866-g4d2a56a0f7135469
  2021-11-15 18:25 [Bug fortran/103259] New: [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2023-02-09 20:13 ` cvs-commit at gcc dot gnu.org
@ 2023-02-10 19:30 ` cvs-commit at gcc dot gnu.org
  2023-02-10 19:31 ` anlauf at gcc dot gnu.org
  2023-06-01 17:46 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-10 19:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:0f1bc8f39c46223897d13d23fefcd456da91b203

commit r11-10517-g0f1bc8f39c46223897d13d23fefcd456da91b203
Author: Steve Kargl <kargl@gcc.gnu.org>
Date:   Tue Feb 7 20:18:42 2023 +0100

    Fortran: error handling of global entity appearing in COMMON block
[PR103259]

    gcc/fortran/ChangeLog:

            PR fortran/103259
            * resolve.c (resolve_common_vars): Avoid NULL pointer dereference
            when a symbol's location is not set.

    gcc/testsuite/ChangeLog:

            PR fortran/103259
            * gfortran.dg/pr103259.f90: New test.

    (cherry picked from commit 7e9f20f5517429cfaadec14d6b04705e59078565)

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

* [Bug fortran/103259] [11/12/13 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 since r11-3866-g4d2a56a0f7135469
  2021-11-15 18:25 [Bug fortran/103259] New: [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 gscfq@t-online.de
                   ` (8 preceding siblings ...)
  2023-02-10 19:30 ` cvs-commit at gcc dot gnu.org
@ 2023-02-10 19:31 ` anlauf at gcc dot gnu.org
  2023-06-01 17:46 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-02-10 19:31 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #9 from anlauf at gcc dot gnu.org ---
Fixed on all affected branches.  Closing.

Thanks for the report, and to Steve for the fix!

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

* [Bug fortran/103259] [11/12/13 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 since r11-3866-g4d2a56a0f7135469
  2021-11-15 18:25 [Bug fortran/103259] New: [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 gscfq@t-online.de
                   ` (9 preceding siblings ...)
  2023-02-10 19:31 ` anlauf at gcc dot gnu.org
@ 2023-06-01 17:46 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-06-01 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrew at fluidgravity dot co.uk

--- Comment #10 from anlauf at gcc dot gnu.org ---
*** Bug 110081 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2023-06-01 17:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 18:25 [Bug fortran/103259] New: [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 gscfq@t-online.de
2021-11-15 19:54 ` [Bug fortran/103259] " kargl at gcc dot gnu.org
2021-11-16  8:27 ` [Bug fortran/103259] [11/12 Regression] ICE in resolve_common_vars, at fortran/resolve.c:956 since r11-3866-g4d2a56a0f7135469 marxin at gcc dot gnu.org
2021-11-16  9:36 ` rguenth at gcc dot gnu.org
2022-04-21  7:50 ` rguenth at gcc dot gnu.org
2023-02-06 21:49 ` [Bug fortran/103259] [11/12/13 " anlauf at gcc dot gnu.org
2023-02-07 19:37 ` anlauf at gcc dot gnu.org
2023-02-08 18:15 ` cvs-commit at gcc dot gnu.org
2023-02-09 20:13 ` cvs-commit at gcc dot gnu.org
2023-02-10 19:30 ` cvs-commit at gcc dot gnu.org
2023-02-10 19:31 ` anlauf at gcc dot gnu.org
2023-06-01 17:46 ` 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).