public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/100970] New: ICE in output_constructor_regular_field, at varasm.c:5514
@ 2021-06-08 17:10 gscfq@t-online.de
  2021-06-13 20:36 ` [Bug fortran/100970] " anlauf at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gscfq@t-online.de @ 2021-06-08 17:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100970
           Summary: ICE in output_constructor_regular_field, at
                    varasm.c:5514
           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: ---

These invalid codes (different shape for array assignment, see z0)
affect versions down to at least r5. Case z1 is silently accepted
(but not with -m32). I wonder how this could be related to pr100950.


$ cat z0.f90
module m
   integer :: a(1) = [1, 2]
end


$ cat z1.f90
module m
   type t
      integer :: a(1) = [1, 2]
      real, pointer :: b => null()
   end type
end


$ cat z2.f90
module m
   type t
      integer :: a(1) = [1, 2, 3]
      real, pointer :: b => null()
   end type
end


$ cat z3.f90
module m
   type t
      integer :: a(1) = [1, 2, 3, 4]
      real, pointer :: b => null()
   end type
end


$ cat z4.f90
module m
   type t
      integer :: a(1) = [1, 2, 3, 4, 5]
      real, pointer :: b => null()
   end type
   type(t) :: x
end


$ gfortran-12-20210606 -c z0.f90
z0.f90:2:18:

    2 |    integer :: a(1) = [1, 2]
      |                  1
Error: Different shape for array assignment at (1) on dimension 1 (1 and 2)

$ gfortran-12-20210606 -c z1.f90

$ gfortran-12-20210606 -c z4.f90
z4.f90:7:3:

    7 | end
      |   ^
internal compiler error: in output_constructor_regular_field, at varasm.c:5514
0xf3fdad output_constructor_regular_field
        ../../gcc/varasm.c:5514
0xf3fdad output_constructor
        ../../gcc/varasm.c:5820
0xf400ef output_constant
        ../../gcc/varasm.c:5172
0xf400ef assemble_variable_contents
        ../../gcc/varasm.c:2235
0xf47e8d assemble_variable(tree_node*, int, int, int)
        ../../gcc/varasm.c:2414
0xf4a18a varpool_node::assemble_decl()
        ../../gcc/varpool.c:595
0x8b0a8f output_in_order
        ../../gcc/cgraphunit.c:2135
0x8b0a8f symbol_table::compile()
        ../../gcc/cgraphunit.c:2353
0x8b33af symbol_table::compile()
        ../../gcc/cgraphunit.c:2540
0x8b33af symbol_table::finalize_compilation_unit()
        ../../gcc/cgraphunit.c:2537

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

* [Bug fortran/100970] ICE in output_constructor_regular_field, at varasm.c:5514
  2021-06-08 17:10 [Bug fortran/100970] New: ICE in output_constructor_regular_field, at varasm.c:5514 gscfq@t-online.de
@ 2021-06-13 20:36 ` anlauf at gcc dot gnu.org
  2021-10-24 14:36 ` dominiq at lps dot ens.fr
  2021-10-24 19:15 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-06-13 20:36 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-06-13

--- Comment #1 from anlauf at gcc dot gnu.org ---
Could be related to some other PRs involving initialization of derived types.
A missing check accepts invalid code, such as:

program m
  implicit none
  type t
     integer :: a(1) = [1, 2]
  end type
  type(t), parameter :: x(4) = t()
  print *, x
end

which prints:

           1           2           1           2

All versions tested down to at least 7 fail.

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

* [Bug fortran/100970] ICE in output_constructor_regular_field, at varasm.c:5514
  2021-06-08 17:10 [Bug fortran/100970] New: ICE in output_constructor_regular_field, at varasm.c:5514 gscfq@t-online.de
  2021-06-13 20:36 ` [Bug fortran/100970] " anlauf at gcc dot gnu.org
@ 2021-10-24 14:36 ` dominiq at lps dot ens.fr
  2021-10-24 19:15 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2021-10-24 14:36 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
This seems to have been fixed before r12-4638.

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

* [Bug fortran/100970] ICE in output_constructor_regular_field, at varasm.c:5514
  2021-06-08 17:10 [Bug fortran/100970] New: ICE in output_constructor_regular_field, at varasm.c:5514 gscfq@t-online.de
  2021-06-13 20:36 ` [Bug fortran/100970] " anlauf at gcc dot gnu.org
  2021-10-24 14:36 ` dominiq at lps dot ens.fr
@ 2021-10-24 19:15 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-10-24 19:15 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
                 CC|                            |anlauf at gcc dot gnu.org
         Resolution|---                         |DUPLICATE

--- Comment #3 from anlauf at gcc dot gnu.org ---
All ICEs and accepts-invalid reported here are fixed by r12-4452.

*** This bug has been marked as a duplicate of bug 102685 ***

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

end of thread, other threads:[~2021-10-24 19:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08 17:10 [Bug fortran/100970] New: ICE in output_constructor_regular_field, at varasm.c:5514 gscfq@t-online.de
2021-06-13 20:36 ` [Bug fortran/100970] " anlauf at gcc dot gnu.org
2021-10-24 14:36 ` dominiq at lps dot ens.fr
2021-10-24 19:15 ` 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).