[Bug fortran/107560] ICE in gfc_get_derived_type, at fortran/trans-types.cc:2811

2023-03-24 Thread anlauf at gcc dot gnu.org via 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)

[Bug fortran/107560] ICE in gfc_get_derived_type, at fortran/trans-types.cc:2811

2023-03-24 Thread anlauf at gcc dot gnu.org via 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.

[Bug fortran/107560] ICE in gfc_get_derived_type, at fortran/trans-types.cc:2811

2023-03-24 Thread kargl at gcc dot gnu.org via 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.

[Bug fortran/107560] ICE in gfc_get_derived_type, at fortran/trans-types.cc:2811

2023-03-24 Thread anlauf at gcc dot gnu.org via 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 ...