[Bug fortran/79524] [13/14/15 Regression] valgrind error for gcc/testsuite/gfortran.dg/fimplicit_none_2.f90

2026-05-08 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79524

Paul Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #35 from Paul Thomas  ---
Fixed on 13-branch through to mainline.

Closing.

Paul

[Bug fortran/79524] [13/14/15 Regression] valgrind error for gcc/testsuite/gfortran.dg/fimplicit_none_2.f90

2026-05-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79524

--- Comment #34 from GCC Commits  ---
The releases/gcc-13 branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:3a02c2e6d25b95a307bcfd12136b74c34d6093bb

commit r13-10298-g3a02c2e6d25b95a307bcfd12136b74c34d6093bb
Author: Christopher Albert 
Date:   Fri Apr 3 12:45:57 2026 +0200

fortran: Clean up charlens after rejected parameter arrays [PR79524]

When a parameter array declaration such as
character(*), parameter :: z(2) = [character(n) :: 'x', 'y']
is rejected, declaration-local charlen nodes from that statement can remain
on
cl_list and later be resolved again.  The charlen's length expression still
references the symbol 'n' whose symtree was already freed by
gfc_undo_symbols,
causing a heap-use-after-free in resolve_charlen.

Clean up those statement-local charlens at the rejection point in decl.cc,
after clearing the surviving owners in that path.

PR fortran/79524

gcc/fortran/ChangeLog:

PR fortran/79524
* decl.cc (discard_pending_charlens): New helper.
(add_init_expr_to_sym): Drop statement-local charlens when
rejecting variable-length parameter arrays.
(variable_decl, do_parm, enumerator_decl): Save the current
namespace charlen list before parsing declarations with
initializers.
(match_procedure_decl): Adjust call to add_init_expr_to_sym.

gcc/testsuite/ChangeLog:

PR fortran/79524
* gfortran.dg/pr79524.f90: New test.

Signed-off-by: Christopher Albert 
(cherry picked from commit 7660e3067481159acc3ad76cfae22f71606670c7)

[Bug fortran/79524] [13/14/15 Regression] valgrind error for gcc/testsuite/gfortran.dg/fimplicit_none_2.f90

2026-05-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79524

--- Comment #33 from GCC Commits  ---
The releases/gcc-14 branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:c7422971e08cb1ec015ee63df89338dce5f3dabf

commit r14-12573-gc7422971e08cb1ec015ee63df89338dce5f3dabf
Author: Christopher Albert 
Date:   Fri Apr 3 12:45:57 2026 +0200

fortran: Clean up charlens after rejected parameter arrays [PR79524]

When a parameter array declaration such as
character(*), parameter :: z(2) = [character(n) :: 'x', 'y']
is rejected, declaration-local charlen nodes from that statement can remain
on
cl_list and later be resolved again.  The charlen's length expression still
references the symbol 'n' whose symtree was already freed by
gfc_undo_symbols,
causing a heap-use-after-free in resolve_charlen.

Clean up those statement-local charlens at the rejection point in decl.cc,
after clearing the surviving owners in that path.

PR fortran/79524

gcc/fortran/ChangeLog:

PR fortran/79524
* decl.cc (discard_pending_charlens): New helper.
(add_init_expr_to_sym): Drop statement-local charlens when
rejecting variable-length parameter arrays.
(variable_decl, do_parm, enumerator_decl): Save the current
namespace charlen list before parsing declarations with
initializers.
(match_procedure_decl): Adjust call to add_init_expr_to_sym.

gcc/testsuite/ChangeLog:

PR fortran/79524
* gfortran.dg/pr79524.f90: New test.

Signed-off-by: Christopher Albert 
(cherry picked from commit 7660e3067481159acc3ad76cfae22f71606670c7)

[Bug fortran/79524] [13/14/15 Regression] valgrind error for gcc/testsuite/gfortran.dg/fimplicit_none_2.f90

2026-05-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79524

--- Comment #32 from GCC Commits  ---
The releases/gcc-15 branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:2e0170d1304aaff0e4d3b58f48ef8dfd83cd

commit r15-11141-g2e0170d1304aaff0e4d3b58f48ef8dfd83cd
Author: Christopher Albert 
Date:   Fri Apr 3 12:45:57 2026 +0200

fortran: Clean up charlens after rejected parameter arrays [PR79524]

When a parameter array declaration such as
character(*), parameter :: z(2) = [character(n) :: 'x', 'y']
is rejected, declaration-local charlen nodes from that statement can remain
on
cl_list and later be resolved again.  The charlen's length expression still
references the symbol 'n' whose symtree was already freed by
gfc_undo_symbols,
causing a heap-use-after-free in resolve_charlen.

Clean up those statement-local charlens at the rejection point in decl.cc,
after clearing the surviving owners in that path.

PR fortran/79524

gcc/fortran/ChangeLog:

PR fortran/79524
* decl.cc (discard_pending_charlens): New helper.
(add_init_expr_to_sym): Drop statement-local charlens when
rejecting variable-length parameter arrays.
(variable_decl, do_parm, enumerator_decl): Save the current
namespace charlen list before parsing declarations with
initializers.
(match_procedure_decl): Adjust call to add_init_expr_to_sym.

gcc/testsuite/ChangeLog:

PR fortran/79524
* gfortran.dg/pr79524.f90: New test.

Signed-off-by: Christopher Albert 
(cherry picked from commit 7660e3067481159acc3ad76cfae22f71606670c7)

[Bug fortran/79524] [13/14/15 Regression] valgrind error for gcc/testsuite/gfortran.dg/fimplicit_none_2.f90

2026-04-06 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79524

Paul Thomas  changed:

   What|Removed |Added

Summary|[13/14/15/16 Regression]|[13/14/15 Regression]
   |valgrind error for  |valgrind error for
   |gcc/testsuite/gfortran.dg/f |gcc/testsuite/gfortran.dg/f
   |implicit_none_2.f90 |implicit_none_2.f90
 CC||pault at gcc dot gnu.org

--- Comment #31 from Paul Thomas  ---
Knocking 16 of the summary line.

Paul