Patchwork Fix bogus waring on gcov-io.c in profiledbootstrap

login
register
mail settings
Submitter Jan Hubicka
Date Nov. 15, 2012, 1:08 a.m.
Message ID <20121115010829.GD12910@kam.mff.cuni.cz>
Download mbox | patch
Permalink /patch/199089/
State New
Headers show

Comments

Jan Hubicka - Nov. 15, 2012, 1:08 a.m.
Hi,
gcov-io.c contains bogus array bounds check that makes us to unroll one time
too many and trigger bogus -Warray-bounds warning.
I made testcase for PR55079 and fixed the bounds check.

Bootstrapped/regtested/comitted x86_64.
Honza
	PR bootstrap/55051
	* gcov-io.c (gcov_read_summary): Fix array bound check.

Patch

Index: gcov-io.c
===================================================================
--- gcov-io.c	(revision 193505)
+++ gcov-io.c	(working copy)
@@ -552,8 +552,8 @@  gcov_read_summary (struct gcov_summary *
           while (!cur_bitvector)
             {
               h_ix = bv_ix * 32;
+              gcc_assert(bv_ix < GCOV_HISTOGRAM_BITVECTOR_SIZE);
               cur_bitvector = histo_bitvector[bv_ix++];
-              gcc_assert(bv_ix <= GCOV_HISTOGRAM_BITVECTOR_SIZE);
             }
           while (!(cur_bitvector & 0x1))
             {