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] Avoid uninitialized warning in i386.c


Bootstrap with -fsanitize=undefined revealed that the alg variable
may be used uninitialized.  Or at least gcc thinks so.  This patch
initializes it to 0.

Regtested/bootstrapped on x86_64-linux, ok for trunk?

2013-12-18  Marek Polacek  <polacek@redhat.com>

	* config/i386/i386.c (ix86_parse_stringop_strategy_string): Initialize
	alg to 0.

--- gcc/config/i386/i386.c.mp	2013-12-18 13:38:21.908138307 +0100
+++ gcc/config/i386/i386.c	2013-12-18 13:38:41.417214628 +0100
@@ -2856,7 +2856,7 @@ ix86_parse_stringop_strategy_string (cha
   do
     {
       int maxs;
-      stringop_alg alg;
+      stringop_alg alg = (stringop_alg) 0;
       char alg_name[128];
       char align[16];
       next_range_str = strchr (curr_range_str, ',');

	Marek


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