public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/105167] New: ICE in gfc_set_default_type, at fortran/symbol.cc:298
@ 2022-04-05 16:22 gscfq@t-online.de
  2022-04-05 16:22 ` [Bug fortran/105167] " gscfq@t-online.de
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gscfq@t-online.de @ 2022-04-05 16:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105167
           Summary: ICE in gfc_set_default_type, at fortran/symbol.cc:298
           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: ---

Gives an ICE with undefined "n" (also sporadically before 20210926) :


$ cat z1.f90
program p
   if ( len([character(n) :: '']) /= 0 ) stop
end


$ gfortran-12-20210905 -c z1.f90
z1.f90:2:23:

    2 |    if ( len([character(n) :: '']) /= 0 ) stop
      |                       1
Error: Scalar INTEGER expression expected at (1)
z1.f90:2:23:

    2 |    if ( len([character(n) :: '']) /= 0 ) stop
      |                       1
Error: Scalar INTEGER expression expected at (1)


$ gfortran-12-20220403 -c z1.f90
f951: internal compiler error: Segmentation fault
0xcce34f crash_signal
        ../../gcc/toplev.cc:322
0x7919da gfc_get_default_type(char const*, gfc_namespace*)
        ../../gcc/fortran/symbol.cc:231
0x795734 gfc_set_default_type(gfc_symbol*, int, gfc_namespace*)
        ../../gcc/fortran/symbol.cc:298
0x765671 resolve_variable
        ../../gcc/fortran/resolve.cc:5886
0x765671 gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.cc:7189
0x767024 gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.cc:12657
0x767024 resolve_charlen
        ../../gcc/fortran/resolve.cc:12607
0x773809 resolve_charlen
        ../../gcc/fortran/resolve.cc:12598
0x773809 resolve_types
        ../../gcc/fortran/resolve.cc:17482
0x76ecbc gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.cc:17599
0x756c44 resolve_all_program_units
        ../../gcc/fortran/parse.cc:6604
0x756c44 gfc_parse_file()
        ../../gcc/fortran/parse.cc:6860
0x7a47df gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:216

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

* [Bug fortran/105167] ICE in gfc_set_default_type, at fortran/symbol.cc:298
  2022-04-05 16:22 [Bug fortran/105167] New: ICE in gfc_set_default_type, at fortran/symbol.cc:298 gscfq@t-online.de
@ 2022-04-05 16:22 ` gscfq@t-online.de
  2022-04-05 18:19 ` kargl at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gscfq@t-online.de @ 2022-04-05 16:22 UTC (permalink / raw)
  To: gcc-bugs

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

G. Steinmetz <gscfq@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid,
                   |                            |ice-on-invalid-code

--- Comment #1 from G. Steinmetz <gscfq@t-online.de> ---


Interestingly, this type-spec "character(n)" with undefined "n"
is simply ignored in following test case :


$ cat z7.f90
program p
   print *, len([character(n) :: ''])
   print *, len([character(n) :: '1'])
   print *, len([character(n) :: '12'])
   print *, len([character(n) :: '123'])
   print *, len([character(n) :: '123456789'])
   print *, len([character(n) :: '1234567890123456789'])
end


$ gfortran-12-20220403 z7.f90 && ./a.out
           0
           1
           2
           3
           9
          19

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

* [Bug fortran/105167] ICE in gfc_set_default_type, at fortran/symbol.cc:298
  2022-04-05 16:22 [Bug fortran/105167] New: ICE in gfc_set_default_type, at fortran/symbol.cc:298 gscfq@t-online.de
  2022-04-05 16:22 ` [Bug fortran/105167] " gscfq@t-online.de
@ 2022-04-05 18:19 ` kargl at gcc dot gnu.org
  2022-04-05 18:20 ` kargl at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: kargl at gcc dot gnu.org @ 2022-04-05 18:19 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #2 from kargl at gcc dot gnu.org ---
Created attachment 52752
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52752&action=edit
Patch to fix PR

