On 2012-10-11 12:38 , Jakub Jelinek wrote:
- gimple_seq seq, stmts; - tree shadow_type = size_in_bytes == 16 ? - short_integer_type_node : char_type_node; - tree shadow_ptr_type = build_pointer_type (shadow_type); - tree uintptr_type = lang_hooks.types.type_for_mode (ptr_mode, - /*unsignedp=*/true); + tree shadow_ptr_type = shadow_ptr_types[size_in_bytes == 16];
Add '? 1 : 0' in the array index expression.
/* Build - (base_addr >> ASAN_SHADOW_SHIFT) | targetm.asan_shadow_offset (). */ + (base_addr >> ASAN_SHADOW_SHIFT) + targetm.asan_shadow_offset (). */
Hm, I wonder if this is a documentation problem or we're generating bad runtime code. Wei, you tested the runtime and it was working with the GCC generated code, right?
In any case, we can adjust the expression later.
+ if (shadow_ptr_types[0] == NULL_TREE) + { + alias_set_type set = new_alias_set (); + shadow_ptr_types[0] + = build_distinct_type_copy (unsigned_char_type_node); + TYPE_ALIAS_SET (shadow_ptr_types[0]) = set; + shadow_ptr_types[0] = build_pointer_type (shadow_ptr_types[0]); + shadow_ptr_types[1] + = build_distinct_type_copy (short_unsigned_type_node); + TYPE_ALIAS_SET (shadow_ptr_types[1]) = set; + shadow_ptr_types[1] = build_pointer_type (shadow_ptr_types[1]); + }
Move this to an initialization function, please. OK with those changes. Diego.