This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] i386.c: Initialize function pointers to NULL to prevent, -Wmaybe-uninitialized
- From: Martin Liška <mliska at suse dot cz>
- To: Jakub Jelinek <jakub at redhat dot com>, Uros Bizjak <ubizjak at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, tbsaunde at tbsaunde dot org
- Date: Wed, 23 Nov 2016 11:20:18 +0100
- Subject: Re: [PATCH] i386.c: Initialize function pointers to NULL to prevent, -Wmaybe-uninitialized
- Authentication-results: sourceware.org; auth=none
- References: <be6326a8-097c-3267-4c17-7080a8d61c8e@suse.cz> <20161123101241.GK3541@tucnak.redhat.com>
On 11/23/2016 11:12 AM, Jakub Jelinek wrote:
> On Wed, Nov 23, 2016 at 11:06:23AM +0100, Martin Liška wrote:
>> 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.
>
> That is not very relevant for i386.c change, is it?
Sorry, I've used automatic testing. I'll re-trigger x86_64 bootstrap.
>
>> 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;
>
> nar_mode = V4SFmode;
> mode = V16SFmode;
> wide_mode = V64SFmode;
> fcn_mask = gen_avx5124fmaddps_4fmaddps_mask;
> fcn_maskz = gen_avx5124fmaddps_4fmaddps_maskz;
>
> follows this immediately, so there is no point in setting fcn_mask
> and fcn_maskz to NULL.
Will remove zeroing of these two.
Martin
>
> Jakub
>