public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/104626] New: ICE in gfc_format_decoder, at fortran/error.cc:1071
@ 2022-02-21 21:33 gscfq@t-online.de
  2022-02-21 23:17 ` [Bug fortran/104626] " kargl at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gscfq@t-online.de @ 2022-02-21 21:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104626
           Summary: ICE in gfc_format_decoder, at fortran/error.cc:1071
           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: ---

Affects versions down to at least r5 :


$ cat z1.f90
program p
   procedure(g), save :: f
   procedure(g), save :: f
contains
   subroutine g
   end
end


$ cat z2.f90
program p
   procedure(g), save :: f
contains
   subroutine g
   end
end


$ gfortran-12-20220220 -c z2.f90
z2.f90:2:26:

    2 |    procedure(g), save :: f
      |                          1
Error: PROCEDURE attribute conflicts with SAVE attribute in 'f' at (1)


$ gfortran-12-20220220 -c z1.f90
0xe7133f crash_signal
        ../../gcc/toplev.cc:322
0x72db98 gfc_format_decoder
        ../../gcc/fortran/error.cc:1071
0x1e7e570 pp_format(pretty_printer*, text_info*)
        ../../gcc/pretty-print.cc:1475
0x1e60195 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
        ../../gcc/diagnostic.cc:1384
0x72da91 gfc_report_diagnostic
        ../../gcc/fortran/error.cc:883
0x72da91 gfc_warning
        ../../gcc/fortran/error.cc:916
0x72ebc1 gfc_notify_std(int, char const*, ...)
        ../../gcc/fortran/error.cc:1039
0x7ce70c gfc_add_save(symbol_attribute*, save_state, char const*, locus*)
        ../../gcc/fortran/symbol.cc:1314
0x7d0070 gfc_copy_attr(symbol_attribute*, symbol_attribute*, locus*)
        ../../gcc/fortran/symbol.cc:2093
0x721a5b match_procedure_decl
        ../../gcc/fortran/decl.cc:7064
0x721a5b gfc_match_procedure()
        ../../gcc/fortran/decl.cc:7365
0x787501 match_word
        ../../gcc/fortran/parse.cc:67
0x78d0a6 decode_statement
        ../../gcc/fortran/parse.cc:544
0x78d46a next_free
        ../../gcc/fortran/parse.cc:1397
0x78d46a next_statement
        ../../gcc/fortran/parse.cc:1629
0x78e9fb parse_spec
        ../../gcc/fortran/parse.cc:4168
0x791b4c parse_progunit
        ../../gcc/fortran/parse.cc:6192
0x793211 gfc_parse_file()
        ../../gcc/fortran/parse.cc:6737
0x7e154f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:216

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

* [Bug fortran/104626] ICE in gfc_format_decoder, at fortran/error.cc:1071
  2022-02-21 21:33 [Bug fortran/104626] New: ICE in gfc_format_decoder, at fortran/error.cc:1071 gscfq@t-online.de
@ 2022-02-21 23:17 ` kargl at gcc dot gnu.org
  2023-05-29 23:57 ` kargl at gcc dot gnu.org
  2023-10-13 20:12 ` jvdelisle at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2022-02-21 23:17 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

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

--- Comment #1 from kargl at gcc dot gnu.org ---
NULL pointer deference.  While here, fix formatting.

diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc
index 7a80dfd063b..a1580708f89 100644
--- a/gcc/fortran/symbol.cc
+++ b/gcc/fortran/symbol.cc
@@ -1299,9 +1299,8 @@ gfc_add_save (symbol_attribute *attr, save_state s, const
char *name,

   if (s == SAVE_EXPLICIT && gfc_pure (NULL))
     {
-      gfc_error
-       ("SAVE attribute at %L cannot be specified in a PURE procedure",
-        where);
+      gfc_error ("SAVE attribute at %L cannot be specified in a PURE "
+                "procedure", where);
       return false;
     }

@@ -1311,10 +1310,15 @@ gfc_add_save (symbol_attribute *attr, save_state s,
const char *name,
   if (s == SAVE_EXPLICIT && attr->save == SAVE_EXPLICIT
       && (flag_automatic || pedantic))
     {
-       if (!gfc_notify_std (GFC_STD_LEGACY,
-                            "Duplicate SAVE attribute specified at %L",
-                            where))
+      if (!where)
+       {
+         gfc_error ("Duplicate SAVE attribute specified near %C");
          return false;
+       }
+
+      if (!gfc_notify_std (GFC_STD_LEGACY, "Duplicate SAVE attribute "
+                          "specified at %L", where))
+       return false;
     }

   attr->save = s;

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

* [Bug fortran/104626] ICE in gfc_format_decoder, at fortran/error.cc:1071
  2022-02-21 21:33 [Bug fortran/104626] New: ICE in gfc_format_decoder, at fortran/error.cc:1071 gscfq@t-online.de
  2022-02-21 23:17 ` [Bug fortran/104626] " kargl at gcc dot gnu.org
@ 2023-05-29 23:57 ` kargl at gcc dot gnu.org
  2023-10-13 20:12 ` jvdelisle at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2023-05-29 23:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from kargl at gcc dot gnu.org ---
Created attachment 55193
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55193&action=edit
patch from comment #2, which fixes the bug

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

* [Bug fortran/104626] ICE in gfc_format_decoder, at fortran/error.cc:1071
  2022-02-21 21:33 [Bug fortran/104626] New: ICE in gfc_format_decoder, at fortran/error.cc:1071 gscfq@t-online.de
  2022-02-21 23:17 ` [Bug fortran/104626] " kargl at gcc dot gnu.org
  2023-05-29 23:57 ` kargl at gcc dot gnu.org
@ 2023-10-13 20:12 ` jvdelisle at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2023-10-13 20:12 UTC (permalink / raw)
  To: gcc-bugs

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

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

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

--- Comment #3 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
I will take this to get the fix committed if it tests OK here.

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

end of thread, other threads:[~2023-10-13 20:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-21 21:33 [Bug fortran/104626] New: ICE in gfc_format_decoder, at fortran/error.cc:1071 gscfq@t-online.de
2022-02-21 23:17 ` [Bug fortran/104626] " kargl at gcc dot gnu.org
2023-05-29 23:57 ` kargl at gcc dot gnu.org
2023-10-13 20:12 ` jvdelisle 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).