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]

Re: [PATCH] Silence some uninitialized variable warnings that appear when bootstrapping


On 9/2/16, David Malcolm <dmalcolm@redhat.com> wrote:
> On Fri, 2016-09-02 at 15:41 -0400, Eric Gallager wrote:
>> On 9/2/16, Segher Boessenkool <segher@kernel.crashing.org> wrote:
>> > On Fri, Sep 02, 2016 at 02:21:07PM -0400, Eric Gallager wrote:
>> > > ../../gcc/combine.c: In function ‘int
>> > > combine_instructions(rtx_insn*,
>> > > unsigned int)’:
>> > > ../../gcc/combine.c:1310:8: warning: ‘prev’ may be used
>> > > uninitialized
>> > > in this function [-Wmaybe-uninitialized]
>> > >         if ((next = try_combine (insn, prev, NULL, NULL,
>> > >         ^~
>> >
>> > That is:
>> >
>> >           if (HAVE_cc0
>> >               && JUMP_P (insn)
>> >               && (prev = prev_nonnote_insn (insn)) != 0
>> >               && NONJUMP_INSN_P (prev)
>> >               && sets_cc0_p (PATTERN (prev)))
>> >             {
>> >               if ((next = try_combine (insn, prev, NULL, NULL,
>> >                                        &new_direct_jump_p,
>> >                                        last_combined_insn)) != 0)
>> >
>> > so prev is always initialised here.  Could you try to find out why
>> > GCC
>> > warns anyway?  Or open a PR?
>> >
>> > HAVE_cc0 probably expands to 0 (I'm not sure what your target is),
>> > that
>> > might have something to do with it.
>> >
>> >
>> > Segher
>> >
>>
>>
>> My target is i386-apple-darwin9.8.0. If HAVE_cc0 expands to 0, then
>> the code inside the brackets wouldn't even be reached anyways, would
>> it? Where would HAVE_cc0 be defined?
>
> It's defined in insn-config.h, which is generated in build/gcc by
> genconfig from the target's machine description file.
>
>


Okay, yeah, checking there, it has:

#define HAVE_cc0 0

on line 12. So Segher's intuition was correct.
(I'm attaching that whole file for reference)
/* Generated automatically by the program `genconfig'
   from the machine description file `md'.  */

#ifndef GCC_INSN_CONFIG_H
#define GCC_INSN_CONFIG_H

#define MAX_RECOG_OPERANDS 30
#define MAX_DUP_OPERANDS 30
#ifndef MAX_INSNS_PER_SPLIT
#define MAX_INSNS_PER_SPLIT 5
#endif
#define HAVE_cc0 0
#define CC0_P(X) ((X) ? 0 : 0)
#define HAVE_conditional_move 1
#define HAVE_conditional_execution 0
#define HAVE_lo_sum 0
#define HAVE_rotate 1
#define HAVE_rotatert 1
#define HAVE_peephole 0
#define HAVE_peephole2 1
#define MAX_INSNS_PER_PEEP2 4

#endif /* GCC_INSN_CONFIG_H */

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