[PATCH] Mode-Switching: Fix local array maybe uninitialized warning

Li, Pan2 pan2.li@intel.com
Sat May 20 09:59:31 GMT 2023


Committed, thanks Jeff.

Pan

-----Original Message-----
From: Jeff Law <jeffreyalaw@gmail.com> 
Sent: Saturday, May 20, 2023 12:24 PM
To: Li, Pan2 <pan2.li@intel.com>; gcc-patches@gcc.gnu.org
Cc: juzhe.zhong@rivai.ai; kito.cheng@sifive.com; Wang, Yanzhang <yanzhang.wang@intel.com>
Subject: Re: [PATCH] Mode-Switching: Fix local array maybe uninitialized warning



On 5/19/23 17:56, pan2.li@intel.com wrote:
> From: Pan Li <pan2.li@intel.com>
> 
> There are 2 local array in function optimize_mode_switching. It will 
> be initialized conditionally at the beginning but then always consumed 
> in another loop. It may trigger the warning maybe-uninitialized, and 
> may result in build failure when enable werror, aka warning as error.
> 
> This patch will initialize the local array to zero explictly when 
> declaration.
> 
> Signed-off-by: Pan Li <pan2.li@intel.com>
> 
> gcc/ChangeLog:
> 
> 	* mode-switching.cc (entity_map): Initialize the array to zero.
> 	(bb_info): Ditto.
OK.
jeff


More information about the Gcc-patches mailing list