diff mbox

: Fix negative value in TEST_BIT from mem_overlaps_already_clobbered_arg_p()

Message ID 4F5DE176.8020803@st.com
State New
Headers show

Commit Message

Mickael Guene March 12, 2012, 11:43 a.m. UTC
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  <mickael.guene@st.com>

	* calls.c (mem_overlaps_already_clobbered_arg_p): Don't call TEST_BIT for
	negative value.

Regards

Mickael
diff mbox

Patch

--- 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;
     }