Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(283)

Side by Side Diff: test/Instrumentation/AddressSanitizer/OptKnownBounds/single-after-end.ll

Issue 6643048: Add a known bounds optimization to ASan.
Patch Set: Match the DataLayout getIntPtrType change. Created 11 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 ; Invalid access of the first element after the end of a global array.
2
3 ; RUN: opt < %s -asan -S -asan-opt=1 -asan-opt-known-bounds=1 | FileCheck %s -ch eck-prefix=OPT1
4 ; RUN: opt < %s -asan -S -asan-opt=0 | FileCheck %s -check-prefix=OPT0
5
6 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 2:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:6 4-S128"
7 target triple = "x86_64-unknown-linux-gnu"
8
9 @global_array = internal global [50 x i32] zeroinitializer, align 16
10
11 define i32 @example() address_safety nounwind uwtable readonly {
12 entry:
13 %0 = load i32* getelementptr inbounds ([50 x i32]* @global_array, i64 0, i64 5 0), align 4
14 ret i32 %0
15 }
16
17 ; OPT1: @example
18 ; OPT1: call void @__asan_report_
19 ; OPT1-NOT: call void @__asan_report_
20 ; OPT1: @asan.module_ctor
21
22 ; OPT0: @example
23 ; OPT0: call void @__asan_report_
24 ; OPT0-NOT: call void @__asan_report_
25 ; OPT0: @asan.module_ctor
26
27 ; C-example: static int global_array[50];
28 ; C-example: int example(void) {
29 ; C-example: return global_array[50]; // BUG
30 ; C-example: }
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b