public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95543] New: ICE in is_CFI_desc, at fortran/expr.c:1080
@ 2020-06-04 18:15 gscfq@t-online.de
  2020-06-06 16:08 ` [Bug fortran/95543] [PDT] " kargl at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gscfq@t-online.de @ 2020-06-04 18:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95543
           Summary: ICE in is_CFI_desc, at fortran/expr.c:1080
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

This started with r8, before 20180525 :


$ cat z1.f90
program p
   type t(a, b)
      integer, kind :: a = 4
      integer, kind :: b = a + 4
   end type
   type(t()) :: z
   print *, z
end


$ cat z2.f90
program p
   type t(a, b)
      integer, kind :: a = 1
      integer, kind :: b = a
   end type
   type(t) :: z
   print *, z
end


$ cat z3v.f90
program p
   type t(a, b)
      integer, kind :: a = 1
      integer, kind :: b = a
   end type
   type(t(4)) :: z
   print *, z
end


$ cat z4v.f90
program p
   type t(a, b)
      integer, kind :: a = 4
      integer, kind :: b = a + 4
   end type
   type(t(b=6)) :: z
   print *, z
end


$ gfortran-11-20200531 -c z1.f90
z1.f90:8:0:

    8 | end
      |
internal compiler error: Segmentation fault
0xbc37bf crash_signal
        ../../gcc/toplev.c:328
0x65843b is_CFI_desc(gfc_symbol*, gfc_expr*)
        ../../gcc/fortran/expr.c:1080
0x7268d8 gfc_get_symbol_decl(gfc_symbol*)
        ../../gcc/fortran/trans-decl.c:1555
0x735e68 gfc_conv_variable
        ../../gcc/fortran/trans-expr.c:2734
0x73207a gfc_conv_expr(gfc_se*, gfc_expr*)
        ../../gcc/fortran/trans-expr.c:8690
0x7321d2 gfc_conv_expr_op
        ../../gcc/fortran/trans-expr.c:3626
0x7321d2 gfc_conv_expr(gfc_se*, gfc_expr*)
        ../../gcc/fortran/trans-expr.c:8678
0x734ed3 gfc_conv_expr_val(gfc_se*, gfc_expr*)
        ../../gcc/fortran/trans-expr.c:8735
0x735020 gfc_conv_expr_type(gfc_se*, gfc_expr*, tree_node*)
        ../../gcc/fortran/trans-expr.c:8749
0x7167c3 structure_alloc_comps
        ../../gcc/fortran/trans-array.c:9491
0x719a66 gfc_allocate_pdt_comp(gfc_symbol*, tree_node*, int,
gfc_actual_arglist*)
        ../../gcc/fortran/trans-array.c:9879
0x728a30 gfc_trans_deferred_vars(gfc_symbol*, gfc_wrapped_block*)
        ../../gcc/fortran/trans-decl.c:4670
0x72ae08 gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.c:6945
0x6b25e6 translate_all_program_units
        ../../gcc/fortran/parse.c:6306
0x6b25e6 gfc_parse_file()
        ../../gcc/fortran/parse.c:6545
0x6fdfff gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:210

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

* [Bug fortran/95543] [PDT] ICE in is_CFI_desc, at fortran/expr.c:1080
  2020-06-04 18:15 [Bug fortran/95543] New: ICE in is_CFI_desc, at fortran/expr.c:1080 gscfq@t-online.de
@ 2020-06-06 16:08 ` kargl at gcc dot gnu.org
  2020-06-06 16:34 ` kargl at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2020-06-06 16:08 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE in is_CFI_desc, at      |[PDT] ICE in is_CFI_desc,
                   |fortran/expr.c:1080         |at fortran/expr.c:1080
   Last reconfirmed|                            |2020-06-06
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
           Priority|P3                          |P4
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #1 from kargl at gcc dot gnu.org ---
Yet, another PDT bug.

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

* [Bug fortran/95543] [PDT] ICE in is_CFI_desc, at fortran/expr.c:1080
  2020-06-04 18:15 [Bug fortran/95543] New: ICE in is_CFI_desc, at fortran/expr.c:1080 gscfq@t-online.de
  2020-06-06 16:08 ` [Bug fortran/95543] [PDT] " kargl at gcc dot gnu.org
@ 2020-06-06 16:34 ` kargl at gcc dot gnu.org
  2020-06-06 17:13 ` sgk at troutmask dot apl.washington.edu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2020-06-06 16:34 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code

--- Comment #2 from kargl at gcc dot gnu.org ---
This cures the ICE, which then I believe leads to wrong-code.

Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c    (revision 280157)
+++ gcc/fortran/trans-decl.c    (working copy)
@@ -708,7 +708,7 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
      are SAVE_NONE but have an initializer.  Otherwise explicitly
      initialized variables are SAVE_IMPLICIT and explicitly saved are
      SAVE_EXPLICIT.  */
