diff mbox

Fix another bootstrap-ubsan failure due to -Werror=maybe-uninitialized.

Message ID 56163216.70401@partner.samsung.com
State New
Headers show

Commit Message

max Oct. 8, 2015, 9:06 a.m. UTC
Hi,

running UBSan bootstrap on trunk, I've run to the such issue:

/home/max/workspace/downloads/svn/trunk/gcc/fortran/parse.c: In function 
‘gfc_statement decode_statement()’:
/home/max/workspace/downloads/svn/trunk/gcc/fortran/parse.c:368:51: 
error: ‘m’ may be used uninitialized in this function 
[-Werror=maybe-uninitialized]
    if (!(in_specification_block && m == MATCH_ERROR))

Actually, the situation is pretty much similar to PR sanitizer/67867 
fixed by Marek in r228569. This tiny patch just initializes m with 
MATCH_NO value.
By fixing this, UBSan bootstrap can proceed, although I see some errors 
detected (will report them later).

Is this OK for trunk?

-Maxim

Comments

Mikael Morin Oct. 9, 2015, 6:48 p.m. UTC | #1
Le 08/10/2015 11:06, Maxim Ostapenko a écrit :
> Hi,
>
> running UBSan bootstrap on trunk, I've run to the such issue:
>
> /home/max/workspace/downloads/svn/trunk/gcc/fortran/parse.c: In function
> ‘gfc_statement decode_statement()’:
> /home/max/workspace/downloads/svn/trunk/gcc/fortran/parse.c:368:51:
> error: ‘m’ may be used uninitialized in this function
> [-Werror=maybe-uninitialized]
>     if (!(in_specification_block && m == MATCH_ERROR))
>
> Actually, the situation is pretty much similar to PR sanitizer/67867
> fixed by Marek in r228569. This tiny patch just initializes m with
> MATCH_NO value.
> By fixing this, UBSan bootstrap can proceed, although I see some errors
> detected (will report them later).
>
> Is this OK for trunk?
>
Yes, of course.
Thanks

Mikael
diff mbox

Patch

gcc/fortran/ChangeLog:

2015-10-08  Maxim Ostapenko  <m.ostapenko@partner.samsung.com>

	* parse.c (decode_statement): Initialize M to MATCH_NO.

diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 6f3d24b..4925c7e 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -296,7 +296,7 @@  decode_statement (void)
   gfc_namespace *ns;
   gfc_statement st;
   locus old_locus;
-  match m;
+  match m = MATCH_NO;
   char c;
 
   gfc_enforce_clean_symbol_state ();