• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -asan -asan-module -asan-use-private-alias=1 -S | FileCheck %s
2
3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-unknown-linux-gnu"
5
6@a = internal global [2 x i32] zeroinitializer, align 4
7
8; Check that we generate internal alias and odr indicator symbols for global to be protected.
9; CHECK: @__odr_asan_gen_a = internal global i8 0, align 1
10; CHECK: @"a<stdin>" = internal alias { [2 x i32], [56 x i8] }, { [2 x i32], [56 x i8] }* @a
11
12; Function Attrs: nounwind sanitize_address uwtable
13define i32 @foo(i32 %M) #0 {
14entry:
15  %M.addr = alloca i32, align 4
16  store i32 %M, i32* %M.addr, align 4
17  store volatile i32 6, i32* getelementptr inbounds ([2 x i32], [2 x i32]* @a, i64 2, i64 0), align 4
18  %0 = load i32, i32* %M.addr, align 4
19  %idxprom = sext i32 %0 to i64
20  %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* @a, i64 0, i64 %idxprom
21  %1 = load volatile i32, i32* %arrayidx, align 4
22  ret i32 %1
23}
24