-  if (!sym->attr.use_assoc
+  if (!sym->attr.use_assoc && !sym->attr.pdt_kind && !sym->attr.pdt_len
        && (sym->attr.save != SAVE_NONE || sym->attr.data
            || (sym->value && sym->ns->proc_name->attr.is_main_program)
            || (flag_coarray == GFC_FCOARRAY_LIB
@@ -1554,7 +1554,9 @@ gfc_get_symbol_decl (gfc_symbol * sym)

   fun_or_res = byref && (sym->attr.result
                         || (sym->attr.function && sym->ts.deferred));
-  if ((sym->attr.dummy && ! sym->attr.function) || fun_or_res)
+  if (((sym->attr.dummy && !sym->attr.function)
+       && !(sym->attr.pdt_kind || sym->attr.pdt_len))
+      || fun_or_res)
     {
       /* Return via extra parameter.  */
       if (sym->attr.result && byref

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

* [Bug fortran/95543] [PDT] ICE in is_CFI_desc, at fortran/expr.c:1080
  2020-06-04 18:15 [Bug fortran/95543] New: ICE in is_CFI_desc, at fortran/expr.c:1080 gscfq@t-online.de
  2020-06-06 16:08 ` [Bug fortran/95543] [PDT] " kargl at gcc dot gnu.org
  2020-06-06 16:34 ` kargl at gcc dot gnu.org
@ 2020-06-06 17:13 ` sgk at troutmask dot apl.washington.edu
  2020-06-06 17:32 ` sgk at troutmask dot apl.washington.edu
  2023-06-30  8:16 ` pault at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2020-06-06 17:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Sat, Jun 06, 2020 at 04:34:53PM +0000, kargl at gcc dot gnu.org wrote:
>
> This cures the ICE, which then I believe leads to wrong-code.
> 

PDT are completely broken.  When this is parsed

   type t(a, b)
      integer, kind :: a = 1
      integer, kind :: b = a
   end type

the internal representation of for 't' has two components;
namely, a component for 'a' and a component for 'b'.  Neither
'a' nor 'b' is a component, and should therefore not be 
in the link list of components.  All of the programs in this
bug report should likely print nothing.

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

* [Bug fortran/95543] [PDT] ICE in is_CFI_desc, at fortran/expr.c:1080
  2020-06-04 18:15 [Bug fortran/95543] New: ICE in is_CFI_desc, at fortran/expr.c:1080 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2020-06-06 17:13 ` sgk at troutmask dot apl.washington.edu
@ 2020-06-06 17:32 ` sgk at troutmask dot apl.washington.edu
  2023-06-30  8:16 ` pault at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2020-06-06 17:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Sat, Jun 06, 2020 at 05:13:31PM +0000, sgk at troutmask dot
apl.washington.edu wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95543
> 
> --- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
> On Sat, Jun 06, 2020 at 04:34:53PM +0000, kargl at gcc dot gnu.org wrote:
> >
> > This cures the ICE, which then I believe leads to wrong-code.
> > 
> 
> PDT are completely broken.  When this is parsed
> 
>    type t(a, b)
>       integer, kind :: a = 1
>       integer, kind :: b = a
>    end type
> 
> the internal representation of for 't' has two components;
> namely, a component for 'a' and a component for 'b'.  Neither
> 'a' nor 'b' is a component, and should therefore not be 
> in the link list of components.  All of the programs in this
> bug report should likely print nothing.
> 

A little debugging shows

*ts->u.derived->param_list = 0x0
ts->u.derived->components->name = 'a'
ts->u.derived->components->next->name = 'b'

It seems that param_list is populated when the derived type definition
is used in an actual derived type declaration, ie., type(t(b=6))
would have a param_list item for 'b'.

Looking in gfortran.h shows param_list is a 'gfc_actual_arglist *' type,
ie., a list of actual arguments. Probably not a bad idea, since 't(b=6,a=4)'
is valid and 'a' and 'b' can be treated as-if they are actual arguments
to a function 't'.  components are 'gfc_symbol *', so we cannot simply
move then to the param_list.

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

* [Bug fortran/95543] [PDT] ICE in is_CFI_desc, at fortran/expr.c:1080
  2020-06-04 18:15 [Bug fortran/95543] New: ICE in is_CFI_desc, at fortran/expr.c:1080 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2020-06-06 17:32 ` sgk at troutmask dot apl.washington.edu
@ 2023-06-30  8:16 ` pault at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu.org @ 2023-06-30  8:16 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu.org
             Blocks|                            |82173

--- Comment #5 from Paul Thomas <pault at gcc dot gnu.org> ---
Added to PDT meta-bug


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82173
[Bug 82173] [meta-bug] [PDT] Parameterized derived type errors

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

end of thread, other threads:[~2023-06-30  8:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-04 18:15 [Bug fortran/95543] New: ICE in is_CFI_desc, at fortran/expr.c:1080 gscfq@t-online.de
2020-06-06 16:08 ` [Bug fortran/95543] [PDT] " kargl at gcc dot gnu.org
2020-06-06 16:34 ` kargl at gcc dot gnu.org
2020-06-06 17:13 ` sgk at troutmask dot apl.washington.edu
2020-06-06 17:32 ` sgk at troutmask dot apl.washington.edu
2023-06-30  8:16 ` pault 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).