2014-03-20 11:16:34 +00:00
|
|
|
; RUN: opt < %s -asan -asan-module -S | FileCheck %s
|
2012-02-08 21:36:17 +00:00
|
|
|
; AddressSanitizer must insert __asan_handle_no_return
|
2013-02-20 12:35:15 +00:00
|
|
|
; before every noreturn call or invoke.
|
2012-02-08 21:36:17 +00:00
|
|
|
|
|
|
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
|
|
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
|
|
|
|
declare void @MyNoReturnFunc(i32) noreturn
|
|
|
|
|
2013-02-26 06:58:09 +00:00
|
|
|
define i32 @Call1(i8* nocapture %arg) uwtable sanitize_address {
|
2012-02-08 21:36:17 +00:00
|
|
|
entry:
|
2012-11-29 08:57:20 +00:00
|
|
|
call void @MyNoReturnFunc(i32 1) noreturn ; The call insn has noreturn attr.
|
|
|
|
; CHECK: @Call1
|
|
|
|
; CHECK: call void @__asan_handle_no_return
|
|
|
|
; CHECK-NEXT: call void @MyNoReturnFunc
|
|
|
|
; CHECK-NEXT: unreachable
|
2012-02-08 21:36:17 +00:00
|
|
|
unreachable
|
|
|
|
}
|
|
|
|
|
2013-02-26 06:58:09 +00:00
|
|
|
define i32 @Call2(i8* nocapture %arg) uwtable sanitize_address {
|
2012-11-29 08:57:20 +00:00
|
|
|
entry:
|
|
|
|
call void @MyNoReturnFunc(i32 1) ; No noreturn attribure on the call.
|
|
|
|
; CHECK: @Call2
|
2012-02-08 21:36:17 +00:00
|
|
|
; CHECK: call void @__asan_handle_no_return
|
|
|
|
; CHECK-NEXT: call void @MyNoReturnFunc
|
2012-11-29 08:57:20 +00:00
|
|
|
; CHECK-NEXT: unreachable
|
|
|
|
unreachable
|
|
|
|
}
|
2013-02-20 12:35:15 +00:00
|
|
|
|
|
|
|
declare i32 @__gxx_personality_v0(...)
|
|
|
|
|
2013-02-26 06:58:09 +00:00
|
|
|
define i64 @Invoke1(i8** %esc) nounwind uwtable ssp sanitize_address {
|
2013-02-20 12:35:15 +00:00
|
|
|
entry:
|
|
|
|
invoke void @MyNoReturnFunc(i32 1)
|
|
|
|
to label %invoke.cont unwind label %lpad
|
|
|
|
|
|
|
|
invoke.cont:
|
|
|
|
ret i64 0
|
|
|
|
|
|
|
|
lpad:
|
|
|
|
%0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
|
|
|
|
filter [0 x i8*] zeroinitializer
|
|
|
|
ret i64 1
|
|
|
|
}
|
|
|
|
; CHECK: @Invoke1
|
|
|
|
; CHECK: call void @__asan_handle_no_return
|
|
|
|
; CHECK-NEXT: invoke void @MyNoReturnFunc
|
|
|
|
; CHECK: ret i64 0
|
|
|
|
; CHECK: ret i64 1
|