diff mbox

[asan] Change shadow type from unsigned to signed

Message ID CAAkRFZLu2jJyi_HofCH6cdVovSJGgJEEfFKzJSaRuQGbTyO0gA@mail.gmail.com
State New
Headers show

Commit Message

Xinliang David Li Oct. 19, 2012, 3:40 a.m. UTC
The following is small bug fix caught during testing. The shadow value
for redzone can be negative, so the shadow type must be signed for the
check to succeed.

Ok for the branch?

thanks,

David

Comments

Jakub Jelinek Oct. 19, 2012, 7:23 a.m. UTC | #1
On Thu, Oct 18, 2012 at 08:40:32PM -0700, Xinliang David Li wrote:
> The following is small bug fix caught during testing. The shadow value
> for redzone can be negative, so the shadow type must be signed for the
> check to succeed.
> 
> Ok for the branch?

Yes (with a proper ChangeLog.asan entry ;)

> --- asan.c      (revision 192567)
> +++ asan.c      (working copy)
> @@ -825,10 +825,10 @@ static void
>  asan_init_shadow_ptr_types (void)
>  {
>    asan_shadow_set = new_alias_set ();
> -  shadow_ptr_types[0] = build_distinct_type_copy (unsigned_char_type_node);
> +  shadow_ptr_types[0] = build_distinct_type_copy (signed_char_type_node);
>    TYPE_ALIAS_SET (shadow_ptr_types[0]) = asan_shadow_set;
>    shadow_ptr_types[0] = build_pointer_type (shadow_ptr_types[0]);
> -  shadow_ptr_types[1] = build_distinct_type_copy (short_unsigned_type_node);
> +  shadow_ptr_types[1] = build_distinct_type_copy (short_integer_type_node);
>    TYPE_ALIAS_SET (shadow_ptr_types[1]) = asan_shadow_set;
>    shadow_ptr_types[1] = build_pointer_type (shadow_ptr_types[1]);
>  }

	Jakub
diff mbox

Patch

Index: asan.c
===================================================================
--- asan.c      (revision 192567)
+++ asan.c      (working copy)
@@ -825,10 +825,10 @@  static void
 asan_init_shadow_ptr_types (void)
 {
   asan_shadow_set = new_alias_set ();
-  shadow_ptr_types[0] = build_distinct_type_copy (unsigned_char_type_node);
+  shadow_ptr_types[0] = build_distinct_type_copy (signed_char_type_node);
   TYPE_ALIAS_SET (shadow_ptr_types[0]) = asan_shadow_set;
   shadow_ptr_types[0] = build_pointer_type (shadow_ptr_types[0]);
-  shadow_ptr_types[1] = build_distinct_type_copy (short_unsigned_type_node);
+  shadow_ptr_types[1] = build_distinct_type_copy (short_integer_type_node);
   TYPE_ALIAS_SET (shadow_ptr_types[1]) = asan_shadow_set;
   shadow_ptr_types[1] = build_pointer_type (shadow_ptr_types[1]);
 }