public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/104349] New: ICE in (tree_to_uhwi) gfc_conv_array_initializer, at fortran/trans-array.cc:6337
@ 2022-02-02 18:38 gscfq@t-online.de
  2023-04-03 19:19 ` [Bug fortran/104349] " anlauf at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gscfq@t-online.de @ 2022-02-02 18:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104349
           Summary: ICE in (tree_to_uhwi) gfc_conv_array_initializer, at
                    fortran/trans-array.cc:6337
           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 :
(undefined value n)


$ cat z1.f90
module m
   character(n), parameter :: a(1) = 'a'
end


$ gfortran-12-20220130 -c z1.f90
f951: internal compiler error: in tree_to_uhwi, at tree.h:4677
0x7bca34 tree_to_uhwi(tree_node const*)
        ../../gcc/tree.h:4677
0x7bca34 gfc_conv_array_initializer(tree_node*, gfc_expr*)
        ../../gcc/fortran/trans-array.cc:6337
0x7ea120 gfc_conv_initializer(gfc_expr*, gfc_typespec*, tree_node*, bool, bool,
bool)
        ../../gcc/fortran/trans-expr.cc:8379
0x7cb64b gfc_get_symbol_decl(gfc_symbol*)
        ../../gcc/fortran/trans-decl.cc:1944
0x7ce468 gfc_create_module_variable
        ../../gcc/fortran/trans-decl.cc:5244
0x789ca2 do_traverse_symtree
        ../../gcc/fortran/symbol.cc:4174
0x7cec6b gfc_generate_module_vars(gfc_namespace*)
        ../../gcc/fortran/trans-decl.cc:5743
0x7a6544 gfc_generate_module_code(gfc_namespace*)
        ../../gcc/fortran/trans.cc:2309
0x751a9f translate_all_program_units
        ../../gcc/fortran/parse.cc:6638
0x751a9f gfc_parse_file()
        ../../gcc/fortran/parse.cc:6938
0x79eecf gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:216

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

* [Bug fortran/104349] ICE in (tree_to_uhwi) gfc_conv_array_initializer, at fortran/trans-array.cc:6337
  2022-02-02 18:38 [Bug fortran/104349] New: ICE in (tree_to_uhwi) gfc_conv_array_initializer, at fortran/trans-array.cc:6337 gscfq@t-online.de
@ 2023-04-03 19:19 ` anlauf at gcc dot gnu.org
  2023-04-03 19:46 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-04-03 19:19 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-04-03
                 CC|                            |anlauf at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from anlauf at gcc dot gnu.org ---
The following removal of two very old lines of code remove the ICE and
fix an accepts-invalid:

diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index 7fb33f81788..4b5529d7136 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -3504,8 +3509,8 @@ check_restricted (gfc_expr *e)
            || sym->attr.implied_index
            || sym->attr.flavor == FL_PARAMETER
            || is_parent_of_current_ns (sym->ns)
-           || (sym->ns->proc_name != NULL
-                 && sym->ns->proc_name->attr.flavor == FL_MODULE)
+           // || (sym->ns->proc_name != NULL
+           //    && sym->ns->proc_name->attr.flavor == FL_MODULE)
            || (gfc_is_formal_arg () && (sym->ns == gfc_current_ns)))
        {
          t = true;

Before, we would have silently accepted

module m
  character(n), parameter :: c    = 'b' ! accepts invalid
end

This change needs adjustment of the diagnostics for testcase
gfortran.dg/der_charlen_1.f90

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

* [Bug fortran/104349] ICE in (tree_to_uhwi) gfc_conv_array_initializer, at fortran/trans-array.cc:6337
  2022-02-02 18:38 [Bug fortran/104349] New: ICE in (tree_to_uhwi) gfc_conv_array_initializer, at fortran/trans-array.cc:6337 gscfq@t-online.de
  2023-04-03 19:19 ` [Bug fortran/104349] " anlauf at gcc dot gnu.org
@ 2023-04-03 19:46 ` anlauf at gcc dot gnu.org
  2023-04-04 16:50 ` cvs-commit at gcc dot gnu.org
  2023-04-04 16:55 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-04-03 19:46 UTC (permalink / raw)
  To: gcc-bugs

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

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 #2 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2023-April/059140.html

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

* [Bug fortran/104349] ICE in (tree_to_uhwi) gfc_conv_array_initializer, at fortran/trans-array.cc:6337
  2022-02-02 18:38 [Bug fortran/104349] New: ICE in (tree_to_uhwi) gfc_conv_array_initializer, at fortran/trans-array.cc:6337 gscfq@t-online.de
  2023-04-03 19:19 ` [Bug fortran/104349] " anlauf at gcc dot gnu.org
  2023-04-03 19:46 ` anlauf at gcc dot gnu.org
@ 2023-04-04 16:50 ` cvs-commit at gcc dot gnu.org
  2023-04-04 16:55 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-04 16:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:c57a93f647511cf7a3005f1197a1da03b5e3a1b0

commit r13-7003-gc57a93f647511cf7a3005f1197a1da03b5e3a1b0
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Apr 3 21:34:01 2023 +0200

    Fortran: reject module variable as character length in PARAMETER [PR104349]

    gcc/fortran/ChangeLog:

            PR fortran/104349
            * expr.cc (check_restricted): Adjust check for valid variables in
            restricted expressions: make no exception for module variables.

    gcc/testsuite/ChangeLog:

            PR fortran/104349
            * gfortran.dg/der_charlen_1.f90: Adjust dg-patterns.
            * gfortran.dg/pr104349.f90: New test.

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

* [Bug fortran/104349] ICE in (tree_to_uhwi) gfc_conv_array_initializer, at fortran/trans-array.cc:6337
  2022-02-02 18:38 [Bug fortran/104349] New: ICE in (tree_to_uhwi) gfc_conv_array_initializer, at fortran/trans-array.cc:6337 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2023-04-04 16:50 ` cvs-commit at gcc dot gnu.org
@ 2023-04-04 16:55 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-04-04 16:55 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #4 from anlauf at gcc dot gnu.org ---
Fixed in gcc-13.  Closing.

Thanks for the report!

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

end of thread, other threads:[~2023-04-04 16:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-02 18:38 [Bug fortran/104349] New: ICE in (tree_to_uhwi) gfc_conv_array_initializer, at fortran/trans-array.cc:6337 gscfq@t-online.de
2023-04-03 19:19 ` [Bug fortran/104349] " anlauf at gcc dot gnu.org
2023-04-03 19:46 ` anlauf at gcc dot gnu.org
2023-04-04 16:50 ` cvs-commit at gcc dot gnu.org
2023-04-04 16:55 ` 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).