public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/107560] New: ICE in gfc_get_derived_type, at fortran/trans-types.cc:2811
@ 2022-11-07 18:16 gscfq@t-online.de
  2023-03-24 20:50 ` [Bug fortran/107560] " anlauf at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gscfq@t-online.de @ 2022-11-07 18:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107560
           Summary: ICE in gfc_get_derived_type, at
                    fortran/trans-types.cc:2811
           Product: gcc
           Version: 13.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 :


$ cat z1.f90
program p
   type t
      character(+'1') :: c
   end type
   type(t) :: x = t('a')
end


$ cat z2.f90
program p
   type t
      character(+z'1') :: c
   end type
   type(t) :: x = t('a')
end


$ gfortran-13-20221106 -c z1.f90
z1.f90:6:3:

    6 | end
      |   1
internal compiler error: in gfc_get_derived_type, at
fortran/trans-types.cc:2811
0x8fe77e gfc_get_derived_type(gfc_symbol*, int)
        ../../gcc/fortran/trans-types.cc:2811
0x8feaa8 gfc_typenode_for_spec(gfc_typespec*, int)
        ../../gcc/fortran/trans-types.cc:1207
0x8fed10 gfc_sym_type(gfc_symbol*, bool)
        ../../gcc/fortran/trans-types.cc:2319
0x88f479 gfc_emit_parameter_debug_info
        ../../gcc/fortran/trans-decl.cc:5504
0x857982 do_traverse_symtree
        ../../gcc/fortran/symbol.cc:4180
0x89d718 gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.cc:7823
0x81f57e translate_all_program_units
        ../../gcc/fortran/parse.cc:6696
0x81f57e gfc_parse_file()
        ../../gcc/fortran/parse.cc:7002
0x86ccbf gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:229

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

* [Bug fortran/107560] ICE in gfc_get_derived_type, at fortran/trans-types.cc:2811
  2022-11-07 18:16 [Bug fortran/107560] New: ICE in gfc_get_derived_type, at fortran/trans-types.cc:2811 gscfq@t-online.de
@ 2023-03-24 20:50 ` anlauf at gcc dot gnu.org
  2023-03-24 20:59 ` kargl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-03-24 20:50 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |11.3.1, 12.2.1, 13.0
                 CC|                            |anlauf at gcc dot gnu.org
      Known to fail|                            |11.3.0, 12.2.0

--- Comment #1 from anlauf at gcc dot gnu.org ---
This used to fail, but appears to have been fixed in the meantime.
A possible candidate for variant z2.f90 seems the fix for pr103413.

While looking at valgrind output with current trunk, I see a memleak
for the BOZ case that is obviously plugged by:

diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index 4662328bf31..7fb33f81788 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -466,6 +466,10 @@ free_expr0 (gfc_expr *e)
          mpc_clear (e->value.complex);
          break;

+       case BT_BOZ:
+         free (e->boz.str);
+         break;
+
        default:
          break;
        }

This might have been overseen during the BOZ rework.
Regtesting ...

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

* [Bug fortran/107560] ICE in gfc_get_derived_type, at fortran/trans-types.cc:2811
  2022-11-07 18:16 [Bug fortran/107560] New: ICE in gfc_get_derived_type, at fortran/trans-types.cc:2811 gscfq@t-online.de
  2023-03-24 20:50 ` [Bug fortran/107560] " anlauf at gcc dot gnu.org
@ 2023-03-24 20:59 ` kargl at gcc dot gnu.org
  2023-03-24 21:07 ` anlauf at gcc dot gnu.org
  2023-03-24 21:20 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: kargl at gcc dot gnu.org @ 2023-03-24 20:59 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

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

