public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Silence up a false positive warning in libiberty (PR middle-end/56526)
@ 2013-03-05 10:52 Jakub Jelinek
  2013-03-05 14:57 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2013-03-05 10:52 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-patches

Hi!

While wrapper_sect_offset is always initialized if
(gnu_sections_found & SOMO_WRAPPING) != 0 and used only guarded with that
same condition, as the PR says apparently we get a false positive maybe
uninitialized warning for it still.  I'd say it is a good programming style
to just initialize such vars, especially in performance non-critical code.

Ok for trunk?

2013-03-05  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/56526
	* simple-object-mach-o.c (simple_object_mach_o_segment): Initialize
	wrapper_sect_offset to avoid a warning.

--- libiberty/simple-object-mach-o.c.jj	2013-01-07 14:14:46.000000000 +0100
+++ libiberty/simple-object-mach-o.c	2013-03-05 11:46:19.574157009 +0100
@@ -432,7 +432,7 @@ simple_object_mach_o_segment (simple_obj
   size_t index_size;
   unsigned int n_wrapped_sects;
   size_t wrapper_sect_size;
-  off_t wrapper_sect_offset;
+  off_t wrapper_sect_offset = 0;
 
   fetch_32 = (omr->is_big_endian
 	      ? simple_object_fetch_big_32

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Silence up a false positive warning in libiberty (PR middle-end/56526)
  2013-03-05 10:52 [PATCH] Silence up a false positive warning in libiberty (PR middle-end/56526) Jakub Jelinek
@ 2013-03-05 14:57 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2013-03-05 14:57 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Tue, Mar 5, 2013 at 2:52 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>
> 2013-03-05  Jakub Jelinek  <jakub@redhat.com>
>
>         PR middle-end/56526
>         * simple-object-mach-o.c (simple_object_mach_o_segment): Initialize
>         wrapper_sect_offset to avoid a warning.

This is OK.

Thanks.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-05 14:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-05 10:52 [PATCH] Silence up a false positive warning in libiberty (PR middle-end/56526) Jakub Jelinek
2013-03-05 14:57 ` Ian Lance Taylor

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 read-only IMAP folder(s) and NNTP newsgroup(s).