public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/102315] New: ICE tree check: expected integer_cst, have save_expr in gfc_trans_array_constructor_value, at fortran/trans-array.c:2056
@ 2021-09-13 17:31 gscfq@t-online.de
  2021-09-14  7:27 ` [Bug fortran/102315] " marxin at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gscfq@t-online.de @ 2021-09-13 17:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102315
           Summary: ICE tree check: expected integer_cst, have save_expr
                    in gfc_trans_array_constructor_value, at
                    fortran/trans-array.c:2056
           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: ---

This ICE affects versions down to at least r5 :
(gcc configured with --enable-checking=yes)


$ cat z1.f90
program p
   character(4) :: x = '123'
   character(8) :: y(5)
   y = [[character(8) :: 'a'//trim(x), 'b', 'c', 'd', 'e']]
   print *, y
end


$ gfortran-12-20210905 -c z1.f90
z1.f90:4:59:

    4 |    y = [[character(8) :: 'a'//trim(x), 'b', 'c', 'd', 'e']]
      |                                                           1
internal compiler error: tree check: expected integer_cst, have save_expr in
gfc_trans_array_constructor_value, at fortran/trans-array.c:2056
0x67e390 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/tree.c:8688
0x86acd9 tree_int_cst_elt_check(tree_node*, int, char const*, int, char const*)
        ../../gcc/tree.h:3618
0x86acd9 gfc_trans_array_constructor_value
        ../../gcc/fortran/trans-array.c:2056
0x86b678 trans_array_constructor
        ../../gcc/fortran/trans-array.c:2769
0x86b678 gfc_add_loop_ss_code
        ../../gcc/fortran/trans-array.c:3049
0x86bdd5 gfc_conv_loop_setup(gfc_loopinfo*, locus*)
        ../../gcc/fortran/trans-array.c:5294
0x8aa21d gfc_trans_assignment_1
        ../../gcc/fortran/trans-expr.c:11273
0x8599d7 trans_code
        ../../gcc/fortran/trans.c:1918
0x88ca85 gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.c:6918
0x803e96 translate_all_program_units
        ../../gcc/fortran/parse.c:6569
0x803e96 gfc_parse_file()
        ../../gcc/fortran/parse.c:6838
0x8510ff gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:216

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

* [Bug fortran/102315] ICE tree check: expected integer_cst, have save_expr in gfc_trans_array_constructor_value, at fortran/trans-array.c:2056
  2021-09-13 17:31 [Bug fortran/102315] New: ICE tree check: expected integer_cst, have save_expr in gfc_trans_array_constructor_value, at fortran/trans-array.c:2056 gscfq@t-online.de
@ 2021-09-14  7:27 ` marxin at gcc dot gnu.org
  2021-09-15 21:04 ` anlauf at gcc dot gnu.org
  2021-09-20 19:08 ` gscfq@t-online.de
  2 siblings, 0 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-09-14  7:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-09-14
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Yes, it's old, at least 4.8.0+.

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

* [Bug fortran/102315] ICE tree check: expected integer_cst, have save_expr in gfc_trans_array_constructor_value, at fortran/trans-array.c:2056
  2021-09-13 17:31 [Bug fortran/102315] New: ICE tree check: expected integer_cst, have save_expr in gfc_trans_array_constructor_value, at fortran/trans-array.c:2056 gscfq@t-online.de
  2021-09-14  7:27 ` [Bug fortran/102315] " marxin at gcc dot gnu.org
@ 2021-09-15 21:04 ` anlauf at gcc dot gnu.org
  2021-09-20 19:08 ` gscfq@t-online.de
  2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-09-15 21:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
Looks familiar, and I am pretty sure there's a duplicate.

Removing one set of [] makes the code compile:

  y = [character(8) :: 'a'//trim(x), 'b', 'c', 'd', 'e']

is obviously "fine".

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

* [Bug fortran/102315] ICE tree check: expected integer_cst, have save_expr in gfc_trans_array_constructor_value, at fortran/trans-array.c:2056
  2021-09-13 17:31 [Bug fortran/102315] New: ICE tree check: expected integer_cst, have save_expr in gfc_trans_array_constructor_value, at fortran/trans-array.c:2056 gscfq@t-online.de
  2021-09-14  7:27 ` [Bug fortran/102315] " marxin at gcc dot gnu.org
  2021-09-15 21:04 ` anlauf at gcc dot gnu.org
@ 2021-09-20 19:08 ` gscfq@t-online.de
  2 siblings, 0 replies; 4+ messages in thread
From: gscfq@t-online.de @ 2021-09-20 19:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

A reduced variant with the same ICE :

$ cat z2.f90
program p
   character :: x = 'a'
   character :: y(5)
   y = [[trim(x), 'b', 'c', 'd', 'e']]
   print *, y
end



But z1 gives additional hints when reduced to four or less
array elements. It compiles and runs correctly, like :

$ cat za1.f90
program p
   character(4) :: x = '123'
   character(8) :: y(4)
   y = [[character(8) :: 'a'//trim(x), 'b', 'c', 'd']]
   print *, y
end

$ gfortran-12-20210919 za1.f90 && ./a.out
 a123    b       c       d


And it fails with a wrong runtime error when adding checks via
-fcheck=bounds or -fcheck=all :

$ gfortran-12-20210919 za1.f90 -g -fcheck=all && ./a.out
At line 4 of file za1.f90
Fortran runtime error: Different CHARACTER lengths (4/8) in array constructor

Error termination. Backtrace:
#0  0x4026b7 in p
        at .../za1.f90:4
#1  0x4029c9 in main
        at .../za1.f90:6


That unique error message comes from line 1787 in trans-array.c

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

end of thread, other threads:[~2021-09-20 19:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13 17:31 [Bug fortran/102315] New: ICE tree check: expected integer_cst, have save_expr in gfc_trans_array_constructor_value, at fortran/trans-array.c:2056 gscfq@t-online.de
2021-09-14  7:27 ` [Bug fortran/102315] " marxin at gcc dot gnu.org
2021-09-15 21:04 ` anlauf at gcc dot gnu.org
2021-09-20 19:08 ` gscfq@t-online.de

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).