[Bug fortran/119199] valgrind error in translate_common

2025-03-11 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119199

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
   Target Milestone|--- |15.0
 Resolution|--- |FIXED

--- Comment #6 from anlauf at gcc dot gnu.org ---
Should be fixed.

[Bug fortran/119199] valgrind error in translate_common

2025-03-11 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119199

--- Comment #5 from GCC Commits  ---
The master branch has been updated by Harald Anlauf :

https://gcc.gnu.org/g:5e9f71254a5276cfca1769a5d490f6416a823b8d

commit r15-7966-g5e9f71254a5276cfca1769a5d490f6416a823b8d
Author: Harald Anlauf 
Date:   Mon Mar 10 22:24:27 2025 +0100

Fortran: reject SAVE of a COMMON in a BLOCK construct [PR119199]

PR fortran/119199

gcc/fortran/ChangeLog:

* decl.cc (gfc_match_save): Reject SAVE statement of a COMMON block
when in a BLOCK construct.
* trans-common.cc (translate_common): Avoid NULL pointer
dereference.

gcc/testsuite/ChangeLog:

* gfortran.dg/common_30.f90: New test.
* gfortran.dg/common_31.f90: New test.

[Bug fortran/119199] valgrind error in translate_common

2025-03-10 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119199

--- Comment #2 from anlauf at gcc dot gnu.org ---
Likely r15-4104.

Null pointer dereference, obviously fixed by:

diff --git a/gcc/fortran/trans-common.cc b/gcc/fortran/trans-common.cc
index 70b45174f84..2db50da20dd 100644
--- a/gcc/fortran/trans-common.cc
+++ b/gcc/fortran/trans-common.cc
@@ -1218,7 +1218,7 @@ translate_common (gfc_common_head *common, gfc_symbol
*var_list)
   align = 1;
   saw_equiv = false;

-  if (var_list->attr.omp_allocate)
+  if (var_list && var_list->attr.omp_allocate)
 gfc_error ("Sorry, !$OMP allocate for COMMON block variable %qs at %L "
   "not supported", common->name, &common->where);

[Bug fortran/119199] valgrind error in translate_common

2025-03-10 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119199

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |anlauf at gcc dot 
gnu.org

--- Comment #4 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2025-March/061871.html

[Bug fortran/119199] valgrind error in translate_common

2025-03-10 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119199

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2025-03-10
 Status|UNCONFIRMED |NEW
   Keywords||ice-on-invalid-code

--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed.

Reduced testcase which ICEs:

program  main
  save /argmnt1/
end program

[Bug fortran/119199] valgrind error in translate_common

2025-03-10 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119199

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 CC||anlauf at gcc dot gnu.org

--- Comment #3 from anlauf at gcc dot gnu.org ---
Created attachment 60698
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60698&action=edit
Patch

Complete patch that diagnoses F2023:C1108 and is being regtested.