[gcc r16-1700] fortran: Avoid freeing uninitialized value
Martin Jambor
jamborm@gcc.gnu.org
Thu Jun 26 09:26:17 GMT 2025
https://gcc.gnu.org/g:bf6078d2aaee8b240b7425b9788d8038cd45c8f3
commit r16-1700-gbf6078d2aaee8b240b7425b9788d8038cd45c8f3
Author: Martin Jambor <mjambor@suse.cz>
Date: Thu Jun 26 11:25:20 2025 +0200
fortran: Avoid freeing uninitialized value
When compiling fortran/match.cc, clang emits a warning
fortran/match.cc:5301:7: warning: variable 'p' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
which looks accurate, so this patch adds an initialization of p to
avoid the use.
gcc/fortran/ChangeLog:
2025-06-23 Martin Jambor <mjambor@suse.cz>
* match.cc (gfc_match_nullify): Initialize p to NULL;
Diff:
---
gcc/fortran/match.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/fortran/match.cc b/gcc/fortran/match.cc
index aa0b04afd563..8355a390ee08 100644
--- a/gcc/fortran/match.cc
+++ b/gcc/fortran/match.cc
@@ -5293,7 +5293,7 @@ match
gfc_match_nullify (void)
{
gfc_code *tail;
- gfc_expr *e, *p;
+ gfc_expr *e, *p = NULL;
match m;
tail = NULL;
More information about the Gcc-cvs
mailing list