The problem is two-fold.  First, there is the infamous NULL pointer
dereference in resolve.cc(resolve_variable).  Second, if the variable
'n' is implicitly defined and it is in a PROGRAM or MODULE specification
part of the scoping unit, it cannot be a variable.

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

* [Bug fortran/105167] ICE in gfc_set_default_type, at fortran/symbol.cc:298
  2022-04-05 16:22 [Bug fortran/105167] New: ICE in gfc_set_default_type, at fortran/symbol.cc:298 gscfq@t-online.de
  2022-04-05 16:22 ` [Bug fortran/105167] " gscfq@t-online.de
  2022-04-05 18:19 ` kargl at gcc dot gnu.org
@ 2022-04-05 18:20 ` kargl at gcc dot gnu.org
  2023-02-13 21:39 ` anlauf at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: kargl at gcc dot gnu.org @ 2022-04-05 18:20 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-04-05
     Ever confirmed|0                           |1
           Priority|P3                          |P4
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |13.0

--- Comment #3 from kargl at gcc dot gnu.org ---
Patch attached.

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

* [Bug fortran/105167] ICE in gfc_set_default_type, at fortran/symbol.cc:298
  2022-04-05 16:22 [Bug fortran/105167] New: ICE in gfc_set_default_type, at fortran/symbol.cc:298 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-04-05 18:20 ` kargl at gcc dot gnu.org
@ 2023-02-13 21:39 ` anlauf at gcc dot gnu.org
  2023-04-26  6:55 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-02-13 21:39 UTC (permalink / raw)
  To: gcc-bugs

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

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 ---
(In reply to kargl from comment #3)
> Patch attached.

The patch fixes comment#0, but not e.g. this slight variation:

  if ( len([character(n+1) :: '']) /= 0 ) stop

valgrind produces long output ... :-(

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

* [Bug fortran/105167] ICE in gfc_set_default_type, at fortran/symbol.cc:298
  2022-04-05 16:22 [Bug fortran/105167] New: ICE in gfc_set_default_type, at fortran/symbol.cc:298 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2023-02-13 21:39 ` anlauf at gcc dot gnu.org
@ 2023-04-26  6:55 ` rguenth at gcc dot gnu.org
  2023-07-27  9:22 ` rguenth at gcc dot gnu.org
  2024-05-21  9:11 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-04-26  6:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.0                        |13.2

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.1 is being released, retargeting bugs to GCC 13.2.

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

* [Bug fortran/105167] ICE in gfc_set_default_type, at fortran/symbol.cc:298
  2022-04-05 16:22 [Bug fortran/105167] New: ICE in gfc_set_default_type, at fortran/symbol.cc:298 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2023-04-26  6:55 ` rguenth at gcc dot gnu.org
@ 2023-07-27  9:22 ` rguenth at gcc dot gnu.org
  2024-05-21  9:11 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-27  9:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.2                        |13.3

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.2 is being released, retargeting bugs to GCC 13.3.

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

* [Bug fortran/105167] ICE in gfc_set_default_type, at fortran/symbol.cc:298
  2022-04-05 16:22 [Bug fortran/105167] New: ICE in gfc_set_default_type, at fortran/symbol.cc:298 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2023-07-27  9:22 ` rguenth at gcc dot gnu.org
@ 2024-05-21  9:11 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-05-21  9:11 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.3                        |13.4

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 13.3 is being released, retargeting bugs to GCC 13.4.

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

end of thread, other threads:[~2024-05-21  9:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 16:22 [Bug fortran/105167] New: ICE in gfc_set_default_type, at fortran/symbol.cc:298 gscfq@t-online.de
2022-04-05 16:22 ` [Bug fortran/105167] " gscfq@t-online.de
2022-04-05 18:19 ` kargl at gcc dot gnu.org
2022-04-05 18:20 ` kargl at gcc dot gnu.org
2023-02-13 21:39 ` anlauf at gcc dot gnu.org
2023-04-26  6:55 ` rguenth at gcc dot gnu.org
2023-07-27  9:22 ` rguenth at gcc dot gnu.org
2024-05-21  9:11 ` jakub 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).