public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix another bootstrap-ubsan failure due to -Werror=maybe-uninitialized.
@ 2015-10-08  9:06 Maxim Ostapenko
  2015-10-09 18:48 ` Mikael Morin
  0 siblings, 1 reply; 2+ messages in thread
From: Maxim Ostapenko @ 2015-10-08  9:06 UTC (permalink / raw)
  To: GCC Patches
  Cc: Marek Polacek, Yury Gribov, Vyacheslav Barinov, Slava Garbuzov

[-- Attachment #1: Type: text/plain, Size: 701 bytes --]

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

[-- Attachment #2: parse-1.diff --]
[-- Type: text/x-patch, Size: 476 bytes --]

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 ();

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix another bootstrap-ubsan failure due to -Werror=maybe-uninitialized.
  2015-10-08  9:06 [PATCH] Fix another bootstrap-ubsan failure due to -Werror=maybe-uninitialized Maxim Ostapenko
@ 2015-10-09 18:48 ` Mikael Morin
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Morin @ 2015-10-09 18:48 UTC (permalink / raw)
  To: Maxim Ostapenko, GCC Patches
  Cc: Marek Polacek, Yury Gribov, Vyacheslav Barinov, Slava Garbuzov

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-09 18:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-08  9:06 [PATCH] Fix another bootstrap-ubsan failure due to -Werror=maybe-uninitialized Maxim Ostapenko
2015-10-09 18:48 ` Mikael Morin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).