Hi, <div><br></div><div>In order to find out-of-bound accesses to global objects with AddressSanitizer (<a href="http://code.google.com/p/address-sanitizer/wiki/AddressSanitizer" target="_blank">http://code.google.com/p/address-sanitizer/wiki/AddressSanitizer</a>)</div>

<div>I need to create redzones to the left and to the right of every global variable. </div><div><br></div><div>I tried the following:</div><div>Before: </div><div><div>  @Extern = global [10 x i8] zeroinitializer, align 1</div>
</div><div>After: </div><div><div>  %0 = type { [32 x i8], [10 x i8], [54 x i8] }</div></div><div>  @Extern_asan_redzone = global %0 zeroinitializer, align 1</div><div><div>  @0 = global [10 x i8] zeroinitializer, align 1   << the old variable</div>
<div>  @Extern = alias getelementptr inbounds (%0* @Extern_asan_redzone, i32 0, i32 1)</div></div><div>I.e. I created a global struct @Extern_asan_redzone of 3 elements and an alias @Extern that points to the middle element of this struct. </div>
<div><br></div><div>The compilation passes, but the resulting object looks like this: </div><div><div>  000000000060d150 B Extern</div><div>  000000000060d150 B Extern_asan_redzone</div></div><div>I.e. @Extern points to the beginning of @Extern_asan_redzone instead of middle. </div>
<div><br></div><div>Also, the comment in GlobalAlias.h says: </div><div><div>  /// getAliasedGlobal() - Aliasee can be either global or bitcast of                                                                                                                               </div>
<div>  /// global. This method retrives the global for both aliasee flavours.</div></div><div><br></div><div>So, the question: can I get an alias pointing to the middle of a GlobalVariable? How?</div><div>If not, is there some other way to create a left redzone for a global variable?</div>
<div><br></div><div>Thanks, </div><div><br></div><div>--kcc </div><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><div><br>
</div><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8">