qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Miroslav Rezanina <mrezanin@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Qemu-block <qemu-block@nongnu.org>
Subject: Re: Prevent compiler warning on block.c
Date: Wed, 5 May 2021 07:12:35 -0400 (EDT)	[thread overview]
Message-ID: <1691168205.17503177.1620213155446.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <CAFEAcA9mZfuSYsEK-TcERB+8yTnq_Qhn7HwRGvCnE7_DMfAXyQ@mail.gmail.com>



----- Original Message -----
> From: "Peter Maydell" <peter.maydell@linaro.org>
> To: "Miroslav Rezanina" <mrezanin@redhat.com>
> Cc: "QEMU Developers" <qemu-devel@nongnu.org>, "Vladimir Sementsov-Ogievskiy" <vsementsov@virtuozzo.com>,
> "Qemu-block" <qemu-block@nongnu.org>
> Sent: Wednesday, May 5, 2021 12:43:44 PM
> Subject: Re: Prevent compiler warning on block.c
> 
> On Wed, 5 May 2021 at 09:06, Miroslav Rezanina <mrezanin@redhat.com> wrote:
> >
> > Commit 3108a15cf (block: introduce bdrv_drop_filter()) introduced
> > uninitialized
> > variable to_cow_parent in bdrv_replace_node_common function that is used
> > only when
> > detach_subchain is true. It is used in two places. First if block properly
> > initialize
> > the variable and second block use it.
> >
> > However, compiler treats this two blocks as two independent cases so it
> > thinks first
> > block can fail test and second one pass (although both use same condition).
> > This cause
> > warning that variable can be uninitialized in second block.
> >
> > To prevent this warning, initialize the variable with NULL.
> 
> If fixing compiler warnings, please quote the compiler name/version
> in the commit message. (This helps with understanding whether the issue
> is because of an older and not-smart-enough compiler or a new bleeding-edge
> compiler with extra checking.)

Hi Peter,

sorry for missing version. I was going to put the version in but got distracted when checking versions.

This warning occurs using GCC 8.4.1 and 11.0.1.

Mirek

> 
> thanks
> -- PMM
> 
> 

-- 
Miroslav Rezanina
Software Engineer - Virtualization Team Maintainer



      reply	other threads:[~2021-05-05 11:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <603798381.17174916.1620200426349.JavaMail.zimbra@redhat.com>
2021-05-05  7:59 ` Prevent compiler warning on block.c Miroslav Rezanina
2021-05-05  8:05   ` Vladimir Sementsov-Ogievskiy
2021-05-05 10:03     ` Paolo Bonzini
2021-05-05 10:32       ` Vladimir Sementsov-Ogievskiy
2021-06-09  7:12     ` Thomas Huth
2021-06-09  9:04       ` Kevin Wolf
2021-05-05 10:43   ` Peter Maydell
2021-05-05 11:12     ` Miroslav Rezanina [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1691168205.17503177.1620213155446.JavaMail.zimbra@redhat.com \
    --to=mrezanin@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).