public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Zanoni, Paulo R" <paulo.r.zanoni@intel.com>
Cc: "intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"Wood, Thomas" <thomas.wood@intel.com>
Subject: Re: [PATCH i-g-t 8/8] tests/kms_fbc_crc: ensure context is initialized correctly
Date: Wed, 4 Nov 2015 22:00:14 +0200	[thread overview]
Message-ID: <20151104200014.GB4437@intel.com> (raw)
In-Reply-To: <1446665762.2911.21.camel@intel.com>

On Wed, Nov 04, 2015 at 07:36:04PM +0000, Zanoni, Paulo R wrote:
> Em Seg, 2015-11-02 às 11:48 +0000, Thomas Wood escreveu:
> > Initialization was included in commit a976d7e (tests/kms_fbc_crc:
> > refactor context
> > handling code), but won't be executed since it is declared before the
> > first
> > label within a switch statement.
> > 
> > kms_fbc_crc.c:178:2: warning: ‘context’ may be used uninitialized in
> > this function [-Wmaybe-uninitialized]
> >   rendercopy(batch, context,
> >   ^
> > kms_fbc_crc.c:271:22: note: ‘context’ was declared here
> >    drm_intel_context *context = NULL;
> 
> I don't see these warnings here. Which compiler do you use?
> 
> pzanoni@panetone:~/nfs/intel-gpu-tools/tests$ gcc --version
> gcc (Debian 5.2.1-22) 5.2.1 20151010                       
> 
> The weird part is that it was initialized during the declaration, so
> the declaration is valid yet the initialization is not?

Speaking as someone who was bitten by this once, yes that is the case.
Would be nice if gcc would flag it as unreachable code.

> Anyway, your
> change removes the ambiguity of the situation and avoid citations of
> the C standard, so:
> 
> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> 
> > 
> >                       ^
> > Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > Signed-off-by: Thomas Wood <thomas.wood@intel.com>
> > ---
> >  tests/kms_fbc_crc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
> > index d580a94..02e95e5 100644
> > --- a/tests/kms_fbc_crc.c
> > +++ b/tests/kms_fbc_crc.c
> > @@ -255,6 +255,7 @@ static void test_crc(data_t *data, enum test_mode
> > mode)
> >  {
> >  	uint32_t crtc_id = data->output->config.crtc->crtc_id;
> >  	uint32_t handle = data->fb[0].gem_handle;
> > +	drm_intel_context *context = NULL;
> >  
> >  	igt_assert(fbc_enabled(data));
> >  
> > @@ -268,7 +269,6 @@ static void test_crc(data_t *data, enum test_mode
> > mode)
> >  	}
> >  
> >  	switch (mode) {
> > -		drm_intel_context *context = NULL;
> >  	case TEST_PAGE_FLIP:
> >  		break;
> >  	case TEST_MMAP_CPU:
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-11-04 20:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-02 11:48 [PATCH i-g-t 1/8] kms_force_connector: use comparison macros to make debug output clearer Thomas Wood
2015-11-02 11:48 ` [PATCH i-g-t 2/8] lib: highlight subtest results on terminals Thomas Wood
2015-11-04 19:58   ` Paulo Zanoni
2015-11-05 15:32     ` Morton, Derek J
2015-11-09 17:17       ` [PATCH i-g-t] lib: add a environment variable to control output Thomas Wood
2015-11-09 20:58         ` Chris Wilson
2015-11-10 10:43           ` Thomas Wood
2015-11-11 10:09             ` Morton, Derek J
2015-11-02 11:48 ` [PATCH i-g-t 3/8] Add missing noreturn attribute to various functions Thomas Wood
2015-11-02 11:48 ` [PATCH i-g-t 4/8] tests: remove unnecessary igt_exit calls Thomas Wood
2015-11-02 11:48 ` [PATCH i-g-t 5/8] tests: remove duplicate struct member initializers Thomas Wood
2015-11-02 11:48 ` [PATCH i-g-t 6/8] Fix comparison of unsigned integers Thomas Wood
2015-11-02 11:48 ` [PATCH i-g-t 7/8] lib: add PIPE_ANY to the pipe enum Thomas Wood
2015-11-02 11:48 ` [PATCH i-g-t 8/8] tests/kms_fbc_crc: ensure context is initialized correctly Thomas Wood
2015-11-04 19:36   ` Zanoni, Paulo R
2015-11-04 20:00     ` Ville Syrjälä [this message]
2015-11-09 14:50     ` Thomas Wood
2015-11-02 17:13 ` [PATCH i-g-t 1/8] kms_force_connector: use comparison macros to make debug output clearer Thomas Wood

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=20151104200014.GB4437@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    --cc=thomas.wood@intel.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