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] i386.c: Initialize function pointers to NULL to prevent, -Wmaybe-uninitialized


I see broken bootstrap due to:

.././../gcc/config/i386/i386.c: In function ‘rtx_def* ix86_expand_builtin(tree, rtx, rtx, machine_mode, int)’:
.././../gcc/config/i386/i386.c:38407:18: error: ‘fcn’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
        emit_insn (fcn (target, accum, wide_reg, mem));
        ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thus I'm suggesting to initialize the variable (and 2 which are used in a very similar manner) to NULL.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin
>From 0a8dfb71f0f9c6359428d908b88e99f3146f69e4 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Tue, 22 Nov 2016 11:12:14 +0100
Subject: [PATCH] i386.c: Initialize function pointers to NULL to prevent
 -Wmaybe-uninitialized

gcc/ChangeLog:

2016-11-22  Martin Liska  <mliska@suse.cz>

	* config/i386/i386.c: Initialize function pointers to NULL.
---
 gcc/config/i386/i386.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 25f0446..a373fcf 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -38218,9 +38218,9 @@ rdseed_step:
       && fcode <= IX86_BUILTIN__BDESC_ARGS2_LAST)
     {
       i = fcode - IX86_BUILTIN__BDESC_ARGS2_FIRST;
-      rtx (*fcn) (rtx, rtx, rtx, rtx);
-      rtx (*fcn_mask) (rtx, rtx, rtx, rtx, rtx);
-      rtx (*fcn_maskz) (rtx, rtx, rtx, rtx, rtx, rtx);
+      rtx (*fcn) (rtx, rtx, rtx, rtx) = NULL;
+      rtx (*fcn_mask) (rtx, rtx, rtx, rtx, rtx) = NULL;
+      rtx (*fcn_maskz) (rtx, rtx, rtx, rtx, rtx, rtx) = NULL;
       int masked = 1;
       machine_mode mode, wide_mode, nar_mode;
 
-- 
2.10.2


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