This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix an UBSAN error in cp/parse.c (PR c++/86653).


Hello.

Quite simple patch that initializes a boolean value before it's used.
The variable is not initialized when an error recovery happens.

Ready for trunk after testing?
Thanks,
Martin

gcc/cp/ChangeLog:

2018-07-26  Martin Liska  <mliska@suse.cz>

        PR c++/86653
	* parser.c (cp_parser_condition): Initialize non_constant_p
        to false.
---
 gcc/cp/parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index d44a6b88028..93c812f80d7 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -11721,7 +11721,7 @@ cp_parser_condition (cp_parser* parser)
       if (cp_parser_parse_definitely (parser))
 	{
 	  tree pushed_scope;
-	  bool non_constant_p;
+	  bool non_constant_p = false;
 	  int flags = LOOKUP_ONLYCONVERTING;
 
 	  if (!cp_parser_check_condition_declarator (parser, declarator, loc))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]