--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to anlauf from comment #1)
> This used to fail, but appears to have been fixed in the meantime.
> A possible candidate for variant z2.f90 seems the fix for pr103413.
> 
> While looking at valgrind output with current trunk, I see a memleak
> for the BOZ case that is obviously plugged by:
> 
> diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
> index 4662328bf31..7fb33f81788 100644
> --- a/gcc/fortran/expr.cc
> +++ b/gcc/fortran/expr.cc
> @@ -466,6 +466,10 @@ free_expr0 (gfc_expr *e)
>           mpc_clear (e->value.complex);
>           break;
>  
> +       case BT_BOZ:
> +         free (e->boz.str);
> +         break;
> +
>         default:
>           break;
>         }
> 
> This might have been overseen during the BOZ rework.
> Regtesting ...

Yep. It was missed by the guy that did the BOZ rework. ;-)

If it passed regtesting, it's ok to commit.

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

* [Bug fortran/107560] ICE in gfc_get_derived_type, at fortran/trans-types.cc:2811
  2022-11-07 18:16 [Bug fortran/107560] New: ICE in gfc_get_derived_type, at fortran/trans-types.cc:2811 gscfq@t-online.de
  2023-03-24 20:50 ` [Bug fortran/107560] " anlauf at gcc dot gnu.org
  2023-03-24 20:59 ` kargl at gcc dot gnu.org
@ 2023-03-24 21:07 ` anlauf at gcc dot gnu.org
  2023-03-24 21:20 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-03-24 21:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from anlauf at gcc dot gnu.org ---
(In reply to kargl from comment #2)
> Yep. It was missed by the guy that did the BOZ rework. ;-)

I think the BOZ rework was a greater step for mankind than the missing fix ...

> If it passed regtesting, it's ok to commit.

It did.  Will commit.

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

* [Bug fortran/107560] ICE in gfc_get_derived_type, at fortran/trans-types.cc:2811
  2022-11-07 18:16 [Bug fortran/107560] New: ICE in gfc_get_derived_type, at fortran/trans-types.cc:2811 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2023-03-24 21:07 ` anlauf at gcc dot gnu.org
@ 2023-03-24 21:20 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-03-24 21:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from anlauf at gcc dot gnu.org ---
The BOZ memleak should be fixed with r13-6857-g833233a4aefc99.

There is another FE memleak which is the same for z1.f90 and z2.f90:

==16805== 48 bytes in 1 blocks are definitely lost in loss record 19 of 674
==16805==    at 0x4C39571: calloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16805==    by 0x2120D94: xcalloc (xmalloc.c:164)
==16805==    by 0x9AB967: gfc_match_actual_arglist(int, gfc_actual_arglist**,
bool) (primary.cc:1870)
==16805==    by 0x9AFEA2: gfc_match_rvalue(gfc_expr**) (primary.cc:3695)
==16805==    by 0x95F6A6: match_primary(gfc_expr**) (matchexp.cc:157)
==16805==    by 0x95F7C3: match_level_1(gfc_expr**) (matchexp.cc:211)
==16805==    by 0x95F885: match_mult_operand(gfc_expr**) (matchexp.cc:267)
==16805==    by 0x95FA90: match_add_operand(gfc_expr**) (matchexp.cc:356)
==16805==    by 0x95FD50: match_level_2(gfc_expr**) (matchexp.cc:480)
==16805==    by 0x95FEE2: match_level_3(gfc_expr**) (matchexp.cc:551)
==16805==    by 0x95FFE6: match_level_4(gfc_expr**) (matchexp.cc:599)
==16805==    by 0x960279: match_and_operand(gfc_expr**) (matchexp.cc:693)

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

end of thread, other threads:[~2023-03-24 21:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07 18:16 [Bug fortran/107560] New: ICE in gfc_get_derived_type, at fortran/trans-types.cc:2811 gscfq@t-online.de
2023-03-24 20:50 ` [Bug fortran/107560] " anlauf at gcc dot gnu.org
2023-03-24 20:59 ` kargl at gcc dot gnu.org
2023-03-24 21:07 ` anlauf at gcc dot gnu.org
2023-03-24 21:20 ` 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).