From patchwork Mon Mar 12 11:43:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: : Fix negative value in TEST_BIT from mem_overlaps_already_clobbered_arg_p() X-Patchwork-Submitter: mickael guene X-Patchwork-Id: 146061 Message-Id: <4F5DE176.8020803@st.com> To: Date: Mon, 12 Mar 2012 12:43:50 +0100 From: mickael guene List-Id: Hi all, After applying patch from http://gcc.gnu.org/ml/gcc-patches/2012-02/msg00228.html we can have a negative value in call to TEST_BIT() macro in mem_overlaps_already_clobbered_arg_p() function for stored_args_map bitmap table. This can lead to reject a valid tail call optimization. This patch will ensure that i+k is positive before calling TEST_BIT() macro. 2012-03-12 Mickael Guene * calls.c (mem_overlaps_already_clobbered_arg_p): Don't call TEST_BIT for negative value. Regards Mickael --- a/gcc/calls.c 2012-03-12 10:44:27.000000000 +0100 +++ b/gcc/calls.c 2012-03-12 10:46:16.000000000 +0100 @@ -1822,7 +1822,8 @@ unsigned HOST_WIDE_INT k; for (k = 0; k < size; k++) - if (i + k < stored_args_map->n_bits + if (i + k >= 0 + && i + k < stored_args_map->n_bits && TEST_BIT (stored_args_map, i + k)) return true; }