1; RUN: llc -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck --check-prefix=LINUX-I386 %s 2; RUN: llc -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck --check-prefix=LINUX-X64 %s 3; RUN: llc -code-model=kernel -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck --check-prefix=LINUX-KERNEL-X64 %s 4; RUN: llc -code-model=kernel -mtriple=x86_64-unknown-freebsd < %s -o - | FileCheck --check-prefix=FREEBSD-KERNEL-X64 %s 5; RUN: llc -mtriple=x86_64-apple-darwin < %s -o - | FileCheck --check-prefix=DARWIN-X64 %s 6; RUN: llc -mtriple=amd64-pc-openbsd < %s -o - | FileCheck --check-prefix=OPENBSD-AMD64 %s 7; RUN: llc -mtriple=i386-pc-windows-msvc < %s -o - | FileCheck -check-prefix=MSVC-I386 %s 8; RUN: llc -mtriple=x86_64-w64-mingw32 < %s -o - | FileCheck --check-prefix=MINGW-X64 %s 9; RUN: llc -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck --check-prefix=IGNORE_INTRIN %s 10 11%struct.foo = type { [16 x i8] } 12%struct.foo.0 = type { [4 x i8] } 13%struct.pair = type { i32, i32 } 14%struct.nest = type { %struct.pair, %struct.pair } 15%struct.vec = type { <4 x i32> } 16%class.A = type { [2 x i8] } 17%struct.deep = type { %union.anon } 18%union.anon = type { %struct.anon } 19%struct.anon = type { %struct.anon.0 } 20%struct.anon.0 = type { %union.anon.1 } 21%union.anon.1 = type { [2 x i8] } 22%struct.small = type { i8 } 23%struct.small_char = type { i32, [5 x i8] } 24 25@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 26 27; test1a: array of [16 x i8] 28; no ssp attribute 29; Requires no protector. 30define void @test1a(ptr %a) { 31entry: 32; LINUX-I386-LABEL: test1a: 33; LINUX-I386-NOT: calll __stack_chk_fail 34; LINUX-I386: .cfi_endproc 35 36; LINUX-X64-LABEL: test1a: 37; LINUX-X64-NOT: callq __stack_chk_fail 38; LINUX-X64: .cfi_endproc 39 40; LINUX-KERNEL-X64-LABEL: test1a: 41; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 42; LINUX-KERNEL-X64: .cfi_endproc 43 44; DARWIN-X64-LABEL: test1a: 45; DARWIN-X64-NOT: callq ___stack_chk_fail 46; DARWIN-X64: .cfi_endproc 47 48; MSVC-I386-LABEL: test1a: 49; MSVC-I386-NOT: calll @__security_check_cookie@4 50; MSVC-I386: retl 51 52; MINGW-X64-LABEL: test1a: 53; MINGW-X64-NOT: callq __stack_chk_fail 54; MINGW-X64: .seh_endproc 55 56 %a.addr = alloca ptr, align 8 57 %buf = alloca [16 x i8], align 16 58 store ptr %a, ptr %a.addr, align 8 59 %0 = load ptr, ptr %a.addr, align 8 60 %call = call ptr @strcpy(ptr %buf, ptr %0) 61 %call2 = call i32 (ptr, ...) @printf(ptr @.str, ptr %buf) 62 ret void 63} 64 65; test1b: array of [16 x i8] 66; ssp attribute 67; Requires protector. 68; Function Attrs: ssp 69define void @test1b(ptr %a) #0 { 70entry: 71; LINUX-I386-LABEL: test1b: 72; LINUX-I386: mov{{l|q}} %gs: 73; LINUX-I386: calll __stack_chk_fail 74 75; LINUX-X64-LABEL: test1b: 76; LINUX-X64: mov{{l|q}} %fs: 77; LINUX-X64: callq __stack_chk_fail 78 79; FREEBSD-KERNEL-X64-LABEL: test1b: 80; FREEBSD-KERNEL-X64-NOT: mov{{l|q}} __stack_chk_guard@GOTPCREL 81; FREEBSD-KERNEL-X64: callq __stack_chk_fail 82 83; LINUX-KERNEL-X64-LABEL: test1b: 84; LINUX-KERNEL-X64: mov{{l|q}} %gs: 85; LINUX-KERNEL-X64: callq __stack_chk_fail 86 87; DARWIN-X64-LABEL: test1b: 88; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 89; DARWIN-X64: callq ___stack_chk_fail 90 91; OPENBSD-AMD64-LABEL: test1b: 92; OPENBSD-AMD64: movq __guard_local(%rip) 93; OPENBSD-AMD64: callq __stack_smash_handler 94 95; MSVC-I386-LABEL: test1b: 96; MSVC-I386: movl ___security_cookie, 97; MSVC-I386: calll @__security_check_cookie@4 98 99; MINGW-X64-LABEL: test1b: 100; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 101; MINGW-X64: callq __stack_chk_fail 102 103 %a.addr = alloca ptr, align 8 104 %buf = alloca [16 x i8], align 16 105 store ptr %a, ptr %a.addr, align 8 106 %0 = load ptr, ptr %a.addr, align 8 107 %call = call ptr @strcpy(ptr %buf, ptr %0) 108 %call2 = call i32 (ptr, ...) @printf(ptr @.str, ptr %buf) 109 ret void 110} 111 112; test1c: array of [16 x i8] 113; sspstrong attribute 114; Requires protector. 115; Function Attrs: sspstrong 116define void @test1c(ptr %a) #1 { 117entry: 118; LINUX-I386-LABEL: test1c: 119; LINUX-I386: mov{{l|q}} %gs: 120; LINUX-I386: calll __stack_chk_fail 121 122; LINUX-X64-LABEL: test1c: 123; LINUX-X64: mov{{l|q}} %fs: 124; LINUX-X64: callq __stack_chk_fail 125 126; FREEBSD-KERNEL-X64-LABEL: test1c: 127; FREEBSD-KERNEL-X64: mov{{l|q}} __stack_chk_guard(%rip) 128; FREEBSD-KERNEL-X64: callq __stack_chk_fail 129 130; LINUX-KERNEL-X64-LABEL: test1c: 131; LINUX-KERNEL-X64: mov{{l|q}} %gs: 132; LINUX-KERNEL-X64: callq __stack_chk_fail 133 134; DARWIN-X64-LABEL: test1c: 135; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 136; DARWIN-X64: callq ___stack_chk_fail 137 138; MSVC-I386-LABEL: test1c: 139; MSVC-I386: movl ___security_cookie, 140; MSVC-I386: calll @__security_check_cookie@4 141 142; MINGW-X64-LABEL: test1c: 143; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 144; MINGW-X64: callq __stack_chk_fail 145 146 %a.addr = alloca ptr, align 8 147 %buf = alloca [16 x i8], align 16 148 store ptr %a, ptr %a.addr, align 8 149 %0 = load ptr, ptr %a.addr, align 8 150 %call = call ptr @strcpy(ptr %buf, ptr %0) 151 %call2 = call i32 (ptr, ...) @printf(ptr @.str, ptr %buf) 152 ret void 153} 154 155; test1d: array of [16 x i8] 156; sspreq attribute 157; Requires protector. 158; Function Attrs: sspreq 159define void @test1d(ptr %a) #2 { 160entry: 161; LINUX-I386-LABEL: test1d: 162; LINUX-I386: mov{{l|q}} %gs: 163; LINUX-I386: calll __stack_chk_fail 164 165; LINUX-X64-LABEL: test1d: 166; LINUX-X64: mov{{l|q}} %fs: 167; LINUX-X64: callq __stack_chk_fail 168 169; LINUX-KERNEL-X64-LABEL: test1d: 170; LINUX-KERNEL-X64: mov{{l|q}} %gs: 171; LINUX-KERNEL-X64: callq __stack_chk_fail 172 173; DARWIN-X64-LABEL: test1d: 174; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 175; DARWIN-X64: callq ___stack_chk_fail 176 177; MSVC-I386-LABEL: test1d: 178; MSVC-I386: movl ___security_cookie, 179; MSVC-I386: calll @__security_check_cookie@4 180 181; MINGW-X64-LABEL: test1d: 182; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 183; MINGW-X64: callq __stack_chk_fail 184 185 %a.addr = alloca ptr, align 8 186 %buf = alloca [16 x i8], align 16 187 store ptr %a, ptr %a.addr, align 8 188 %0 = load ptr, ptr %a.addr, align 8 189 %call = call ptr @strcpy(ptr %buf, ptr %0) 190 %call2 = call i32 (ptr, ...) @printf(ptr @.str, ptr %buf) 191 ret void 192} 193 194; test2a: struct { [16 x i8] } 195; no ssp attribute 196; Requires no protector. 197define void @test2a(ptr %a) { 198entry: 199; LINUX-I386-LABEL: test2a: 200; LINUX-I386-NOT: calll __stack_chk_fail 201; LINUX-I386: .cfi_endproc 202 203; LINUX-X64-LABEL: test2a: 204; LINUX-X64-NOT: callq __stack_chk_fail 205; LINUX-X64: .cfi_endproc 206 207; LINUX-KERNEL-X64-LABEL: test2a: 208; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 209; LINUX-KERNEL-X64: .cfi_endproc 210 211; DARWIN-X64-LABEL: test2a: 212; DARWIN-X64-NOT: callq ___stack_chk_fail 213; DARWIN-X64: .cfi_endproc 214 215; MSVC-I386-LABEL: test2a: 216; MSVC-I386-NOT: calll @__security_check_cookie@4 217; MSVC-I386: retl 218 219; MINGW-X64-LABEL: test2a: 220; MINGW-X64-NOT: callq __stack_chk_fail 221; MINGW-X64: .seh_endproc 222 223 %a.addr = alloca ptr, align 8 224 %b = alloca %struct.foo, align 1 225 store ptr %a, ptr %a.addr, align 8 226 %0 = load ptr, ptr %a.addr, align 8 227 %call = call ptr @strcpy(ptr %b, ptr %0) 228 %call3 = call i32 (ptr, ...) @printf(ptr @.str, ptr %b) 229 ret void 230} 231 232; test2b: struct { [16 x i8] } 233; ssp attribute 234; Requires protector. 235; Function Attrs: ssp 236define void @test2b(ptr %a) #0 { 237entry: 238; LINUX-I386-LABEL: test2b: 239; LINUX-I386: mov{{l|q}} %gs: 240; LINUX-I386: calll __stack_chk_fail 241 242; LINUX-X64-LABEL: test2b: 243; LINUX-X64: mov{{l|q}} %fs: 244; LINUX-X64: callq __stack_chk_fail 245 246; LINUX-KERNEL-X64-LABEL: test2b: 247; LINUX-KERNEL-X64: mov{{l|q}} %gs: 248; LINUX-KERNEL-X64: callq __stack_chk_fail 249 250; DARWIN-X64-LABEL: test2b: 251; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 252; DARWIN-X64: callq ___stack_chk_fail 253 254; MINGW-X64-LABEL: test2b: 255; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 256; MINGW-X64: callq __stack_chk_fail 257 258 %a.addr = alloca ptr, align 8 259 %b = alloca %struct.foo, align 1 260 store ptr %a, ptr %a.addr, align 8 261 %0 = load ptr, ptr %a.addr, align 8 262 %call = call ptr @strcpy(ptr %b, ptr %0) 263 %call3 = call i32 (ptr, ...) @printf(ptr @.str, ptr %b) 264 ret void 265} 266 267; test2c: struct { [16 x i8] } 268; sspstrong attribute 269; Requires protector. 270; Function Attrs: sspstrong 271define void @test2c(ptr %a) #1 { 272entry: 273; LINUX-I386-LABEL: test2c: 274; LINUX-I386: mov{{l|q}} %gs: 275; LINUX-I386: calll __stack_chk_fail 276 277; LINUX-X64-LABEL: test2c: 278; LINUX-X64: mov{{l|q}} %fs: 279; LINUX-X64: callq __stack_chk_fail 280 281; LINUX-KERNEL-X64-LABEL: test2c: 282; LINUX-KERNEL-X64: mov{{l|q}} %gs: 283; LINUX-KERNEL-X64: callq __stack_chk_fail 284 285; DARWIN-X64-LABEL: test2c: 286; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 287; DARWIN-X64: callq ___stack_chk_fail 288 289; MSVC-I386-LABEL: test2c: 290; MSVC-I386: movl ___security_cookie, 291; MSVC-I386: calll @__security_check_cookie@4 292 293; MINGW-X64-LABEL: test2c: 294; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 295; MINGW-X64: callq __stack_chk_fail 296 297 %a.addr = alloca ptr, align 8 298 %b = alloca %struct.foo, align 1 299 store ptr %a, ptr %a.addr, align 8 300 %0 = load ptr, ptr %a.addr, align 8 301 %call = call ptr @strcpy(ptr %b, ptr %0) 302 %call3 = call i32 (ptr, ...) @printf(ptr @.str, ptr %b) 303 ret void 304} 305 306; test2d: struct { [16 x i8] } 307; sspreq attribute 308; Requires protector. 309; Function Attrs: sspreq 310define void @test2d(ptr %a) #2 { 311entry: 312; LINUX-I386-LABEL: test2d: 313; LINUX-I386: mov{{l|q}} %gs: 314; LINUX-I386: calll __stack_chk_fail 315 316; LINUX-X64-LABEL: test2d: 317; LINUX-X64: mov{{l|q}} %fs: 318; LINUX-X64: callq __stack_chk_fail 319 320; LINUX-KERNEL-X64-LABEL: test2d: 321; LINUX-KERNEL-X64: mov{{l|q}} %gs: 322; LINUX-KERNEL-X64: callq __stack_chk_fail 323 324; DARWIN-X64-LABEL: test2d: 325; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 326; DARWIN-X64: callq ___stack_chk_fail 327 328; MSVC-I386-LABEL: test2d: 329; MSVC-I386: movl ___security_cookie, 330; MSVC-I386: calll @__security_check_cookie@4 331 332; MINGW-X64-LABEL: test2d: 333; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 334; MINGW-X64: callq __stack_chk_fail 335 336 %a.addr = alloca ptr, align 8 337 %b = alloca %struct.foo, align 1 338 store ptr %a, ptr %a.addr, align 8 339 %0 = load ptr, ptr %a.addr, align 8 340 %call = call ptr @strcpy(ptr %b, ptr %0) 341 %call3 = call i32 (ptr, ...) @printf(ptr @.str, ptr %b) 342 ret void 343} 344 345; test3a: array of [4 x i8] 346; no ssp attribute 347; Requires no protector. 348define void @test3a(ptr %a) { 349entry: 350; LINUX-I386-LABEL: test3a: 351; LINUX-I386-NOT: calll __stack_chk_fail 352; LINUX-I386: .cfi_endproc 353 354; LINUX-X64-LABEL: test3a: 355; LINUX-X64-NOT: callq __stack_chk_fail 356; LINUX-X64: .cfi_endproc 357 358; LINUX-KERNEL-X64-LABEL: test3a: 359; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 360; LINUX-KERNEL-X64: .cfi_endproc 361 362; DARWIN-X64-LABEL: test3a: 363; DARWIN-X64-NOT: callq ___stack_chk_fail 364; DARWIN-X64: .cfi_endproc 365 366; MSVC-I386-LABEL: test3a: 367; MSVC-I386-NOT: calll @__security_check_cookie@4 368; MSVC-I386: retl 369 370; MINGW-X64-LABEL: test3a: 371; MINGW-X64-NOT: callq __stack_chk_fail 372; MINGW-X64: .seh_endproc 373 374 %a.addr = alloca ptr, align 8 375 %buf = alloca [4 x i8], align 1 376 store ptr %a, ptr %a.addr, align 8 377 %0 = load ptr, ptr %a.addr, align 8 378 %call = call ptr @strcpy(ptr %buf, ptr %0) 379 %call2 = call i32 (ptr, ...) @printf(ptr @.str, ptr %buf) 380 ret void 381} 382 383; test3b: array [4 x i8] 384; ssp attribute 385; Requires no protector. 386; Function Attrs: ssp 387define void @test3b(ptr %a) #0 { 388entry: 389; LINUX-I386-LABEL: test3b: 390; LINUX-I386-NOT: calll __stack_chk_fail 391; LINUX-I386: .cfi_endproc 392 393; LINUX-X64-LABEL: test3b: 394; LINUX-X64-NOT: callq __stack_chk_fail 395; LINUX-X64: .cfi_endproc 396 397; LINUX-KERNEL-X64-LABEL: test3b: 398; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 399; LINUX-KERNEL-X64: .cfi_endproc 400 401; DARWIN-X64-LABEL: test3b: 402; DARWIN-X64-NOT: callq ___stack_chk_fail 403; DARWIN-X64: .cfi_endproc 404 405; MSVC-I386-LABEL: test3b: 406; MSVC-I386-NOT: calll @__security_check_cookie@4 407; MSVC-I386: retl 408 409; MINGW-X64-LABEL: test3b: 410; MINGW-X64-NOT: callq __stack_chk_fail 411; MINGW-X64: .seh_endproc 412 413 %a.addr = alloca ptr, align 8 414 %buf = alloca [4 x i8], align 1 415 store ptr %a, ptr %a.addr, align 8 416 %0 = load ptr, ptr %a.addr, align 8 417 %call = call ptr @strcpy(ptr %buf, ptr %0) 418 %call2 = call i32 (ptr, ...) @printf(ptr @.str, ptr %buf) 419 ret void 420} 421 422; test3c: array of [4 x i8] 423; sspstrong attribute 424; Requires protector. 425; Function Attrs: sspstrong 426define void @test3c(ptr %a) #1 { 427entry: 428; LINUX-I386-LABEL: test3c: 429; LINUX-I386: mov{{l|q}} %gs: 430; LINUX-I386: calll __stack_chk_fail 431 432; LINUX-X64-LABEL: test3c: 433; LINUX-X64: mov{{l|q}} %fs: 434; LINUX-X64: callq __stack_chk_fail 435 436; LINUX-KERNEL-X64-LABEL: test3c: 437; LINUX-KERNEL-X64: mov{{l|q}} %gs: 438; LINUX-KERNEL-X64: callq __stack_chk_fail 439 440; DARWIN-X64-LABEL: test3c: 441; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 442; DARWIN-X64: callq ___stack_chk_fail 443 444; MSVC-I386-LABEL: test3c: 445; MSVC-I386: movl ___security_cookie, 446; MSVC-I386: calll @__security_check_cookie@4 447 448; MINGW-X64-LABEL: test3c: 449; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 450; MINGW-X64: callq __stack_chk_fail 451 452 %a.addr = alloca ptr, align 8 453 %buf = alloca [4 x i8], align 1 454 store ptr %a, ptr %a.addr, align 8 455 %0 = load ptr, ptr %a.addr, align 8 456 %call = call ptr @strcpy(ptr %buf, ptr %0) 457 %call2 = call i32 (ptr, ...) @printf(ptr @.str, ptr %buf) 458 ret void 459} 460 461; test3d: array of [4 x i8] 462; sspreq attribute 463; Requires protector. 464; Function Attrs: sspreq 465define void @test3d(ptr %a) #2 { 466entry: 467; LINUX-I386-LABEL: test3d: 468; LINUX-I386: mov{{l|q}} %gs: 469; LINUX-I386: calll __stack_chk_fail 470 471; LINUX-X64-LABEL: test3d: 472; LINUX-X64: mov{{l|q}} %fs: 473; LINUX-X64: callq __stack_chk_fail 474 475; LINUX-KERNEL-X64-LABEL: test3d: 476; LINUX-KERNEL-X64: mov{{l|q}} %gs: 477; LINUX-KERNEL-X64: callq __stack_chk_fail 478 479; DARWIN-X64-LABEL: test3d: 480; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 481; DARWIN-X64: callq ___stack_chk_fail 482 483; MSVC-I386-LABEL: test3d: 484; MSVC-I386: movl ___security_cookie, 485; MSVC-I386: calll @__security_check_cookie@4 486 487; MINGW-X64-LABEL: test3d: 488; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 489; MINGW-X64: callq __stack_chk_fail 490 491 %a.addr = alloca ptr, align 8 492 %buf = alloca [4 x i8], align 1 493 store ptr %a, ptr %a.addr, align 8 494 %0 = load ptr, ptr %a.addr, align 8 495 %call = call ptr @strcpy(ptr %buf, ptr %0) 496 %call2 = call i32 (ptr, ...) @printf(ptr @.str, ptr %buf) 497 ret void 498} 499 500; test4a: struct { [4 x i8] } 501; no ssp attribute 502; Requires no protector. 503define void @test4a(ptr %a) { 504entry: 505; LINUX-I386-LABEL: test4a: 506; LINUX-I386-NOT: calll __stack_chk_fail 507; LINUX-I386: .cfi_endproc 508 509; LINUX-X64-LABEL: test4a: 510; LINUX-X64-NOT: callq __stack_chk_fail 511; LINUX-X64: .cfi_endproc 512 513; LINUX-KERNEL-X64-LABEL: test4a: 514; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 515; LINUX-KERNEL-X64: .cfi_endproc 516 517; DARWIN-X64-LABEL: test4a: 518; DARWIN-X64-NOT: callq ___stack_chk_fail 519; DARWIN-X64: .cfi_endproc 520 521; MSVC-I386-LABEL: test4a: 522; MSVC-I386-NOT: calll @__security_check_cookie@4 523; MSVC-I386: retl 524 525; MINGW-X64-LABEL: test4a: 526; MINGW-X64-NOT: callq __stack_chk_fail 527; MINGW-X64: .seh_endproc 528 529 %a.addr = alloca ptr, align 8 530 %b = alloca %struct.foo.0, align 1 531 store ptr %a, ptr %a.addr, align 8 532 %0 = load ptr, ptr %a.addr, align 8 533 %call = call ptr @strcpy(ptr %b, ptr %0) 534 %call3 = call i32 (ptr, ...) @printf(ptr @.str, ptr %b) 535 ret void 536} 537 538; test4b: struct { [4 x i8] } 539; ssp attribute 540; Requires no protector. 541; Function Attrs: ssp 542define void @test4b(ptr %a) #0 { 543entry: 544; LINUX-I386-LABEL: test4b: 545; LINUX-I386-NOT: calll __stack_chk_fail 546; LINUX-I386: .cfi_endproc 547 548; LINUX-X64-LABEL: test4b: 549; LINUX-X64-NOT: callq __stack_chk_fail 550; LINUX-X64: .cfi_endproc 551 552; LINUX-KERNEL-X64-LABEL: test4b: 553; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 554; LINUX-KERNEL-X64: .cfi_endproc 555 556; DARWIN-X64-LABEL: test4b: 557; DARWIN-X64-NOT: callq ___stack_chk_fail 558; DARWIN-X64: .cfi_endproc 559 560; MSVC-I386-LABEL: test4b: 561; MSVC-I386-NOT: calll @__security_check_cookie@4 562; MSVC-I386: retl 563 564; MINGW-X64-LABEL: test4b: 565; MINGW-X64-NOT: callq __stack_chk_fail 566; MINGW-X64: .seh_endproc 567 568 %a.addr = alloca ptr, align 8 569 %b = alloca %struct.foo.0, align 1 570 store ptr %a, ptr %a.addr, align 8 571 %0 = load ptr, ptr %a.addr, align 8 572 %call = call ptr @strcpy(ptr %b, ptr %0) 573 %call3 = call i32 (ptr, ...) @printf(ptr @.str, ptr %b) 574 ret void 575} 576 577; test4c: struct { [4 x i8] } 578; sspstrong attribute 579; Requires protector. 580; Function Attrs: sspstrong 581define void @test4c(ptr %a) #1 { 582entry: 583; LINUX-I386-LABEL: test4c: 584; LINUX-I386: mov{{l|q}} %gs: 585; LINUX-I386: calll __stack_chk_fail 586 587; LINUX-X64-LABEL: test4c: 588; LINUX-X64: mov{{l|q}} %fs: 589; LINUX-X64: callq __stack_chk_fail 590 591; LINUX-KERNEL-X64-LABEL: test4c: 592; LINUX-KERNEL-X64: mov{{l|q}} %gs: 593; LINUX-KERNEL-X64: callq __stack_chk_fail 594 595; DARWIN-X64-LABEL: test4c: 596; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 597; DARWIN-X64: callq ___stack_chk_fail 598 599; MSVC-I386-LABEL: test4c: 600; MSVC-I386: movl ___security_cookie, 601; MSVC-I386: calll @__security_check_cookie@4 602 603; MINGW-X64-LABEL: test4c: 604; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 605; MINGW-X64: callq __stack_chk_fail 606 607 %a.addr = alloca ptr, align 8 608 %b = alloca %struct.foo.0, align 1 609 store ptr %a, ptr %a.addr, align 8 610 %0 = load ptr, ptr %a.addr, align 8 611 %call = call ptr @strcpy(ptr %b, ptr %0) 612 %call3 = call i32 (ptr, ...) @printf(ptr @.str, ptr %b) 613 ret void 614} 615 616; test4d: struct { [4 x i8] } 617; sspreq attribute 618; Requires protector. 619; Function Attrs: sspreq 620define void @test4d(ptr %a) #2 { 621entry: 622; LINUX-I386-LABEL: test4d: 623; LINUX-I386: mov{{l|q}} %gs: 624; LINUX-I386: calll __stack_chk_fail 625 626; LINUX-X64-LABEL: test4d: 627; LINUX-X64: mov{{l|q}} %fs: 628; LINUX-X64: callq __stack_chk_fail 629 630; LINUX-KERNEL-X64-LABEL: test4d: 631; LINUX-KERNEL-X64: mov{{l|q}} %gs: 632; LINUX-KERNEL-X64: callq __stack_chk_fail 633 634; DARWIN-X64-LABEL: test4d: 635; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 636; DARWIN-X64: callq ___stack_chk_fail 637 638; MSVC-I386-LABEL: test4d: 639; MSVC-I386: movl ___security_cookie, 640; MSVC-I386: calll @__security_check_cookie@4 641 642; MINGW-X64-LABEL: test4d: 643; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 644; MINGW-X64: callq __stack_chk_fail 645 646 %a.addr = alloca ptr, align 8 647 %b = alloca %struct.foo.0, align 1 648 store ptr %a, ptr %a.addr, align 8 649 %0 = load ptr, ptr %a.addr, align 8 650 %call = call ptr @strcpy(ptr %b, ptr %0) 651 %call3 = call i32 (ptr, ...) @printf(ptr @.str, ptr %b) 652 ret void 653} 654 655; test5a: no arrays / no nested arrays 656; no ssp attribute 657; Requires no protector. 658define void @test5a(ptr %a) { 659entry: 660; LINUX-I386-LABEL: test5a: 661; LINUX-I386-NOT: calll __stack_chk_fail 662; LINUX-I386: .cfi_endproc 663 664; LINUX-X64-LABEL: test5a: 665; LINUX-X64-NOT: callq __stack_chk_fail 666; LINUX-X64: .cfi_endproc 667 668; LINUX-KERNEL-X64-LABEL: test5a: 669; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 670; LINUX-KERNEL-X64: .cfi_endproc 671 672; DARWIN-X64-LABEL: test5a: 673; DARWIN-X64-NOT: callq ___stack_chk_fail 674; DARWIN-X64: .cfi_endproc 675 676; MSVC-I386-LABEL: test5a: 677; MSVC-I386-NOT: calll @__security_check_cookie@4 678; MSVC-I386: retl 679 680; MINGW-X64-LABEL: test5a: 681; MINGW-X64-NOT: callq __stack_chk_fail 682; MINGW-X64: .seh_endproc 683 684 %a.addr = alloca ptr, align 8 685 store ptr %a, ptr %a.addr, align 8 686 %0 = load ptr, ptr %a.addr, align 8 687 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %0) 688 ret void 689} 690 691; test5b: no arrays / no nested arrays 692; ssp attribute 693; Requires no protector. 694; Function Attrs: ssp 695define void @test5b(ptr %a) #0 { 696entry: 697; LINUX-I386-LABEL: test5b: 698; LINUX-I386-NOT: calll __stack_chk_fail 699; LINUX-I386: .cfi_endproc 700 701; LINUX-X64-LABEL: test5b: 702; LINUX-X64-NOT: callq __stack_chk_fail 703; LINUX-X64: .cfi_endproc 704 705; LINUX-KERNEL-X64-LABEL: test5b: 706; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 707; LINUX-KERNEL-X64: .cfi_endproc 708 709; DARWIN-X64-LABEL: test5b: 710; DARWIN-X64-NOT: callq ___stack_chk_fail 711; DARWIN-X64: .cfi_endproc 712 713; MSVC-I386-LABEL: test5b: 714; MSVC-I386-NOT: calll @__security_check_cookie@4 715; MSVC-I386: retl 716 717; MINGW-X64-LABEL: test5b: 718; MINGW-X64-NOT: callq __stack_chk_fail 719; MINGW-X64: .seh_endproc 720 721 %a.addr = alloca ptr, align 8 722 store ptr %a, ptr %a.addr, align 8 723 %0 = load ptr, ptr %a.addr, align 8 724 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %0) 725 ret void 726} 727 728; test5c: no arrays / no nested arrays 729; sspstrong attribute 730; Requires no protector. 731; Function Attrs: sspstrong 732define void @test5c(ptr %a) #1 { 733entry: 734; LINUX-I386-LABEL: test5c: 735; LINUX-I386-NOT: calll __stack_chk_fail 736; LINUX-I386: .cfi_endproc 737 738; LINUX-X64-LABEL: test5c: 739; LINUX-X64-NOT: callq __stack_chk_fail 740; LINUX-X64: .cfi_endproc 741 742; LINUX-KERNEL-X64-LABEL: test5c: 743; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 744; LINUX-KERNEL-X64: .cfi_endproc 745 746; DARWIN-X64-LABEL: test5c: 747; DARWIN-X64-NOT: callq ___stack_chk_fail 748; DARWIN-X64: .cfi_endproc 749 750; MSVC-I386-LABEL: test5c: 751; MSVC-I386-NOT: calll @__security_check_cookie@4 752; MSVC-I386: retl 753 754; MINGW-X64-LABEL: test5c: 755; MINGW-X64-NOT: callq __stack_chk_fail 756; MINGW-X64: .seh_endproc 757 758 %a.addr = alloca ptr, align 8 759 store ptr %a, ptr %a.addr, align 8 760 %0 = load ptr, ptr %a.addr, align 8 761 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %0) 762 ret void 763} 764 765; test5d: no arrays / no nested arrays 766; sspreq attribute 767; Requires protector. 768; Function Attrs: sspreq 769define void @test5d(ptr %a) #2 { 770entry: 771; LINUX-I386-LABEL: test5d: 772; LINUX-I386: mov{{l|q}} %gs: 773; LINUX-I386: calll __stack_chk_fail 774 775; LINUX-X64-LABEL: test5d: 776; LINUX-X64: mov{{l|q}} %fs: 777; LINUX-X64: callq __stack_chk_fail 778 779; LINUX-KERNEL-X64-LABEL: test5d: 780; LINUX-KERNEL-X64: mov{{l|q}} %gs: 781; LINUX-KERNEL-X64: callq __stack_chk_fail 782 783; DARWIN-X64-LABEL: test5d: 784; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 785; DARWIN-X64: callq ___stack_chk_fail 786 787; MSVC-I386-LABEL: test5d: 788; MSVC-I386: movl ___security_cookie, 789; MSVC-I386: calll @__security_check_cookie@4 790 791; MINGW-X64-LABEL: test5d: 792; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 793; MINGW-X64: callq __stack_chk_fail 794 795 %a.addr = alloca ptr, align 8 796 store ptr %a, ptr %a.addr, align 8 797 %0 = load ptr, ptr %a.addr, align 8 798 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %0) 799 ret void 800} 801 802; test6a: Address-of local taken (j = &a) 803; no ssp attribute 804; Requires no protector. 805define void @test6a() { 806entry: 807; LINUX-I386-LABEL: test6a: 808; LINUX-I386-NOT: calll __stack_chk_fail 809; LINUX-I386: .cfi_endproc 810 811; LINUX-X64-LABEL: test6a: 812; LINUX-X64-NOT: callq __stack_chk_fail 813; LINUX-X64: .cfi_endproc 814 815; LINUX-KERNEL-X64-LABEL: test6a: 816; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 817; LINUX-KERNEL-X64: .cfi_endproc 818 819; DARWIN-X64-LABEL: test6a: 820; DARWIN-X64-NOT: callq ___stack_chk_fail 821; DARWIN-X64: .cfi_endproc 822 823; MSVC-I386-LABEL: test6a: 824; MSVC-I386-NOT: calll @__security_check_cookie@4 825; MSVC-I386: retl 826 827; MINGW-X64-LABEL: test6a: 828; MINGW-X64-NOT: callq __stack_chk_fail 829; MINGW-X64: .seh_endproc 830 831 %retval = alloca i32, align 4 832 %a = alloca i32, align 4 833 %j = alloca ptr, align 8 834 store i32 0, ptr %retval 835 %0 = load i32, ptr %a, align 4 836 %add = add nsw i32 %0, 1 837 store i32 %add, ptr %a, align 4 838 store ptr %a, ptr %j, align 8 839 ret void 840} 841 842; test6b: Address-of local taken (j = &a) 843; ssp attribute 844; Requires no protector. 845; Function Attrs: ssp 846define void @test6b() #0 { 847entry: 848; LINUX-I386-LABEL: test6b: 849; LINUX-I386-NOT: calll __stack_chk_fail 850; LINUX-I386: .cfi_endproc 851 852; LINUX-X64-LABEL: test6b: 853; LINUX-X64-NOT: callq __stack_chk_fail 854; LINUX-X64: .cfi_endproc 855 856; LINUX-KERNEL-X64-LABEL: test6b: 857; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 858; LINUX-KERNEL-X64: .cfi_endproc 859 860; DARWIN-X64-LABEL: test6b: 861; DARWIN-X64-NOT: callq ___stack_chk_fail 862; DARWIN-X64: .cfi_endproc 863 864; MSVC-I386-LABEL: test6b: 865; MSVC-I386-NOT: calll @__security_check_cookie@4 866; MSVC-I386: retl 867 868; MINGW-X64-LABEL: test6b: 869; MINGW-X64-NOT: callq __stack_chk_fail 870; MINGW-X64: .seh_endproc 871 872 %retval = alloca i32, align 4 873 %a = alloca i32, align 4 874 %j = alloca ptr, align 8 875 store i32 0, ptr %retval 876 %0 = load i32, ptr %a, align 4 877 %add = add nsw i32 %0, 1 878 store i32 %add, ptr %a, align 4 879 store ptr %a, ptr %j, align 8 880 ret void 881} 882 883; test6c: Address-of local taken (j = &a) 884; sspstrong attribute 885; Requires protector. 886; Function Attrs: sspstrong 887define void @test6c() #1 { 888entry: 889; LINUX-I386-LABEL: test6c: 890; LINUX-I386: mov{{l|q}} %gs: 891; LINUX-I386: calll __stack_chk_fail 892 893; LINUX-X64-LABEL: test6c: 894; LINUX-X64: mov{{l|q}} %fs: 895; LINUX-X64: callq __stack_chk_fail 896 897; LINUX-KERNEL-X64-LABEL: test6c: 898; LINUX-KERNEL-X64: mov{{l|q}} %gs: 899; LINUX-KERNEL-X64: callq __stack_chk_fail 900 901; DARWIN-X64-LABEL: test6c: 902; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 903; DARWIN-X64: callq ___stack_chk_fail 904 905; MSVC-I386-LABEL: test6c: 906; MSVC-I386: movl ___security_cookie, 907; MSVC-I386: calll @__security_check_cookie@4 908 909; MINGW-X64-LABEL: test6c: 910; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 911; MINGW-X64: callq __stack_chk_fail 912 913 %retval = alloca i32, align 4 914 %a = alloca i32, align 4 915 %j = alloca ptr, align 8 916 store i32 0, ptr %retval 917 %0 = load i32, ptr %a, align 4 918 %add = add nsw i32 %0, 1 919 store i32 %add, ptr %a, align 4 920 store ptr %a, ptr %j, align 8 921 ret void 922} 923 924; test6d: Address-of local taken (j = &a) 925; sspreq attribute 926; Requires protector. 927; Function Attrs: sspreq 928define void @test6d() #2 { 929entry: 930; LINUX-I386-LABEL: test6d: 931; LINUX-I386: mov{{l|q}} %gs: 932; LINUX-I386: calll __stack_chk_fail 933 934; LINUX-X64-LABEL: test6d: 935; LINUX-X64: mov{{l|q}} %fs: 936; LINUX-X64: callq __stack_chk_fail 937 938; LINUX-KERNEL-X64-LABEL: test6d: 939; LINUX-KERNEL-X64: mov{{l|q}} %gs: 940; LINUX-KERNEL-X64: callq __stack_chk_fail 941 942; DARWIN-X64-LABEL: test6d: 943; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 944; DARWIN-X64: callq ___stack_chk_fail 945 946; MSVC-I386-LABEL: test6d: 947; MSVC-I386: movl ___security_cookie, 948; MSVC-I386: calll @__security_check_cookie@4 949 950; MINGW-X64-LABEL: test6d: 951; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 952; MINGW-X64: callq __stack_chk_fail 953 954 %retval = alloca i32, align 4 955 %a = alloca i32, align 4 956 %j = alloca ptr, align 8 957 store i32 0, ptr %retval 958 %0 = load i32, ptr %a, align 4 959 %add = add nsw i32 %0, 1 960 store i32 %add, ptr %a, align 4 961 store ptr %a, ptr %j, align 8 962 ret void 963} 964 965; test7a: PtrToInt Cast 966; no ssp attribute 967; Requires no protector. 968define void @test7a() { 969entry: 970; LINUX-I386-LABEL: test7a: 971; LINUX-I386-NOT: calll __stack_chk_fail 972; LINUX-I386: .cfi_endproc 973 974; LINUX-X64-LABEL: test7a: 975; LINUX-X64-NOT: callq __stack_chk_fail 976; LINUX-X64: .cfi_endproc 977 978; LINUX-KERNEL-X64-LABEL: test7a: 979; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 980; LINUX-KERNEL-X64: .cfi_endproc 981 982; DARWIN-X64-LABEL: test7a: 983; DARWIN-X64-NOT: callq ___stack_chk_fail 984; DARWIN-X64: .cfi_endproc 985 986; MSVC-I386-LABEL: test7a: 987; MSVC-I386-NOT: calll @__security_check_cookie@4 988; MSVC-I386: retl 989 990; MINGW-X64-LABEL: test7a: 991; MINGW-X64-NOT: callq __stack_chk_fail 992; MINGW-X64: .seh_endproc 993 994 %a = alloca i32, align 4 995 %0 = ptrtoint ptr %a to i64 996 %call = call i32 (ptr, ...) @printf(ptr @.str, i64 %0) 997 ret void 998} 999 1000; test7b: PtrToInt Cast 1001; ssp attribute 1002; Requires no protector. 1003; Function Attrs: ssp 1004define void @test7b() #0 { 1005entry: 1006; LINUX-I386-LABEL: test7b: 1007; LINUX-I386-NOT: calll __stack_chk_fail 1008; LINUX-I386: .cfi_endproc 1009 1010; LINUX-X64-LABEL: test7b: 1011; LINUX-X64-NOT: callq __stack_chk_fail 1012; LINUX-X64: .cfi_endproc 1013 1014; LINUX-KERNEL-X64-LABEL: test7b: 1015; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 1016; LINUX-KERNEL-X64: .cfi_endproc 1017 1018; DARWIN-X64-LABEL: test7b: 1019; DARWIN-X64-NOT: callq ___stack_chk_fail 1020; DARWIN-X64: .cfi_endproc 1021 1022; MSVC-I386-LABEL: test7b: 1023; MSVC-I386-NOT: calll @__security_check_cookie@4 1024; MSVC-I386: retl 1025 1026; MINGW-X64-LABEL: test7b: 1027; MINGW-X64-NOT: callq __stack_chk_fail 1028; MINGW-X64: .seh_endproc 1029 1030 %a = alloca i32, align 4 1031 %0 = ptrtoint ptr %a to i64 1032 %call = call i32 (ptr, ...) @printf(ptr @.str, i64 %0) 1033 ret void 1034} 1035 1036; test7c: PtrToInt Cast 1037; sspstrong attribute 1038; Requires protector. 1039; Function Attrs: sspstrong 1040define void @test7c() #1 { 1041entry: 1042; LINUX-I386-LABEL: test7c: 1043; LINUX-I386: mov{{l|q}} %gs: 1044; LINUX-I386: calll __stack_chk_fail 1045 1046; LINUX-X64-LABEL: test7c: 1047; LINUX-X64: mov{{l|q}} %fs: 1048; LINUX-X64: callq __stack_chk_fail 1049 1050; LINUX-KERNEL-X64-LABEL: test7c: 1051; LINUX-KERNEL-X64: mov{{l|q}} %gs: 1052; LINUX-KERNEL-X64: callq __stack_chk_fail 1053 1054; DARWIN-X64-LABEL: test7c: 1055; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 1056; DARWIN-X64: callq ___stack_chk_fail 1057 1058; MSVC-I386-LABEL: test7c: 1059; MSVC-I386: movl ___security_cookie, 1060; MSVC-I386: calll @__security_check_cookie@4 1061 1062; MINGW-X64-LABEL: test7c: 1063; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 1064; MINGW-X64: .seh_endproc 1065 1066 %a = alloca i32, align 4 1067 %0 = ptrtoint ptr %a to i64 1068 %call = call i32 (ptr, ...) @printf(ptr @.str, i64 %0) 1069 ret void 1070} 1071 1072; test7d: PtrToInt Cast 1073; sspreq attribute 1074; Requires protector. 1075; Function Attrs: sspreq 1076define void @test7d() #2 { 1077entry: 1078; LINUX-I386-LABEL: test7d: 1079; LINUX-I386: mov{{l|q}} %gs: 1080; LINUX-I386: calll __stack_chk_fail 1081 1082; LINUX-X64-LABEL: test7d: 1083; LINUX-X64: mov{{l|q}} %fs: 1084; LINUX-X64: callq __stack_chk_fail 1085 1086; LINUX-KERNEL-X64-LABEL: test7d: 1087; LINUX-KERNEL-X64: mov{{l|q}} %gs: 1088; LINUX-KERNEL-X64: callq __stack_chk_fail 1089 1090; DARWIN-X64-LABEL: test7d: 1091; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 1092; DARWIN-X64: callq ___stack_chk_fail 1093 1094; MSVC-I386-LABEL: test7d: 1095; MSVC-I386: movl ___security_cookie, 1096; MSVC-I386: calll @__security_check_cookie@4 1097 1098; MINGW-X64-LABEL: test7d: 1099; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 1100; MINGW-X64: callq __stack_chk_fail 1101 1102 %a = alloca i32, align 4 1103 %0 = ptrtoint ptr %a to i64 1104 %call = call i32 (ptr, ...) @printf(ptr @.str, i64 %0) 1105 ret void 1106} 1107 1108; test8a: Passing addr-of to function call 1109; no ssp attribute 1110; Requires no protector. 1111define void @test8a() { 1112entry: 1113; LINUX-I386-LABEL: test8a: 1114; LINUX-I386-NOT: calll __stack_chk_fail 1115; LINUX-I386: .cfi_endproc 1116 1117; LINUX-X64-LABEL: test8a: 1118; LINUX-X64-NOT: callq __stack_chk_fail 1119; LINUX-X64: .cfi_endproc 1120 1121; LINUX-KERNEL-X64-LABEL: test8a: 1122; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 1123; LINUX-KERNEL-X64: .cfi_endproc 1124 1125; DARWIN-X64-LABEL: test8a: 1126; DARWIN-X64-NOT: callq ___stack_chk_fail 1127; DARWIN-X64: .cfi_endproc 1128 1129; MSVC-I386-LABEL: test8a: 1130; MSVC-I386-NOT: calll @__security_check_cookie@4 1131; MSVC-I386: retl 1132 1133; MINGW-X64-LABEL: test8a: 1134; MINGW-X64-NOT: callq __stack_chk_fail 1135; MINGW-X64: .seh_endproc 1136 1137 %b = alloca i32, align 4 1138 call void @funcall(ptr %b) 1139 ret void 1140} 1141 1142; test8b: Passing addr-of to function call 1143; ssp attribute 1144; Requires no protector. 1145; Function Attrs: ssp 1146define void @test8b() #0 { 1147entry: 1148; LINUX-I386-LABEL: test8b: 1149; LINUX-I386-NOT: calll __stack_chk_fail 1150; LINUX-I386: .cfi_endproc 1151 1152; LINUX-X64-LABEL: test8b: 1153; LINUX-X64-NOT: callq __stack_chk_fail 1154; LINUX-X64: .cfi_endproc 1155 1156; LINUX-KERNEL-X64-LABEL: test8b: 1157; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 1158; LINUX-KERNEL-X64: .cfi_endproc 1159 1160; DARWIN-X64-LABEL: test8b: 1161; DARWIN-X64-NOT: callq ___stack_chk_fail 1162; DARWIN-X64: .cfi_endproc 1163 1164; MSVC-I386-LABEL: test8b: 1165; MSVC-I386-NOT: calll @__security_check_cookie@4 1166; MSVC-I386: retl 1167 1168; MINGW-X64-LABEL: test8b: 1169; MINGW-X64-NOT: callq __stack_chk_fail 1170; MINGW-X64: .seh_endproc 1171 1172 %b = alloca i32, align 4 1173 call void @funcall(ptr %b) 1174 ret void 1175} 1176 1177; test8c: Passing addr-of to function call 1178; sspstrong attribute 1179; Requires protector. 1180; Function Attrs: sspstrong 1181define void @test8c() #1 { 1182entry: 1183; LINUX-I386-LABEL: test8c: 1184; LINUX-I386: mov{{l|q}} %gs: 1185; LINUX-I386: calll __stack_chk_fail 1186 1187; LINUX-X64-LABEL: test8c: 1188; LINUX-X64: mov{{l|q}} %fs: 1189; LINUX-X64: callq __stack_chk_fail 1190 1191; LINUX-KERNEL-X64-LABEL: test8c: 1192; LINUX-KERNEL-X64: mov{{l|q}} %gs: 1193; LINUX-KERNEL-X64: callq __stack_chk_fail 1194 1195; DARWIN-X64-LABEL: test8c: 1196; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 1197; DARWIN-X64: callq ___stack_chk_fail 1198 1199; MSVC-I386-LABEL: test8c: 1200; MSVC-I386: movl ___security_cookie, 1201; MSVC-I386: calll @__security_check_cookie@4 1202 1203; MINGW-X64-LABEL: test8c: 1204; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 1205; MINGW-X64: callq __stack_chk_fail 1206 1207 %b = alloca i32, align 4 1208 call void @funcall(ptr %b) 1209 ret void 1210} 1211 1212; test8d: Passing addr-of to function call 1213; sspreq attribute 1214; Requires protector. 1215; Function Attrs: sspreq 1216define void @test8d() #2 { 1217entry: 1218; LINUX-I386-LABEL: test8d: 1219; LINUX-I386: mov{{l|q}} %gs: 1220; LINUX-I386: calll __stack_chk_fail 1221 1222; LINUX-X64-LABEL: test8d: 1223; LINUX-X64: mov{{l|q}} %fs: 1224; LINUX-X64: callq __stack_chk_fail 1225 1226; LINUX-KERNEL-X64-LABEL: test8d: 1227; LINUX-KERNEL-X64: mov{{l|q}} %gs: 1228; LINUX-KERNEL-X64: callq __stack_chk_fail 1229 1230; DARWIN-X64-LABEL: test8d: 1231; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 1232; DARWIN-X64: callq ___stack_chk_fail 1233 1234; MSVC-I386-LABEL: test8d: 1235; MSVC-I386: movl ___security_cookie, 1236; MSVC-I386: calll @__security_check_cookie@4 1237 1238; MINGW-X64-LABEL: test8d: 1239; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 1240; MINGW-X64: callq __stack_chk_fail 1241 1242 %b = alloca i32, align 4 1243 call void @funcall(ptr %b) 1244 ret void 1245} 1246 1247; test9a: Addr-of in select instruction 1248; no ssp attribute 1249; Requires no protector. 1250define void @test9a() { 1251entry: 1252; LINUX-I386-LABEL: test9a: 1253; LINUX-I386-NOT: calll __stack_chk_fail 1254; LINUX-I386: .cfi_endproc 1255 1256; LINUX-X64-LABEL: test9a: 1257; LINUX-X64-NOT: callq __stack_chk_fail 1258; LINUX-X64: .cfi_endproc 1259 1260; LINUX-KERNEL-X64-LABEL: test9a: 1261; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 1262; LINUX-KERNEL-X64: .cfi_endproc 1263 1264; DARWIN-X64-LABEL: test9a: 1265; DARWIN-X64-NOT: callq ___stack_chk_fail 1266; DARWIN-X64: .cfi_endproc 1267 1268; MSVC-I386-LABEL: test9a: 1269; MSVC-I386-NOT: calll @__security_check_cookie@4 1270; MSVC-I386: retl 1271 %x = alloca double, align 8 1272 %call = call double @testi_aux() 1273 store double %call, ptr %x, align 8 1274 %cmp2 = fcmp ogt double %call, 0.000000e+00 1275 %y.1 = select i1 %cmp2, ptr %x, ptr null 1276 %call2 = call i32 (ptr, ...) @printf(ptr @.str, ptr %y.1) 1277 ret void 1278} 1279 1280; test9b: Addr-of in select instruction 1281; ssp attribute 1282; Requires no protector. 1283; Function Attrs: ssp 1284define void @test9b() #0 { 1285entry: 1286; LINUX-I386-LABEL: test9b: 1287; LINUX-I386-NOT: calll __stack_chk_fail 1288; LINUX-I386: .cfi_endproc 1289 1290; LINUX-X64-LABEL: test9b: 1291; LINUX-X64-NOT: callq __stack_chk_fail 1292; LINUX-X64: .cfi_endproc 1293 1294; LINUX-KERNEL-X64-LABEL: test9b: 1295; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 1296; LINUX-KERNEL-X64: .cfi_endproc 1297 1298; DARWIN-X64-LABEL: test9b: 1299; DARWIN-X64-NOT: callq ___stack_chk_fail 1300; DARWIN-X64: .cfi_endproc 1301 1302; MSVC-I386-LABEL: test9b: 1303; MSVC-I386-NOT: calll @__security_check_cookie@4 1304; MSVC-I386: retl 1305 %x = alloca double, align 8 1306 %call = call double @testi_aux() 1307 store double %call, ptr %x, align 8 1308 %cmp2 = fcmp ogt double %call, 0.000000e+00 1309 %y.1 = select i1 %cmp2, ptr %x, ptr null 1310 %call2 = call i32 (ptr, ...) @printf(ptr @.str, ptr %y.1) 1311 ret void 1312} 1313 1314; test9c: Addr-of in select instruction 1315; sspstrong attribute 1316; Requires protector. 1317; Function Attrs: sspstrong 1318define void @test9c() #1 { 1319entry: 1320; LINUX-I386-LABEL: test9c: 1321; LINUX-I386: mov{{l|q}} %gs: 1322; LINUX-I386: calll __stack_chk_fail 1323 1324; LINUX-X64-LABEL: test9c: 1325; LINUX-X64: mov{{l|q}} %fs: 1326; LINUX-X64: callq __stack_chk_fail 1327 1328; LINUX-KERNEL-X64-LABEL: test9c: 1329; LINUX-KERNEL-X64: mov{{l|q}} %gs: 1330; LINUX-KERNEL-X64: callq __stack_chk_fail 1331 1332; DARWIN-X64-LABEL: test9c: 1333; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 1334; DARWIN-X64: callq ___stack_chk_fail 1335 1336; MSVC-I386-LABEL: test9c: 1337; MSVC-I386: movl ___security_cookie, 1338; MSVC-I386: calll @__security_check_cookie@4 1339 %x = alloca double, align 8 1340 %call = call double @testi_aux() 1341 store double %call, ptr %x, align 8 1342 %cmp2 = fcmp ogt double %call, 0.000000e+00 1343 %y.1 = select i1 %cmp2, ptr %x, ptr null 1344 %call2 = call i32 (ptr, ...) @printf(ptr @.str, ptr %y.1) 1345 ret void 1346} 1347 1348; test9d: Addr-of in select instruction 1349; sspreq attribute 1350; Requires protector. 1351; Function Attrs: sspreq 1352define void @test9d() #2 { 1353entry: 1354; LINUX-I386-LABEL: test9d: 1355; LINUX-I386: mov{{l|q}} %gs: 1356; LINUX-I386: calll __stack_chk_fail 1357 1358; LINUX-X64-LABEL: test9d: 1359; LINUX-X64: mov{{l|q}} %fs: 1360; LINUX-X64: callq __stack_chk_fail 1361 1362; LINUX-KERNEL-X64-LABEL: test9d: 1363; LINUX-KERNEL-X64: mov{{l|q}} %gs: 1364; LINUX-KERNEL-X64: callq __stack_chk_fail 1365 1366; DARWIN-X64-LABEL: test9d: 1367; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 1368; DARWIN-X64: callq ___stack_chk_fail 1369 1370; MSVC-I386-LABEL: test9d: 1371; MSVC-I386: movl ___security_cookie, 1372; MSVC-I386: calll @__security_check_cookie@4 1373 %x = alloca double, align 8 1374 %call = call double @testi_aux() 1375 store double %call, ptr %x, align 8 1376 %cmp2 = fcmp ogt double %call, 0.000000e+00 1377 %y.1 = select i1 %cmp2, ptr %x, ptr null 1378 %call2 = call i32 (ptr, ...) @printf(ptr @.str, ptr %y.1) 1379 ret void 1380} 1381 1382; test10a: Addr-of in phi instruction 1383; no ssp attribute 1384; Requires no protector. 1385define void @test10a() { 1386entry: 1387; LINUX-I386-LABEL: test10a: 1388; LINUX-I386-NOT: calll __stack_chk_fail 1389; LINUX-I386: .cfi_endproc 1390 1391; LINUX-X64-LABEL: test10a: 1392; LINUX-X64-NOT: callq __stack_chk_fail 1393; LINUX-X64: .cfi_endproc 1394 1395; LINUX-KERNEL-X64-LABEL: test10a: 1396; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 1397; LINUX-KERNEL-X64: .cfi_endproc 1398 1399; DARWIN-X64-LABEL: test10a: 1400; DARWIN-X64-NOT: callq ___stack_chk_fail 1401; DARWIN-X64: .cfi_endproc 1402 1403; MSVC-I386-LABEL: test10a: 1404; MSVC-I386-NOT: calll @__security_check_cookie@4 1405; MSVC-I386: retl 1406 %x = alloca double, align 8 1407 %call = call double @testi_aux() 1408 store double %call, ptr %x, align 8 1409 %cmp = fcmp ogt double %call, 3.140000e+00 1410 br i1 %cmp, label %if.then, label %if.else 1411 1412if.then: ; preds = %entry 1413 %call1 = call double @testi_aux() 1414 store double %call1, ptr %x, align 8 1415 br label %if.end4 1416 1417if.else: ; preds = %entry 1418 %cmp2 = fcmp ogt double %call, 1.000000e+00 1419 br i1 %cmp2, label %if.then3, label %if.end4 1420 1421if.then3: ; preds = %if.else 1422 br label %if.end4 1423 1424if.end4: ; preds = %if.else, %if.then3, %if.then 1425 %y.0 = phi ptr [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ] 1426 %call5 = call i32 (ptr, ...) @printf(ptr @.str, ptr %y.0) 1427 ret void 1428} 1429 1430; test10b: Addr-of in phi instruction 1431; ssp attribute 1432; Requires no protector. 1433; Function Attrs: ssp 1434define void @test10b() #0 { 1435entry: 1436; LINUX-I386-LABEL: test10b: 1437; LINUX-I386-NOT: calll __stack_chk_fail 1438; LINUX-I386: .cfi_endproc 1439 1440; LINUX-X64-LABEL: test10b: 1441; LINUX-X64-NOT: callq __stack_chk_fail 1442; LINUX-X64: .cfi_endproc 1443 1444; LINUX-KERNEL-X64-LABEL: test10b: 1445; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 1446; LINUX-KERNEL-X64: .cfi_endproc 1447 1448; DARWIN-X64-LABEL: test10b: 1449; DARWIN-X64-NOT: callq ___stack_chk_fail 1450; DARWIN-X64: .cfi_endproc 1451 1452; MSVC-I386-LABEL: test10b: 1453; MSVC-I386-NOT: calll @__security_check_cookie@4 1454; MSVC-I386: retl 1455 %x = alloca double, align 8 1456 %call = call double @testi_aux() 1457 store double %call, ptr %x, align 8 1458 %cmp = fcmp ogt double %call, 3.140000e+00 1459 br i1 %cmp, label %if.then, label %if.else 1460 1461if.then: ; preds = %entry 1462 %call1 = call double @testi_aux() 1463 store double %call1, ptr %x, align 8 1464 br label %if.end4 1465 1466if.else: ; preds = %entry 1467 %cmp2 = fcmp ogt double %call, 1.000000e+00 1468 br i1 %cmp2, label %if.then3, label %if.end4 1469 1470if.then3: ; preds = %if.else 1471 br label %if.end4 1472 1473if.end4: ; preds = %if.else, %if.then3, %if.then 1474 %y.0 = phi ptr [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ] 1475 %call5 = call i32 (ptr, ...) @printf(ptr @.str, ptr %y.0) 1476 ret void 1477} 1478 1479; test10c: Addr-of in phi instruction 1480; sspstrong attribute 1481; Requires protector. 1482; Function Attrs: sspstrong 1483define void @test10c() #1 { 1484entry: 1485; LINUX-I386-LABEL: test10c: 1486; LINUX-I386: mov{{l|q}} %gs: 1487; LINUX-I386: calll __stack_chk_fail 1488 1489; LINUX-X64-LABEL: test10c: 1490; LINUX-X64: mov{{l|q}} %fs: 1491; LINUX-X64: callq __stack_chk_fail 1492 1493; LINUX-KERNEL-X64-LABEL: test10c: 1494; LINUX-KERNEL-X64: mov{{l|q}} %gs: 1495; LINUX-KERNEL-X64: callq __stack_chk_fail 1496 1497; DARWIN-X64-LABEL: test10c: 1498; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 1499; DARWIN-X64: callq ___stack_chk_fail 1500 1501; MSVC-I386-LABEL: test10c: 1502; MSVC-I386: movl ___security_cookie, 1503; MSVC-I386: calll @__security_check_cookie@4 1504 %x = alloca double, align 8 1505 %call = call double @testi_aux() 1506 store double %call, ptr %x, align 8 1507 %cmp = fcmp ogt double %call, 3.140000e+00 1508 br i1 %cmp, label %if.then, label %if.else 1509 1510if.then: ; preds = %entry 1511 %call1 = call double @testi_aux() 1512 store double %call1, ptr %x, align 8 1513 br label %if.end4 1514 1515if.else: ; preds = %entry 1516 %cmp2 = fcmp ogt double %call, 1.000000e+00 1517 br i1 %cmp2, label %if.then3, label %if.end4 1518 1519if.then3: ; preds = %if.else 1520 br label %if.end4 1521 1522if.end4: ; preds = %if.else, %if.then3, %if.then 1523 %y.0 = phi ptr [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ] 1524 %call5 = call i32 (ptr, ...) @printf(ptr @.str, ptr %y.0) 1525 ret void 1526} 1527 1528; test10d: Addr-of in phi instruction 1529; sspreq attribute 1530; Requires protector. 1531; Function Attrs: sspreq 1532define void @test10d() #2 { 1533entry: 1534; LINUX-I386-LABEL: test10d: 1535; LINUX-I386: mov{{l|q}} %gs: 1536; LINUX-I386: calll __stack_chk_fail 1537 1538; LINUX-X64-LABEL: test10d: 1539; LINUX-X64: mov{{l|q}} %fs: 1540; LINUX-X64: callq __stack_chk_fail 1541 1542; LINUX-KERNEL-X64-LABEL: test10d: 1543; LINUX-KERNEL-X64: mov{{l|q}} %gs: 1544; LINUX-KERNEL-X64: callq __stack_chk_fail 1545 1546; DARWIN-X64-LABEL: test10d: 1547; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 1548; DARWIN-X64: callq ___stack_chk_fail 1549 1550; MSVC-I386-LABEL: test10d: 1551; MSVC-I386: movl ___security_cookie, 1552; MSVC-I386: calll @__security_check_cookie@4 1553 %x = alloca double, align 8 1554 %call = call double @testi_aux() 1555 store double %call, ptr %x, align 8 1556 %cmp = fcmp ogt double %call, 3.140000e+00 1557 br i1 %cmp, label %if.then, label %if.else 1558 1559if.then: ; preds = %entry 1560 %call1 = call double @testi_aux() 1561 store double %call1, ptr %x, align 8 1562 br label %if.end4 1563 1564if.else: ; preds = %entry 1565 %cmp2 = fcmp ogt double %call, 1.000000e+00 1566 br i1 %cmp2, label %if.then3, label %if.end4 1567 1568if.then3: ; preds = %if.else 1569 br label %if.end4 1570 1571if.end4: ; preds = %if.else, %if.then3, %if.then 1572 %y.0 = phi ptr [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ] 1573 %call5 = call i32 (ptr, ...) @printf(ptr @.str, ptr %y.0) 1574 ret void 1575} 1576 1577; test11a: Addr-of struct element. (GEP followed by store). 1578; no ssp attribute 1579; Requires no protector. 1580define void @test11a() { 1581entry: 1582; LINUX-I386-LABEL: test11a: 1583; LINUX-I386-NOT: calll __stack_chk_fail 1584; LINUX-I386: .cfi_endproc 1585 1586; LINUX-X64-LABEL: test11a: 1587; LINUX-X64-NOT: callq __stack_chk_fail 1588; LINUX-X64: .cfi_endproc 1589 1590; LINUX-KERNEL-X64-LABEL: test11a: 1591; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 1592; LINUX-KERNEL-X64: .cfi_endproc 1593 1594; DARWIN-X64-LABEL: test11a: 1595; DARWIN-X64-NOT: callq ___stack_chk_fail 1596; DARWIN-X64: .cfi_endproc 1597 1598; MSVC-I386-LABEL: test11a: 1599; MSVC-I386-NOT: calll @__security_check_cookie@4 1600; MSVC-I386: retl 1601 %c = alloca %struct.pair, align 4 1602 %b = alloca ptr, align 8 1603 %y = getelementptr inbounds %struct.pair, ptr %c, i32 0, i32 1 1604 store ptr %y, ptr %b, align 8 1605 %0 = load ptr, ptr %b, align 8 1606 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %0) 1607 ret void 1608} 1609 1610; test11b: Addr-of struct element. (GEP followed by store). 1611; ssp attribute 1612; Requires no protector. 1613; Function Attrs: ssp 1614define void @test11b() #0 { 1615entry: 1616; LINUX-I386-LABEL: test11b: 1617; LINUX-I386-NOT: calll __stack_chk_fail 1618; LINUX-I386: .cfi_endproc 1619 1620; LINUX-X64-LABEL: test11b: 1621; LINUX-X64-NOT: callq __stack_chk_fail 1622; LINUX-X64: .cfi_endproc 1623 1624; LINUX-KERNEL-X64-LABEL: test11b: 1625; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 1626; LINUX-KERNEL-X64: .cfi_endproc 1627 1628; DARWIN-X64-LABEL: test11b: 1629; DARWIN-X64-NOT: callq ___stack_chk_fail 1630; DARWIN-X64: .cfi_endproc 1631 1632; MSVC-I386-LABEL: test11b: 1633; MSVC-I386-NOT: calll @__security_check_cookie@4 1634; MSVC-I386: retl 1635 %c = alloca %struct.pair, align 4 1636 %b = alloca ptr, align 8 1637 %y = getelementptr inbounds %struct.pair, ptr %c, i32 0, i32 1 1638 store ptr %y, ptr %b, align 8 1639 %0 = load ptr, ptr %b, align 8 1640 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %0) 1641 ret void 1642} 1643 1644; test11c: Addr-of struct element. (GEP followed by store). 1645; sspstrong attribute 1646; Requires protector. 1647; Function Attrs: sspstrong 1648define void @test11c() #1 { 1649entry: 1650; LINUX-I386-LABEL: test11c: 1651; LINUX-I386: mov{{l|q}} %gs: 1652; LINUX-I386: calll __stack_chk_fail 1653 1654; LINUX-X64-LABEL: test11c: 1655; LINUX-X64: mov{{l|q}} %fs: 1656; LINUX-X64: callq __stack_chk_fail 1657 1658; LINUX-KERNEL-X64-LABEL: test11c: 1659; LINUX-KERNEL-X64: mov{{l|q}} %gs: 1660; LINUX-KERNEL-X64: callq __stack_chk_fail 1661 1662; DARWIN-X64-LABEL: test11c: 1663; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 1664; DARWIN-X64: callq ___stack_chk_fail 1665 1666; MSVC-I386-LABEL: test11c: 1667; MSVC-I386: movl ___security_cookie, 1668; MSVC-I386: calll @__security_check_cookie@4 1669 %c = alloca %struct.pair, align 4 1670 %b = alloca ptr, align 8 1671 %y = getelementptr inbounds %struct.pair, ptr %c, i32 0, i32 1 1672 store ptr %y, ptr %b, align 8 1673 %0 = load ptr, ptr %b, align 8 1674 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %0) 1675 ret void 1676} 1677 1678; test11d: Addr-of struct element. (GEP followed by store). 1679; sspreq attribute 1680; Requires protector. 1681; Function Attrs: sspreq 1682define void @test11d() #2 { 1683entry: 1684; LINUX-I386-LABEL: test11d: 1685; LINUX-I386: mov{{l|q}} %gs: 1686; LINUX-I386: calll __stack_chk_fail 1687 1688; LINUX-X64-LABEL: test11d: 1689; LINUX-X64: mov{{l|q}} %fs: 1690; LINUX-X64: callq __stack_chk_fail 1691 1692; LINUX-KERNEL-X64-LABEL: test11d: 1693; LINUX-KERNEL-X64: mov{{l|q}} %gs: 1694; LINUX-KERNEL-X64: callq __stack_chk_fail 1695 1696; DARWIN-X64-LABEL: test11d: 1697; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 1698; DARWIN-X64: callq ___stack_chk_fail 1699 1700; MSVC-I386-LABEL: test11d: 1701; MSVC-I386: movl ___security_cookie, 1702; MSVC-I386: calll @__security_check_cookie@4 1703 %c = alloca %struct.pair, align 4 1704 %b = alloca ptr, align 8 1705 %y = getelementptr inbounds %struct.pair, ptr %c, i32 0, i32 1 1706 store ptr %y, ptr %b, align 8 1707 %0 = load ptr, ptr %b, align 8 1708 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %0) 1709 ret void 1710} 1711 1712; test12a: Addr-of struct element, GEP followed by ptrtoint. 1713; no ssp attribute 1714; Requires no protector. 1715define void @test12a() { 1716entry: 1717; LINUX-I386-LABEL: test12a: 1718; LINUX-I386-NOT: calll __stack_chk_fail 1719; LINUX-I386: .cfi_endproc 1720 1721; LINUX-X64-LABEL: test12a: 1722; LINUX-X64-NOT: callq __stack_chk_fail 1723; LINUX-X64: .cfi_endproc 1724 1725; LINUX-KERNEL-X64-LABEL: test12a: 1726; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 1727; LINUX-KERNEL-X64: .cfi_endproc 1728 1729; DARWIN-X64-LABEL: test12a: 1730; DARWIN-X64-NOT: callq ___stack_chk_fail 1731; DARWIN-X64: .cfi_endproc 1732 1733; MSVC-I386-LABEL: test12a: 1734; MSVC-I386-NOT: calll @__security_check_cookie@4 1735; MSVC-I386: retl 1736 %c = alloca %struct.pair, align 4 1737 %b = alloca ptr, align 8 1738 %y = getelementptr inbounds %struct.pair, ptr %c, i32 0, i32 1 1739 %0 = ptrtoint ptr %y to i64 1740 %call = call i32 (ptr, ...) @printf(ptr @.str, i64 %0) 1741 ret void 1742} 1743 1744; test12b: Addr-of struct element, GEP followed by ptrtoint. 1745; ssp attribute 1746; Requires no protector. 1747; Function Attrs: ssp 1748define void @test12b() #0 { 1749entry: 1750; LINUX-I386-LABEL: test12b: 1751; LINUX-I386-NOT: calll __stack_chk_fail 1752; LINUX-I386: .cfi_endproc 1753 1754; LINUX-X64-LABEL: test12b: 1755; LINUX-X64-NOT: callq __stack_chk_fail 1756; LINUX-X64: .cfi_endproc 1757 1758; LINUX-KERNEL-X64-LABEL: test12b: 1759; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 1760; LINUX-KERNEL-X64: .cfi_endproc 1761 1762; DARWIN-X64-LABEL: test12b: 1763; DARWIN-X64-NOT: callq ___stack_chk_fail 1764; DARWIN-X64: .cfi_endproc 1765 1766; MSVC-I386-LABEL: test12b: 1767; MSVC-I386-NOT: calll @__security_check_cookie@4 1768; MSVC-I386: retl 1769 %c = alloca %struct.pair, align 4 1770 %b = alloca ptr, align 8 1771 %y = getelementptr inbounds %struct.pair, ptr %c, i32 0, i32 1 1772 %0 = ptrtoint ptr %y to i64 1773 %call = call i32 (ptr, ...) @printf(ptr @.str, i64 %0) 1774 ret void 1775} 1776 1777; test12c: Addr-of struct element, GEP followed by ptrtoint. 1778; sspstrong attribute 1779; Function Attrs: sspstrong 1780define void @test12c() #1 { 1781entry: 1782; LINUX-I386-LABEL: test12c: 1783; LINUX-I386: mov{{l|q}} %gs: 1784; LINUX-I386: calll __stack_chk_fail 1785 1786; LINUX-X64-LABEL: test12c: 1787; LINUX-X64: mov{{l|q}} %fs: 1788; LINUX-X64: callq __stack_chk_fail 1789 1790; LINUX-KERNEL-X64-LABEL: test12c: 1791; LINUX-KERNEL-X64: mov{{l|q}} %gs: 1792; LINUX-KERNEL-X64: callq __stack_chk_fail 1793 1794; DARWIN-X64-LABEL: test12c: 1795; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 1796; DARWIN-X64: callq ___stack_chk_fail 1797 1798; MSVC-I386-LABEL: test12c: 1799; MSVC-I386: movl ___security_cookie, 1800; MSVC-I386: calll @__security_check_cookie@4 1801 %c = alloca %struct.pair, align 4 1802 %b = alloca ptr, align 8 1803 %y = getelementptr inbounds %struct.pair, ptr %c, i32 0, i32 1 1804 %0 = ptrtoint ptr %y to i64 1805 %call = call i32 (ptr, ...) @printf(ptr @.str, i64 %0) 1806 ret void 1807} 1808 1809; test12d: Addr-of struct element, GEP followed by ptrtoint. 1810; sspreq attribute 1811; Requires protector. 1812; Function Attrs: sspreq 1813define void @test12d() #2 { 1814entry: 1815; LINUX-I386-LABEL: test12d: 1816; LINUX-I386: mov{{l|q}} %gs: 1817; LINUX-I386: calll __stack_chk_fail 1818 1819; LINUX-X64-LABEL: test12d: 1820; LINUX-X64: mov{{l|q}} %fs: 1821; LINUX-X64: callq __stack_chk_fail 1822 1823; LINUX-KERNEL-X64-LABEL: test12d: 1824; LINUX-KERNEL-X64: mov{{l|q}} %gs: 1825; LINUX-KERNEL-X64: callq __stack_chk_fail 1826 1827; DARWIN-X64-LABEL: test12d: 1828; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 1829; DARWIN-X64: callq ___stack_chk_fail 1830 1831; MSVC-I386-LABEL: test12d: 1832; MSVC-I386: movl ___security_cookie, 1833; MSVC-I386: calll @__security_check_cookie@4 1834 %c = alloca %struct.pair, align 4 1835 %b = alloca ptr, align 8 1836 %y = getelementptr inbounds %struct.pair, ptr %c, i32 0, i32 1 1837 %0 = ptrtoint ptr %y to i64 1838 %call = call i32 (ptr, ...) @printf(ptr @.str, i64 %0) 1839 ret void 1840} 1841 1842; test13a: Addr-of struct element, GEP followed by callinst. 1843; no ssp attribute 1844; Requires no protector. 1845define void @test13a() { 1846entry: 1847; LINUX-I386-LABEL: test13a: 1848; LINUX-I386-NOT: calll __stack_chk_fail 1849; LINUX-I386: .cfi_endproc 1850 1851; LINUX-X64-LABEL: test13a: 1852; LINUX-X64-NOT: callq __stack_chk_fail 1853; LINUX-X64: .cfi_endproc 1854 1855; LINUX-KERNEL-X64-LABEL: test13a: 1856; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 1857; LINUX-KERNEL-X64: .cfi_endproc 1858 1859; DARWIN-X64-LABEL: test13a: 1860; DARWIN-X64-NOT: callq ___stack_chk_fail 1861; DARWIN-X64: .cfi_endproc 1862 1863; MSVC-I386-LABEL: test13a: 1864; MSVC-I386-NOT: calll @__security_check_cookie@4 1865; MSVC-I386: retl 1866 %c = alloca %struct.pair, align 4 1867 %y = getelementptr inbounds %struct.pair, ptr %c, i64 0, i32 1 1868 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %y) 1869 ret void 1870} 1871 1872; test13b: Addr-of struct element, GEP followed by callinst. 1873; ssp attribute 1874; Requires no protector. 1875; Function Attrs: ssp 1876define void @test13b() #0 { 1877entry: 1878; LINUX-I386-LABEL: test13b: 1879; LINUX-I386-NOT: calll __stack_chk_fail 1880; LINUX-I386: .cfi_endproc 1881 1882; LINUX-X64-LABEL: test13b: 1883; LINUX-X64-NOT: callq __stack_chk_fail 1884; LINUX-X64: .cfi_endproc 1885 1886; LINUX-KERNEL-X64-LABEL: test13b: 1887; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 1888; LINUX-KERNEL-X64: .cfi_endproc 1889 1890; DARWIN-X64-LABEL: test13b: 1891; DARWIN-X64-NOT: callq ___stack_chk_fail 1892; DARWIN-X64: .cfi_endproc 1893 1894; MSVC-I386-LABEL: test13b: 1895; MSVC-I386-NOT: calll @__security_check_cookie@4 1896; MSVC-I386: retl 1897 %c = alloca %struct.pair, align 4 1898 %y = getelementptr inbounds %struct.pair, ptr %c, i64 0, i32 1 1899 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %y) 1900 ret void 1901} 1902 1903; test13c: Addr-of struct element, GEP followed by callinst. 1904; sspstrong attribute 1905; Requires protector. 1906; Function Attrs: sspstrong 1907define void @test13c() #1 { 1908entry: 1909; LINUX-I386-LABEL: test13c: 1910; LINUX-I386: mov{{l|q}} %gs: 1911; LINUX-I386: calll __stack_chk_fail 1912 1913; LINUX-X64-LABEL: test13c: 1914; LINUX-X64: mov{{l|q}} %fs: 1915; LINUX-X64: callq __stack_chk_fail 1916 1917; LINUX-KERNEL-X64-LABEL: test13c: 1918; LINUX-KERNEL-X64: mov{{l|q}} %gs: 1919; LINUX-KERNEL-X64: callq __stack_chk_fail 1920 1921; DARWIN-X64-LABEL: test13c: 1922; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 1923; DARWIN-X64: callq ___stack_chk_fail 1924 1925; MSVC-I386-LABEL: test13c: 1926; MSVC-I386: movl ___security_cookie, 1927; MSVC-I386: calll @__security_check_cookie@4 1928 %c = alloca %struct.pair, align 4 1929 %y = getelementptr inbounds %struct.pair, ptr %c, i64 0, i32 1 1930 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %y) 1931 ret void 1932} 1933 1934; test13d: Addr-of struct element, GEP followed by callinst. 1935; sspreq attribute 1936; Requires protector. 1937; Function Attrs: sspreq 1938define void @test13d() #2 { 1939entry: 1940; LINUX-I386-LABEL: test13d: 1941; LINUX-I386: mov{{l|q}} %gs: 1942; LINUX-I386: calll __stack_chk_fail 1943 1944; LINUX-X64-LABEL: test13d: 1945; LINUX-X64: mov{{l|q}} %fs: 1946; LINUX-X64: callq __stack_chk_fail 1947 1948; LINUX-KERNEL-X64-LABEL: test13d: 1949; LINUX-KERNEL-X64: mov{{l|q}} %gs: 1950; LINUX-KERNEL-X64: callq __stack_chk_fail 1951 1952; DARWIN-X64-LABEL: test13d: 1953; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 1954; DARWIN-X64: callq ___stack_chk_fail 1955 1956; MSVC-I386-LABEL: test13d: 1957; MSVC-I386: movl ___security_cookie, 1958; MSVC-I386: calll @__security_check_cookie@4 1959 %c = alloca %struct.pair, align 4 1960 %y = getelementptr inbounds %struct.pair, ptr %c, i64 0, i32 1 1961 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %y) 1962 ret void 1963} 1964 1965; test14a: Addr-of a local, optimized into a GEP (e.g., &a - 12) 1966; no ssp attribute 1967; Requires no protector. 1968define void @test14a() { 1969entry: 1970; LINUX-I386-LABEL: test14a: 1971; LINUX-I386-NOT: calll __stack_chk_fail 1972; LINUX-I386: .cfi_endproc 1973 1974; LINUX-X64-LABEL: test14a: 1975; LINUX-X64-NOT: callq __stack_chk_fail 1976; LINUX-X64: .cfi_endproc 1977 1978; LINUX-KERNEL-X64-LABEL: test14a: 1979; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 1980; LINUX-KERNEL-X64: .cfi_endproc 1981 1982; DARWIN-X64-LABEL: test14a: 1983; DARWIN-X64-NOT: callq ___stack_chk_fail 1984; DARWIN-X64: .cfi_endproc 1985 1986; MSVC-I386-LABEL: test14a: 1987; MSVC-I386-NOT: calll @__security_check_cookie@4 1988; MSVC-I386: retl 1989 %a = alloca i32, align 4 1990 %add.ptr5 = getelementptr inbounds i32, ptr %a, i64 -12 1991 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %add.ptr5) 1992 ret void 1993} 1994 1995; test14b: Addr-of a local, optimized into a GEP (e.g., &a - 12) 1996; ssp attribute 1997; Requires no protector. 1998; Function Attrs: ssp 1999define void @test14b() #0 { 2000entry: 2001; LINUX-I386-LABEL: test14b: 2002; LINUX-I386-NOT: calll __stack_chk_fail 2003; LINUX-I386: .cfi_endproc 2004 2005; LINUX-X64-LABEL: test14b: 2006; LINUX-X64-NOT: callq __stack_chk_fail 2007; LINUX-X64: .cfi_endproc 2008 2009; LINUX-KERNEL-X64-LABEL: test14b: 2010; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 2011; LINUX-KERNEL-X64: .cfi_endproc 2012 2013; DARWIN-X64-LABEL: test14b: 2014; DARWIN-X64-NOT: callq ___stack_chk_fail 2015; DARWIN-X64: .cfi_endproc 2016 2017; MSVC-I386-LABEL: test14b: 2018; MSVC-I386-NOT: calll @__security_check_cookie@4 2019; MSVC-I386: retl 2020 %a = alloca i32, align 4 2021 %add.ptr5 = getelementptr inbounds i32, ptr %a, i64 -12 2022 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %add.ptr5) 2023 ret void 2024} 2025 2026; test14c: Addr-of a local, optimized into a GEP (e.g., &a - 12) 2027; sspstrong attribute 2028; Requires protector. 2029; Function Attrs: sspstrong 2030define void @test14c() #1 { 2031entry: 2032; LINUX-I386-LABEL: test14c: 2033; LINUX-I386: mov{{l|q}} %gs: 2034; LINUX-I386: calll __stack_chk_fail 2035 2036; LINUX-X64-LABEL: test14c: 2037; LINUX-X64: mov{{l|q}} %fs: 2038; LINUX-X64: callq __stack_chk_fail 2039 2040; LINUX-KERNEL-X64-LABEL: test14c: 2041; LINUX-KERNEL-X64: mov{{l|q}} %gs: 2042; LINUX-KERNEL-X64: callq __stack_chk_fail 2043 2044; DARWIN-X64-LABEL: test14c: 2045; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 2046; DARWIN-X64: callq ___stack_chk_fail 2047 2048; MSVC-I386-LABEL: test14c: 2049; MSVC-I386: movl ___security_cookie, 2050; MSVC-I386: calll @__security_check_cookie@4 2051 %a = alloca i32, align 4 2052 %add.ptr5 = getelementptr inbounds i32, ptr %a, i64 -12 2053 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %add.ptr5) 2054 ret void 2055} 2056 2057; test14d: Addr-of a local, optimized into a GEP (e.g., &a - 12) 2058; sspreq attribute 2059; Requires protector. 2060; Function Attrs: sspreq 2061define void @test14d() #2 { 2062entry: 2063; LINUX-I386-LABEL: test14d: 2064; LINUX-I386: mov{{l|q}} %gs: 2065; LINUX-I386: calll __stack_chk_fail 2066 2067; LINUX-X64-LABEL: test14d: 2068; LINUX-X64: mov{{l|q}} %fs: 2069; LINUX-X64: callq __stack_chk_fail 2070 2071; LINUX-KERNEL-X64-LABEL: test14d: 2072; LINUX-KERNEL-X64: mov{{l|q}} %gs: 2073; LINUX-KERNEL-X64: callq __stack_chk_fail 2074 2075; DARWIN-X64-LABEL: test14d: 2076; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 2077; DARWIN-X64: callq ___stack_chk_fail 2078 2079; MSVC-I386-LABEL: test14d: 2080; MSVC-I386: movl ___security_cookie, 2081; MSVC-I386: calll @__security_check_cookie@4 2082 %a = alloca i32, align 4 2083 %add.ptr5 = getelementptr inbounds i32, ptr %a, i64 -12 2084 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %add.ptr5) 2085 ret void 2086} 2087 2088; test15a: Addr-of a local cast to a ptr of a different type 2089; (e.g., int a; ... ; ptr b = &a;) 2090; no ssp attribute 2091; Requires no protector. 2092define void @test15a() { 2093entry: 2094; LINUX-I386-LABEL: test15a: 2095; LINUX-I386-NOT: calll __stack_chk_fail 2096; LINUX-I386: .cfi_endproc 2097 2098; LINUX-X64-LABEL: test15a: 2099; LINUX-X64-NOT: callq __stack_chk_fail 2100; LINUX-X64: .cfi_endproc 2101 2102; LINUX-KERNEL-X64-LABEL: test15a: 2103; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 2104; LINUX-KERNEL-X64: .cfi_endproc 2105 2106; DARWIN-X64-LABEL: test15a: 2107; DARWIN-X64-NOT: callq ___stack_chk_fail 2108; DARWIN-X64: .cfi_endproc 2109 2110; MSVC-I386-LABEL: test15a: 2111; MSVC-I386-NOT: calll @__security_check_cookie@4 2112; MSVC-I386: retl 2113 %a = alloca i32, align 4 2114 %b = alloca ptr, align 8 2115 store i32 0, ptr %a, align 4 2116 store ptr %a, ptr %b, align 8 2117 %0 = load ptr, ptr %b, align 8 2118 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %0) 2119 ret void 2120} 2121 2122; test15b: Addr-of a local cast to a ptr of a different type 2123; (e.g., int a; ... ; ptr b = &a;) 2124; ssp attribute 2125; Requires no protector. 2126; Function Attrs: ssp 2127define void @test15b() #0 { 2128entry: 2129; LINUX-I386-LABEL: test15b: 2130; LINUX-I386-NOT: calll __stack_chk_fail 2131; LINUX-I386: .cfi_endproc 2132 2133; LINUX-X64-LABEL: test15b: 2134; LINUX-X64-NOT: callq __stack_chk_fail 2135; LINUX-X64: .cfi_endproc 2136 2137; LINUX-KERNEL-X64-LABEL: test15b: 2138; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 2139; LINUX-KERNEL-X64: .cfi_endproc 2140 2141; DARWIN-X64-LABEL: test15b: 2142; DARWIN-X64-NOT: callq ___stack_chk_fail 2143; DARWIN-X64: .cfi_endproc 2144 2145; MSVC-I386-LABEL: test15b: 2146; MSVC-I386-NOT: calll @__security_check_cookie@4 2147; MSVC-I386: retl 2148 %a = alloca i32, align 4 2149 %b = alloca ptr, align 8 2150 store i32 0, ptr %a, align 4 2151 store ptr %a, ptr %b, align 8 2152 %0 = load ptr, ptr %b, align 8 2153 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %0) 2154 ret void 2155} 2156 2157; test15c: Addr-of a local cast to a ptr of a different type 2158; (e.g., int a; ... ; ptr b = &a;) 2159; sspstrong attribute 2160; Requires protector. 2161; Function Attrs: sspstrong 2162define void @test15c() #1 { 2163entry: 2164; LINUX-I386-LABEL: test15c: 2165; LINUX-I386: mov{{l|q}} %gs: 2166; LINUX-I386: calll __stack_chk_fail 2167 2168; LINUX-X64-LABEL: test15c: 2169; LINUX-X64: mov{{l|q}} %fs: 2170; LINUX-X64: callq __stack_chk_fail 2171 2172; LINUX-KERNEL-X64-LABEL: test15c: 2173; LINUX-KERNEL-X64: mov{{l|q}} %gs: 2174; LINUX-KERNEL-X64: callq __stack_chk_fail 2175 2176; DARWIN-X64-LABEL: test15c: 2177; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 2178; DARWIN-X64: callq ___stack_chk_fail 2179 2180; MSVC-I386-LABEL: test15c: 2181; MSVC-I386: movl ___security_cookie, 2182; MSVC-I386: calll @__security_check_cookie@4 2183 %a = alloca i32, align 4 2184 %b = alloca ptr, align 8 2185 store i32 0, ptr %a, align 4 2186 store ptr %a, ptr %b, align 8 2187 %0 = load ptr, ptr %b, align 8 2188 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %0) 2189 ret void 2190} 2191 2192; test15d: Addr-of a local cast to a ptr of a different type 2193; (e.g., int a; ... ; ptr b = &a;) 2194; sspreq attribute 2195; Requires protector. 2196; Function Attrs: sspreq 2197define void @test15d() #2 { 2198entry: 2199; LINUX-I386-LABEL: test15d: 2200; LINUX-I386: mov{{l|q}} %gs: 2201; LINUX-I386: calll __stack_chk_fail 2202 2203; LINUX-X64-LABEL: test15d: 2204; LINUX-X64: mov{{l|q}} %fs: 2205; LINUX-X64: callq __stack_chk_fail 2206 2207; LINUX-KERNEL-X64-LABEL: test15d: 2208; LINUX-KERNEL-X64: mov{{l|q}} %gs: 2209; LINUX-KERNEL-X64: callq __stack_chk_fail 2210 2211; DARWIN-X64-LABEL: test15d: 2212; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 2213; DARWIN-X64: callq ___stack_chk_fail 2214 2215; MSVC-I386-LABEL: test15d: 2216; MSVC-I386: movl ___security_cookie, 2217; MSVC-I386: calll @__security_check_cookie@4 2218 %a = alloca i32, align 4 2219 %b = alloca ptr, align 8 2220 store i32 0, ptr %a, align 4 2221 store ptr %a, ptr %b, align 8 2222 %0 = load ptr, ptr %b, align 8 2223 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %0) 2224 ret void 2225} 2226 2227; test16a: Addr-of a local cast to a ptr of a different type (optimized) 2228; (e.g., int a; ... ; ptr b = &a;) 2229; no ssp attribute 2230; Requires no protector. 2231define void @test16a() { 2232entry: 2233; LINUX-I386-LABEL: test16a: 2234; LINUX-I386-NOT: calll __stack_chk_fail 2235; LINUX-I386: .cfi_endproc 2236 2237; LINUX-X64-LABEL: test16a: 2238; LINUX-X64-NOT: callq __stack_chk_fail 2239; LINUX-X64: .cfi_endproc 2240 2241; LINUX-KERNEL-X64-LABEL: test16a: 2242; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 2243; LINUX-KERNEL-X64: .cfi_endproc 2244 2245; DARWIN-X64-LABEL: test16a: 2246; DARWIN-X64-NOT: callq ___stack_chk_fail 2247; DARWIN-X64: .cfi_endproc 2248 2249; MSVC-I386-LABEL: test16a: 2250; MSVC-I386-NOT: calll @__security_check_cookie@4 2251; MSVC-I386: retl 2252 %a = alloca i32, align 4 2253 store i32 0, ptr %a, align 4 2254 call void @funfloat(ptr %a) 2255 ret void 2256} 2257 2258; test16b: Addr-of a local cast to a ptr of a different type (optimized) 2259; (e.g., int a; ... ; ptr b = &a;) 2260; ssp attribute 2261; Requires no protector. 2262; Function Attrs: ssp 2263define void @test16b() #0 { 2264entry: 2265; LINUX-I386-LABEL: test16b: 2266; LINUX-I386-NOT: calll __stack_chk_fail 2267; LINUX-I386: .cfi_endproc 2268 2269; LINUX-X64-LABEL: test16b: 2270; LINUX-X64-NOT: callq __stack_chk_fail 2271; LINUX-X64: .cfi_endproc 2272 2273; LINUX-KERNEL-X64-LABEL: test16b: 2274; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 2275; LINUX-KERNEL-X64: .cfi_endproc 2276 2277; DARWIN-X64-LABEL: test16b: 2278; DARWIN-X64-NOT: callq ___stack_chk_fail 2279; DARWIN-X64: .cfi_endproc 2280 2281; MSVC-I386-LABEL: test16b: 2282; MSVC-I386-NOT: calll @__security_check_cookie@4 2283; MSVC-I386: retl 2284 %a = alloca i32, align 4 2285 store i32 0, ptr %a, align 4 2286 call void @funfloat(ptr %a) 2287 ret void 2288} 2289 2290; test16c: Addr-of a local cast to a ptr of a different type (optimized) 2291; (e.g., int a; ... ; ptr b = &a;) 2292; sspstrong attribute 2293; Requires protector. 2294; Function Attrs: sspstrong 2295define void @test16c() #1 { 2296entry: 2297; LINUX-I386-LABEL: test16c: 2298; LINUX-I386: mov{{l|q}} %gs: 2299; LINUX-I386: calll __stack_chk_fail 2300 2301; LINUX-X64-LABEL: test16c: 2302; LINUX-X64: mov{{l|q}} %fs: 2303; LINUX-X64: callq __stack_chk_fail 2304 2305; LINUX-KERNEL-X64-LABEL: test16c: 2306; LINUX-KERNEL-X64: mov{{l|q}} %gs: 2307; LINUX-KERNEL-X64: callq __stack_chk_fail 2308 2309; DARWIN-X64-LABEL: test16c: 2310; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 2311; DARWIN-X64: callq ___stack_chk_fail 2312 2313; MSVC-I386-LABEL: test16c: 2314; MSVC-I386: movl ___security_cookie, 2315; MSVC-I386: calll @__security_check_cookie@4 2316 %a = alloca i32, align 4 2317 store i32 0, ptr %a, align 4 2318 call void @funfloat(ptr %a) 2319 ret void 2320} 2321 2322; test16d: Addr-of a local cast to a ptr of a different type (optimized) 2323; (e.g., int a; ... ; ptr b = &a;) 2324; sspreq attribute 2325; Requires protector. 2326; Function Attrs: sspreq 2327define void @test16d() #2 { 2328entry: 2329; LINUX-I386-LABEL: test16d: 2330; LINUX-I386: mov{{l|q}} %gs: 2331; LINUX-I386: calll __stack_chk_fail 2332 2333; LINUX-X64-LABEL: test16d: 2334; LINUX-X64: mov{{l|q}} %fs: 2335; LINUX-X64: callq __stack_chk_fail 2336 2337; LINUX-KERNEL-X64-LABEL: test16d: 2338; LINUX-KERNEL-X64: mov{{l|q}} %gs: 2339; LINUX-KERNEL-X64: callq __stack_chk_fail 2340 2341; DARWIN-X64-LABEL: test16d: 2342; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 2343; DARWIN-X64: callq ___stack_chk_fail 2344 2345; MSVC-I386-LABEL: test16d: 2346; MSVC-I386: movl ___security_cookie, 2347; MSVC-I386: calll @__security_check_cookie@4 2348 %a = alloca i32, align 4 2349 store i32 0, ptr %a, align 4 2350 call void @funfloat(ptr %a) 2351 ret void 2352} 2353 2354; test17a: Addr-of a vector nested in a struct 2355; no ssp attribute 2356; Requires no protector. 2357define void @test17a() { 2358entry: 2359; LINUX-I386-LABEL: test17a: 2360; LINUX-I386-NOT: calll __stack_chk_fail 2361; LINUX-I386: .cfi_endproc 2362 2363; LINUX-X64-LABEL: test17a: 2364; LINUX-X64-NOT: callq __stack_chk_fail 2365; LINUX-X64: .cfi_endproc 2366 2367; LINUX-KERNEL-X64-LABEL: test17a: 2368; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 2369; LINUX-KERNEL-X64: .cfi_endproc 2370 2371; DARWIN-X64-LABEL: test17a: 2372; DARWIN-X64-NOT: callq ___stack_chk_fail 2373; DARWIN-X64: .cfi_endproc 2374 2375; MSVC-I386-LABEL: test17a: 2376; MSVC-I386-NOT: calll @__security_check_cookie@4 2377; MSVC-I386: retl 2378 %c = alloca %struct.vec, align 16 2379 %add.ptr = getelementptr inbounds <4 x i32>, ptr %c, i64 -12 2380 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %add.ptr) 2381 ret void 2382} 2383 2384; test17b: Addr-of a vector nested in a struct 2385; ssp attribute 2386; Requires no protector. 2387; Function Attrs: ssp 2388define void @test17b() #0 { 2389entry: 2390; LINUX-I386-LABEL: test17b: 2391; LINUX-I386-NOT: calll __stack_chk_fail 2392; LINUX-I386: .cfi_endproc 2393 2394; LINUX-X64-LABEL: test17b: 2395; LINUX-X64-NOT: callq __stack_chk_fail 2396; LINUX-X64: .cfi_endproc 2397 2398; LINUX-KERNEL-X64-LABEL: test17b: 2399; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 2400; LINUX-KERNEL-X64: .cfi_endproc 2401 2402; DARWIN-X64-LABEL: test17b: 2403; DARWIN-X64-NOT: callq ___stack_chk_fail 2404; DARWIN-X64: .cfi_endproc 2405 2406; MSVC-I386-LABEL: test17b: 2407; MSVC-I386-NOT: calll @__security_check_cookie@4 2408; MSVC-I386: retl 2409 %c = alloca %struct.vec, align 16 2410 %add.ptr = getelementptr inbounds <4 x i32>, ptr %c, i64 -12 2411 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %add.ptr) 2412 ret void 2413} 2414 2415; test17c: Addr-of a vector nested in a struct 2416; sspstrong attribute 2417; Requires protector. 2418; Function Attrs: sspstrong 2419define void @test17c() #1 { 2420entry: 2421; LINUX-I386-LABEL: test17c: 2422; LINUX-I386: mov{{l|q}} %gs: 2423; LINUX-I386: calll __stack_chk_fail 2424 2425; LINUX-X64-LABEL: test17c: 2426; LINUX-X64: mov{{l|q}} %fs: 2427; LINUX-X64: callq __stack_chk_fail 2428 2429; LINUX-KERNEL-X64-LABEL: test17c: 2430; LINUX-KERNEL-X64: mov{{l|q}} %gs: 2431; LINUX-KERNEL-X64: callq __stack_chk_fail 2432 2433; DARWIN-X64-LABEL: test17c: 2434; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 2435; DARWIN-X64: callq ___stack_chk_fail 2436 2437; MSVC-I386-LABEL: test17c: 2438; MSVC-I386: movl ___security_cookie, 2439; MSVC-I386: calll @__security_check_cookie@4 2440 %c = alloca %struct.vec, align 16 2441 %add.ptr = getelementptr inbounds <4 x i32>, ptr %c, i64 -12 2442 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %add.ptr) 2443 ret void 2444} 2445 2446; test17d: Addr-of a vector nested in a struct 2447; sspreq attribute 2448; Requires protector. 2449; Function Attrs: sspreq 2450define void @test17d() #2 { 2451entry: 2452; LINUX-I386-LABEL: test17d: 2453; LINUX-I386: mov{{l|q}} %gs: 2454; LINUX-I386: calll __stack_chk_fail 2455 2456; LINUX-X64-LABEL: test17d: 2457; LINUX-X64: mov{{l|q}} %fs: 2458; LINUX-X64: callq __stack_chk_fail 2459 2460; LINUX-KERNEL-X64-LABEL: test17d: 2461; LINUX-KERNEL-X64: mov{{l|q}} %gs: 2462; LINUX-KERNEL-X64: callq __stack_chk_fail 2463 2464; DARWIN-X64-LABEL: test17d: 2465; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 2466; DARWIN-X64: callq ___stack_chk_fail 2467 2468; MSVC-I386-LABEL: test17d: 2469; MSVC-I386: movl ___security_cookie, 2470; MSVC-I386: calll @__security_check_cookie@4 2471 %c = alloca %struct.vec, align 16 2472 %add.ptr = getelementptr inbounds <4 x i32>, ptr %c, i64 -12 2473 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %add.ptr) 2474 ret void 2475} 2476 2477; test18a: Addr-of a variable passed into an invoke instruction. 2478; no ssp attribute 2479; Requires no protector. 2480define i32 @test18a() personality ptr @__gxx_personality_v0 { 2481entry: 2482; LINUX-I386-LABEL: test18a: 2483; LINUX-I386-NOT: calll __stack_chk_fail 2484; LINUX-I386: .cfi_endproc 2485 2486; LINUX-X64-LABEL: test18a: 2487; LINUX-X64-NOT: callq __stack_chk_fail 2488; LINUX-X64: .cfi_endproc 2489 2490; LINUX-KERNEL-X64-LABEL: test18a: 2491; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 2492; LINUX-KERNEL-X64: .cfi_endproc 2493 2494; DARWIN-X64-LABEL: test18a: 2495; DARWIN-X64-NOT: callq ___stack_chk_fail 2496; DARWIN-X64: .cfi_endproc 2497 2498; MSVC-I386-LABEL: test18a: 2499; MSVC-I386-NOT: calll @__security_check_cookie@4 2500; MSVC-I386: retl 2501 %a = alloca i32, align 4 2502 %exn.slot = alloca ptr 2503 %ehselector.slot = alloca i32 2504 store i32 0, ptr %a, align 4 2505 invoke void @_Z3exceptPi(ptr %a) 2506 to label %invoke.cont unwind label %lpad 2507 2508invoke.cont: 2509 ret i32 0 2510 2511lpad: 2512 %0 = landingpad { ptr, i32 } 2513 catch ptr null 2514 ret i32 0 2515} 2516 2517; test18b: Addr-of a variable passed into an invoke instruction. 2518; ssp attribute 2519; Requires no protector. 2520; Function Attrs: ssp 2521define i32 @test18b() #0 personality ptr @__gxx_personality_v0 { 2522entry: 2523; LINUX-I386-LABEL: test18b: 2524; LINUX-I386-NOT: calll __stack_chk_fail 2525; LINUX-I386: .cfi_endproc 2526 2527; LINUX-X64-LABEL: test18b: 2528; LINUX-X64-NOT: callq __stack_chk_fail 2529; LINUX-X64: .cfi_endproc 2530 2531; LINUX-KERNEL-X64-LABEL: test18b: 2532; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 2533; LINUX-KERNEL-X64: .cfi_endproc 2534 2535; DARWIN-X64-LABEL: test18b: 2536; DARWIN-X64-NOT: callq ___stack_chk_fail 2537; DARWIN-X64: .cfi_endproc 2538 2539; MSVC-I386-LABEL: test18b: 2540; MSVC-I386-NOT: calll @__security_check_cookie@4 2541; MSVC-I386: retl 2542 %a = alloca i32, align 4 2543 %exn.slot = alloca ptr 2544 %ehselector.slot = alloca i32 2545 store i32 0, ptr %a, align 4 2546 invoke void @_Z3exceptPi(ptr %a) 2547 to label %invoke.cont unwind label %lpad 2548 2549invoke.cont: 2550 ret i32 0 2551 2552lpad: 2553 %0 = landingpad { ptr, i32 } 2554 catch ptr null 2555 ret i32 0 2556} 2557 2558; test18c: Addr-of a variable passed into an invoke instruction. 2559; sspstrong attribute 2560; Requires protector. 2561; Function Attrs: sspstrong 2562define i32 @test18c() #1 personality ptr @__gxx_personality_v0 { 2563entry: 2564; LINUX-I386-LABEL: test18c: 2565; LINUX-I386: mov{{l|q}} %gs: 2566; LINUX-I386: calll __stack_chk_fail 2567 2568; LINUX-X64-LABEL: test18c: 2569; LINUX-X64: mov{{l|q}} %fs: 2570; LINUX-X64: callq __stack_chk_fail 2571 2572; LINUX-KERNEL-X64-LABEL: test18c: 2573; LINUX-KERNEL-X64: mov{{l|q}} %gs: 2574; LINUX-KERNEL-X64: callq __stack_chk_fail 2575 2576; DARWIN-X64-LABEL: test18c: 2577; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 2578; DARWIN-X64: callq ___stack_chk_fail 2579 2580; MSVC-I386-LABEL: test18c: 2581; MSVC-I386: movl ___security_cookie, 2582; MSVC-I386: calll @__security_check_cookie@4 2583 %a = alloca i32, align 4 2584 %exn.slot = alloca ptr 2585 %ehselector.slot = alloca i32 2586 store i32 0, ptr %a, align 4 2587 invoke void @_Z3exceptPi(ptr %a) 2588 to label %invoke.cont unwind label %lpad 2589 2590invoke.cont: 2591 ret i32 0 2592 2593lpad: 2594 %0 = landingpad { ptr, i32 } 2595 catch ptr null 2596 ret i32 0 2597} 2598 2599; test18d: Addr-of a variable passed into an invoke instruction. 2600; sspreq attribute 2601; Requires protector. 2602; Function Attrs: sspreq 2603define i32 @test18d() #2 personality ptr @__gxx_personality_v0 { 2604entry: 2605; LINUX-I386-LABEL: test18d: 2606; LINUX-I386: mov{{l|q}} %gs: 2607; LINUX-I386: calll __stack_chk_fail 2608 2609; LINUX-X64-LABEL: test18d: 2610; LINUX-X64: mov{{l|q}} %fs: 2611; LINUX-X64: callq __stack_chk_fail 2612 2613; LINUX-KERNEL-X64-LABEL: test18d: 2614; LINUX-KERNEL-X64: mov{{l|q}} %gs: 2615; LINUX-KERNEL-X64: callq __stack_chk_fail 2616 2617; DARWIN-X64-LABEL: test18d: 2618; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 2619; DARWIN-X64: callq ___stack_chk_fail 2620 2621; MSVC-I386-LABEL: test18d: 2622; MSVC-I386: movl ___security_cookie, 2623; MSVC-I386: calll @__security_check_cookie@4 2624 %a = alloca i32, align 4 2625 %exn.slot = alloca ptr 2626 %ehselector.slot = alloca i32 2627 store i32 0, ptr %a, align 4 2628 invoke void @_Z3exceptPi(ptr %a) 2629 to label %invoke.cont unwind label %lpad 2630 2631invoke.cont: 2632 ret i32 0 2633 2634lpad: 2635 %0 = landingpad { ptr, i32 } 2636 catch ptr null 2637 ret i32 0 2638} 2639; test19a: Addr-of a struct element passed into an invoke instruction. 2640; (GEP followed by an invoke) 2641; no ssp attribute 2642; Requires no protector. 2643define i32 @test19a() personality ptr @__gxx_personality_v0 { 2644entry: 2645; LINUX-I386-LABEL: test19a: 2646; LINUX-I386-NOT: calll __stack_chk_fail 2647; LINUX-I386: .cfi_endproc 2648 2649; LINUX-X64-LABEL: test19a: 2650; LINUX-X64-NOT: callq __stack_chk_fail 2651; LINUX-X64: .cfi_endproc 2652 2653; LINUX-KERNEL-X64-LABEL: test19a: 2654; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 2655; LINUX-KERNEL-X64: .cfi_endproc 2656 2657; DARWIN-X64-LABEL: test19a: 2658; DARWIN-X64-NOT: callq ___stack_chk_fail 2659; DARWIN-X64: .cfi_endproc 2660 2661; MSVC-I386-LABEL: test19a: 2662; MSVC-I386-NOT: calll @__security_check_cookie@4 2663; MSVC-I386: retl 2664 %c = alloca %struct.pair, align 4 2665 %exn.slot = alloca ptr 2666 %ehselector.slot = alloca i32 2667 store i32 0, ptr %c, align 4 2668 invoke void @_Z3exceptPi(ptr %c) 2669 to label %invoke.cont unwind label %lpad 2670 2671invoke.cont: 2672 ret i32 0 2673 2674lpad: 2675 %0 = landingpad { ptr, i32 } 2676 catch ptr null 2677 ret i32 0 2678} 2679 2680; test19b: Addr-of a struct element passed into an invoke instruction. 2681; (GEP followed by an invoke) 2682; ssp attribute 2683; Requires no protector. 2684; Function Attrs: ssp 2685define i32 @test19b() #0 personality ptr @__gxx_personality_v0 { 2686entry: 2687; LINUX-I386-LABEL: test19b: 2688; LINUX-I386-NOT: calll __stack_chk_fail 2689; LINUX-I386: .cfi_endproc 2690 2691; LINUX-X64-LABEL: test19b: 2692; LINUX-X64-NOT: callq __stack_chk_fail 2693; LINUX-X64: .cfi_endproc 2694 2695; LINUX-KERNEL-X64-LABEL: test19b: 2696; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 2697; LINUX-KERNEL-X64: .cfi_endproc 2698 2699; DARWIN-X64-LABEL: test19b: 2700; DARWIN-X64-NOT: callq ___stack_chk_fail 2701; DARWIN-X64: .cfi_endproc 2702 2703; MSVC-I386-LABEL: test19b: 2704; MSVC-I386-NOT: calll @__security_check_cookie@4 2705; MSVC-I386: retl 2706 %c = alloca %struct.pair, align 4 2707 %exn.slot = alloca ptr 2708 %ehselector.slot = alloca i32 2709 store i32 0, ptr %c, align 4 2710 invoke void @_Z3exceptPi(ptr %c) 2711 to label %invoke.cont unwind label %lpad 2712 2713invoke.cont: 2714 ret i32 0 2715 2716lpad: 2717 %0 = landingpad { ptr, i32 } 2718 catch ptr null 2719 ret i32 0 2720} 2721 2722; test19c: Addr-of a struct element passed into an invoke instruction. 2723; (GEP followed by an invoke) 2724; sspstrong attribute 2725; Requires protector. 2726; Function Attrs: sspstrong 2727define i32 @test19c() #1 personality ptr @__gxx_personality_v0 { 2728entry: 2729; LINUX-I386-LABEL: test19c: 2730; LINUX-I386: mov{{l|q}} %gs: 2731; LINUX-I386: calll __stack_chk_fail 2732 2733; LINUX-X64-LABEL: test19c: 2734; LINUX-X64: mov{{l|q}} %fs: 2735; LINUX-X64: callq __stack_chk_fail 2736 2737; LINUX-KERNEL-X64-LABEL: test19c: 2738; LINUX-KERNEL-X64: mov{{l|q}} %gs: 2739; LINUX-KERNEL-X64: callq __stack_chk_fail 2740 2741; DARWIN-X64-LABEL: test19c: 2742; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 2743; DARWIN-X64: callq ___stack_chk_fail 2744 2745; MSVC-I386-LABEL: test19c: 2746; MSVC-I386: movl ___security_cookie, 2747; MSVC-I386: calll @__security_check_cookie@4 2748 %c = alloca %struct.pair, align 4 2749 %exn.slot = alloca ptr 2750 %ehselector.slot = alloca i32 2751 store i32 0, ptr %c, align 4 2752 invoke void @_Z3exceptPi(ptr %c) 2753 to label %invoke.cont unwind label %lpad 2754 2755invoke.cont: 2756 ret i32 0 2757 2758lpad: 2759 %0 = landingpad { ptr, i32 } 2760 catch ptr null 2761 ret i32 0 2762} 2763 2764; test19d: Addr-of a struct element passed into an invoke instruction. 2765; (GEP followed by an invoke) 2766; sspreq attribute 2767; Requires protector. 2768; Function Attrs: sspreq 2769define i32 @test19d() #2 personality ptr @__gxx_personality_v0 { 2770entry: 2771; LINUX-I386-LABEL: test19d: 2772; LINUX-I386: mov{{l|q}} %gs: 2773; LINUX-I386: calll __stack_chk_fail 2774; LINUX-I386-NOT: calll __stack_chk_fail 2775 2776; LINUX-X64-LABEL: test19d: 2777; LINUX-X64: mov{{l|q}} %fs: 2778; LINUX-X64: callq __stack_chk_fail 2779; LINUX-X64-NOT: callq __stack_chk_fail 2780 2781; LINUX-KERNEL-X64-LABEL: test19d: 2782; LINUX-KERNEL-X64: mov{{l|q}} %gs: 2783; LINUX-KERNEL-X64: callq __stack_chk_fail 2784; LINUX-KERNEL-X64-NOT: callq ___stack_chk_fail 2785 2786; DARWIN-X64-LABEL: test19d: 2787; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 2788; DARWIN-X64: callq ___stack_chk_fail 2789; DARWIN-X64-NOT: callq ___stack_chk_fail 2790 2791; MSVC-I386-LABEL: test19d: 2792; MSVC-I386: movl ___security_cookie, 2793; MSVC-I386: calll @__security_check_cookie@4 2794 2795; MINGW-X64-LABEL: test19d: 2796; MINGW-X64: mov{{l|q}} .refptr.__stack_chk_guard 2797; MINGW-X64: callq __stack_chk_fail 2798 2799 %c = alloca %struct.pair, align 4 2800 %exn.slot = alloca ptr 2801 %ehselector.slot = alloca i32 2802 store i32 0, ptr %c, align 4 2803 invoke void @_Z3exceptPi(ptr %c) 2804 to label %invoke.cont unwind label %lpad 2805 2806invoke.cont: 2807 ret i32 0 2808 2809lpad: 2810 %0 = landingpad { ptr, i32 } 2811 catch ptr null 2812 ret i32 0 2813} 2814 2815; test20a: Addr-of a pointer 2816; no ssp attribute 2817; Requires no protector. 2818define void @test20a() { 2819entry: 2820; LINUX-I386-LABEL: test20a: 2821; LINUX-I386-NOT: calll __stack_chk_fail 2822; LINUX-I386: .cfi_endproc 2823 2824; LINUX-X64-LABEL: test20a: 2825; LINUX-X64-NOT: callq __stack_chk_fail 2826; LINUX-X64: .cfi_endproc 2827 2828; LINUX-KERNEL-X64-LABEL: test20a: 2829; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 2830; LINUX-KERNEL-X64: .cfi_endproc 2831 2832; DARWIN-X64-LABEL: test20a: 2833; DARWIN-X64-NOT: callq ___stack_chk_fail 2834; DARWIN-X64: .cfi_endproc 2835 2836; MSVC-I386-LABEL: test20a: 2837; MSVC-I386-NOT: calll @__security_check_cookie@4 2838; MSVC-I386: retl 2839 %a = alloca ptr, align 8 2840 %b = alloca ptr, align 8 2841 %call = call ptr @getp() 2842 store ptr %call, ptr %a, align 8 2843 store ptr %a, ptr %b, align 8 2844 %0 = load ptr, ptr %b, align 8 2845 call void @funcall2(ptr %0) 2846 ret void 2847} 2848 2849; test20b: Addr-of a pointer 2850; ssp attribute 2851; Requires no protector. 2852; Function Attrs: ssp 2853define void @test20b() #0 { 2854entry: 2855; LINUX-I386-LABEL: test20b: 2856; LINUX-I386-NOT: calll __stack_chk_fail 2857; LINUX-I386: .cfi_endproc 2858 2859; LINUX-X64-LABEL: test20b: 2860; LINUX-X64-NOT: callq __stack_chk_fail 2861; LINUX-X64: .cfi_endproc 2862 2863; LINUX-KERNEL-X64-LABEL: test20b: 2864; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 2865; LINUX-KERNEL-X64: .cfi_endproc 2866 2867; DARWIN-X64-LABEL: test20b: 2868; DARWIN-X64-NOT: callq ___stack_chk_fail 2869; DARWIN-X64: .cfi_endproc 2870 2871; MSVC-I386-LABEL: test20b: 2872; MSVC-I386-NOT: calll @__security_check_cookie@4 2873; MSVC-I386: retl 2874 %a = alloca ptr, align 8 2875 %b = alloca ptr, align 8 2876 %call = call ptr @getp() 2877 store ptr %call, ptr %a, align 8 2878 store ptr %a, ptr %b, align 8 2879 %0 = load ptr, ptr %b, align 8 2880 call void @funcall2(ptr %0) 2881 ret void 2882} 2883 2884; test20c: Addr-of a pointer 2885; sspstrong attribute 2886; Requires protector. 2887; Function Attrs: sspstrong 2888define void @test20c() #1 { 2889entry: 2890; LINUX-I386-LABEL: test20c: 2891; LINUX-I386: mov{{l|q}} %gs: 2892; LINUX-I386: calll __stack_chk_fail 2893 2894; LINUX-X64-LABEL: test20c: 2895; LINUX-X64: mov{{l|q}} %fs: 2896; LINUX-X64: callq __stack_chk_fail 2897 2898; LINUX-KERNEL-X64-LABEL: test20c: 2899; LINUX-KERNEL-X64: mov{{l|q}} %gs: 2900; LINUX-KERNEL-X64: callq __stack_chk_fail 2901 2902; DARWIN-X64-LABEL: test20c: 2903; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 2904; DARWIN-X64: callq ___stack_chk_fail 2905 2906; MSVC-I386-LABEL: test20c: 2907; MSVC-I386: movl ___security_cookie, 2908; MSVC-I386: calll @__security_check_cookie@4 2909 %a = alloca ptr, align 8 2910 %b = alloca ptr, align 8 2911 %call = call ptr @getp() 2912 store ptr %call, ptr %a, align 8 2913 store ptr %a, ptr %b, align 8 2914 %0 = load ptr, ptr %b, align 8 2915 call void @funcall2(ptr %0) 2916 ret void 2917} 2918 2919; test20d: Addr-of a pointer 2920; sspreq attribute 2921; Requires protector. 2922; Function Attrs: sspreq 2923define void @test20d() #2 { 2924entry: 2925; LINUX-I386-LABEL: test20d: 2926; LINUX-I386: mov{{l|q}} %gs: 2927; LINUX-I386: calll __stack_chk_fail 2928 2929; LINUX-X64-LABEL: test20d: 2930; LINUX-X64: mov{{l|q}} %fs: 2931; LINUX-X64: callq __stack_chk_fail 2932 2933; LINUX-KERNEL-X64-LABEL: test20d: 2934; LINUX-KERNEL-X64: mov{{l|q}} %gs: 2935; LINUX-KERNEL-X64: callq __stack_chk_fail 2936 2937; DARWIN-X64-LABEL: test20d: 2938; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 2939; DARWIN-X64: callq ___stack_chk_fail 2940 2941; MSVC-I386-LABEL: test20d: 2942; MSVC-I386: movl ___security_cookie, 2943; MSVC-I386: calll @__security_check_cookie@4 2944 %a = alloca ptr, align 8 2945 %b = alloca ptr, align 8 2946 %call = call ptr @getp() 2947 store ptr %call, ptr %a, align 8 2948 store ptr %a, ptr %b, align 8 2949 %0 = load ptr, ptr %b, align 8 2950 call void @funcall2(ptr %0) 2951 ret void 2952} 2953 2954; test21a: Addr-of a casted pointer 2955; no ssp attribute 2956; Requires no protector. 2957define void @test21a() { 2958entry: 2959; LINUX-I386-LABEL: test21a: 2960; LINUX-I386-NOT: calll __stack_chk_fail 2961; LINUX-I386: .cfi_endproc 2962 2963; LINUX-X64-LABEL: test21a: 2964; LINUX-X64-NOT: callq __stack_chk_fail 2965; LINUX-X64: .cfi_endproc 2966 2967; LINUX-KERNEL-X64-LABEL: test21a: 2968; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 2969; LINUX-KERNEL-X64: .cfi_endproc 2970 2971; DARWIN-X64-LABEL: test21a: 2972; DARWIN-X64-NOT: callq ___stack_chk_fail 2973; DARWIN-X64: .cfi_endproc 2974 2975; MSVC-I386-LABEL: test21a: 2976; MSVC-I386-NOT: calll @__security_check_cookie@4 2977; MSVC-I386: retl 2978 %a = alloca ptr, align 8 2979 %b = alloca ptr, align 8 2980 %call = call ptr @getp() 2981 store ptr %call, ptr %a, align 8 2982 store ptr %a, ptr %b, align 8 2983 %0 = load ptr, ptr %b, align 8 2984 call void @funfloat2(ptr %0) 2985 ret void 2986} 2987 2988; test21b: Addr-of a casted pointer 2989; ssp attribute 2990; Requires no protector. 2991; Function Attrs: ssp 2992define void @test21b() #0 { 2993entry: 2994; LINUX-I386-LABEL: test21b: 2995; LINUX-I386-NOT: calll __stack_chk_fail 2996; LINUX-I386: .cfi_endproc 2997 2998; LINUX-X64-LABEL: test21b: 2999; LINUX-X64-NOT: callq __stack_chk_fail 3000; LINUX-X64: .cfi_endproc 3001 3002; LINUX-KERNEL-X64-LABEL: test21b: 3003; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 3004; LINUX-KERNEL-X64: .cfi_endproc 3005 3006; DARWIN-X64-LABEL: test21b: 3007; DARWIN-X64-NOT: callq ___stack_chk_fail 3008; DARWIN-X64: .cfi_endproc 3009 3010; MSVC-I386-LABEL: test21b: 3011; MSVC-I386-NOT: calll @__security_check_cookie@4 3012; MSVC-I386: retl 3013 %a = alloca ptr, align 8 3014 %b = alloca ptr, align 8 3015 %call = call ptr @getp() 3016 store ptr %call, ptr %a, align 8 3017 store ptr %a, ptr %b, align 8 3018 %0 = load ptr, ptr %b, align 8 3019 call void @funfloat2(ptr %0) 3020 ret void 3021} 3022 3023; test21c: Addr-of a casted pointer 3024; sspstrong attribute 3025; Requires protector. 3026; Function Attrs: sspstrong 3027define void @test21c() #1 { 3028entry: 3029; LINUX-I386-LABEL: test21c: 3030; LINUX-I386: mov{{l|q}} %gs: 3031; LINUX-I386: calll __stack_chk_fail 3032 3033; LINUX-X64-LABEL: test21c: 3034; LINUX-X64: mov{{l|q}} %fs: 3035; LINUX-X64: callq __stack_chk_fail 3036 3037; LINUX-KERNEL-X64-LABEL: test21c: 3038; LINUX-KERNEL-X64: mov{{l|q}} %gs: 3039; LINUX-KERNEL-X64: callq __stack_chk_fail 3040 3041; DARWIN-X64-LABEL: test21c: 3042; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 3043; DARWIN-X64: callq ___stack_chk_fail 3044 3045; MSVC-I386-LABEL: test21c: 3046; MSVC-I386: movl ___security_cookie, 3047; MSVC-I386: calll @__security_check_cookie@4 3048 %a = alloca ptr, align 8 3049 %b = alloca ptr, align 8 3050 %call = call ptr @getp() 3051 store ptr %call, ptr %a, align 8 3052 store ptr %a, ptr %b, align 8 3053 %0 = load ptr, ptr %b, align 8 3054 call void @funfloat2(ptr %0) 3055 ret void 3056} 3057 3058; test21d: Addr-of a casted pointer 3059; sspreq attribute 3060; Requires protector. 3061; Function Attrs: sspreq 3062define void @test21d() #2 { 3063entry: 3064; LINUX-I386-LABEL: test21d: 3065; LINUX-I386: mov{{l|q}} %gs: 3066; LINUX-I386: calll __stack_chk_fail 3067 3068; LINUX-X64-LABEL: test21d: 3069; LINUX-X64: mov{{l|q}} %fs: 3070; LINUX-X64: callq __stack_chk_fail 3071 3072; LINUX-KERNEL-X64-LABEL: test21d: 3073; LINUX-KERNEL-X64: mov{{l|q}} %gs: 3074; LINUX-KERNEL-X64: callq __stack_chk_fail 3075 3076; DARWIN-X64-LABEL: test21d: 3077; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 3078; DARWIN-X64: callq ___stack_chk_fail 3079 3080; MSVC-I386-LABEL: test21d: 3081; MSVC-I386: movl ___security_cookie, 3082; MSVC-I386: calll @__security_check_cookie@4 3083 %a = alloca ptr, align 8 3084 %b = alloca ptr, align 8 3085 %call = call ptr @getp() 3086 store ptr %call, ptr %a, align 8 3087 store ptr %a, ptr %b, align 8 3088 %0 = load ptr, ptr %b, align 8 3089 call void @funfloat2(ptr %0) 3090 ret void 3091} 3092 3093; test22a: [2 x i8] in a class 3094; no ssp attribute 3095; Requires no protector. 3096define signext i8 @test22a() { 3097entry: 3098; LINUX-I386-LABEL: test22a: 3099; LINUX-I386-NOT: calll __stack_chk_fail 3100; LINUX-I386: .cfi_endproc 3101 3102; LINUX-X64-LABEL: test22a: 3103; LINUX-X64-NOT: callq __stack_chk_fail 3104; LINUX-X64: .cfi_endproc 3105 3106; LINUX-KERNEL-X64-LABEL: test22a: 3107; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 3108; LINUX-KERNEL-X64: .cfi_endproc 3109 3110; DARWIN-X64-LABEL: test22a: 3111; DARWIN-X64-NOT: callq ___stack_chk_fail 3112; DARWIN-X64: .cfi_endproc 3113 3114; MSVC-I386-LABEL: test22a: 3115; MSVC-I386-NOT: calll @__security_check_cookie@4 3116; MSVC-I386: retl 3117 %a = alloca %class.A, align 1 3118 %0 = load i8, ptr %a, align 1 3119 ret i8 %0 3120} 3121 3122; test22b: [2 x i8] in a class 3123; ssp attribute 3124; Requires no protector. 3125; Function Attrs: ssp 3126define signext i8 @test22b() #0 { 3127entry: 3128; LINUX-I386-LABEL: test22b: 3129; LINUX-I386-NOT: calll __stack_chk_fail 3130; LINUX-I386: .cfi_endproc 3131 3132; LINUX-X64-LABEL: test22b: 3133; LINUX-X64-NOT: callq __stack_chk_fail 3134; LINUX-X64: .cfi_endproc 3135 3136; LINUX-KERNEL-X64-LABEL: test22b: 3137; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 3138; LINUX-KERNEL-X64: .cfi_endproc 3139 3140; DARWIN-X64-LABEL: test22b: 3141; DARWIN-X64-NOT: callq ___stack_chk_fail 3142; DARWIN-X64: .cfi_endproc 3143 3144; MSVC-I386-LABEL: test22b: 3145; MSVC-I386-NOT: calll @__security_check_cookie@4 3146; MSVC-I386: retl 3147 %a = alloca %class.A, align 1 3148 %0 = load i8, ptr %a, align 1 3149 ret i8 %0 3150} 3151 3152; test22c: [2 x i8] in a class 3153; sspstrong attribute 3154; Requires protector. 3155; Function Attrs: sspstrong 3156define signext i8 @test22c() #1 { 3157entry: 3158; LINUX-I386-LABEL: test22c: 3159; LINUX-I386: mov{{l|q}} %gs: 3160; LINUX-I386: calll __stack_chk_fail 3161 3162; LINUX-X64-LABEL: test22c: 3163; LINUX-X64: mov{{l|q}} %fs: 3164; LINUX-X64: callq __stack_chk_fail 3165 3166; LINUX-KERNEL-X64-LABEL: test22c: 3167; LINUX-KERNEL-X64: mov{{l|q}} %gs: 3168; LINUX-KERNEL-X64: callq __stack_chk_fail 3169 3170; DARWIN-X64-LABEL: test22c: 3171; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 3172; DARWIN-X64: callq ___stack_chk_fail 3173 3174; MSVC-I386-LABEL: test22c: 3175; MSVC-I386: movl ___security_cookie, 3176; MSVC-I386: calll @__security_check_cookie@4 3177 %a = alloca %class.A, align 1 3178 %0 = load i8, ptr %a, align 1 3179 ret i8 %0 3180} 3181 3182; test22d: [2 x i8] in a class 3183; sspreq attribute 3184; Requires protector. 3185; Function Attrs: sspreq 3186define signext i8 @test22d() #2 { 3187entry: 3188; LINUX-I386-LABEL: test22d: 3189; LINUX-I386: mov{{l|q}} %gs: 3190; LINUX-I386: calll __stack_chk_fail 3191 3192; LINUX-X64-LABEL: test22d: 3193; LINUX-X64: mov{{l|q}} %fs: 3194; LINUX-X64: callq __stack_chk_fail 3195 3196; LINUX-KERNEL-X64-LABEL: test22d: 3197; LINUX-KERNEL-X64: mov{{l|q}} %gs: 3198; LINUX-KERNEL-X64: callq __stack_chk_fail 3199 3200; DARWIN-X64-LABEL: test22d: 3201; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 3202; DARWIN-X64: callq ___stack_chk_fail 3203 3204; MSVC-I386-LABEL: test22d: 3205; MSVC-I386: movl ___security_cookie, 3206; MSVC-I386: calll @__security_check_cookie@4 3207 %a = alloca %class.A, align 1 3208 %0 = load i8, ptr %a, align 1 3209 ret i8 %0 3210} 3211 3212; test23a: [2 x i8] nested in several layers of structs and unions 3213; no ssp attribute 3214; Requires no protector. 3215define signext i8 @test23a() { 3216entry: 3217; LINUX-I386-LABEL: test23a: 3218; LINUX-I386-NOT: calll __stack_chk_fail 3219; LINUX-I386: .cfi_endproc 3220 3221; LINUX-X64-LABEL: test23a: 3222; LINUX-X64-NOT: callq __stack_chk_fail 3223; LINUX-X64: .cfi_endproc 3224 3225; LINUX-KERNEL-X64-LABEL: test23a: 3226; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 3227; LINUX-KERNEL-X64: .cfi_endproc 3228 3229; DARWIN-X64-LABEL: test23a: 3230; DARWIN-X64-NOT: callq ___stack_chk_fail 3231; DARWIN-X64: .cfi_endproc 3232 3233; MSVC-I386-LABEL: test23a: 3234; MSVC-I386-NOT: calll @__security_check_cookie@4 3235; MSVC-I386: retl 3236 %x = alloca %struct.deep, align 1 3237 %0 = load i8, ptr %x, align 1 3238 ret i8 %0 3239} 3240 3241; test23b: [2 x i8] nested in several layers of structs and unions 3242; ssp attribute 3243; Requires no protector. 3244; Function Attrs: ssp 3245define signext i8 @test23b() #0 { 3246entry: 3247; LINUX-I386-LABEL: test23b: 3248; LINUX-I386-NOT: calll __stack_chk_fail 3249; LINUX-I386: .cfi_endproc 3250 3251; LINUX-X64-LABEL: test23b: 3252; LINUX-X64-NOT: callq __stack_chk_fail 3253; LINUX-X64: .cfi_endproc 3254 3255; LINUX-KERNEL-X64-LABEL: test23b: 3256; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 3257; LINUX-KERNEL-X64: .cfi_endproc 3258 3259; DARWIN-X64-LABEL: test23b: 3260; DARWIN-X64-NOT: callq ___stack_chk_fail 3261; DARWIN-X64: .cfi_endproc 3262 3263; MSVC-I386-LABEL: test23b: 3264; MSVC-I386-NOT: calll @__security_check_cookie@4 3265; MSVC-I386: retl 3266 %x = alloca %struct.deep, align 1 3267 %0 = load i8, ptr %x, align 1 3268 ret i8 %0 3269} 3270 3271; test23c: [2 x i8] nested in several layers of structs and unions 3272; sspstrong attribute 3273; Requires protector. 3274; Function Attrs: sspstrong 3275define signext i8 @test23c() #1 { 3276entry: 3277; LINUX-I386-LABEL: test23c: 3278; LINUX-I386: mov{{l|q}} %gs: 3279; LINUX-I386: calll __stack_chk_fail 3280 3281; LINUX-X64-LABEL: test23c: 3282; LINUX-X64: mov{{l|q}} %fs: 3283; LINUX-X64: callq __stack_chk_fail 3284 3285; LINUX-KERNEL-X64-LABEL: test23c: 3286; LINUX-KERNEL-X64: mov{{l|q}} %gs: 3287; LINUX-KERNEL-X64: callq __stack_chk_fail 3288 3289; DARWIN-X64-LABEL: test23c: 3290; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 3291; DARWIN-X64: callq ___stack_chk_fail 3292 3293; MSVC-I386-LABEL: test23c: 3294; MSVC-I386: movl ___security_cookie, 3295; MSVC-I386: calll @__security_check_cookie@4 3296 %x = alloca %struct.deep, align 1 3297 %0 = load i8, ptr %x, align 1 3298 ret i8 %0 3299} 3300 3301; test23d: [2 x i8] nested in several layers of structs and unions 3302; sspreq attribute 3303; Requires protector. 3304; Function Attrs: sspreq 3305define signext i8 @test23d() #2 { 3306entry: 3307; LINUX-I386-LABEL: test23d: 3308; LINUX-I386: mov{{l|q}} %gs: 3309; LINUX-I386: calll __stack_chk_fail 3310 3311; LINUX-X64-LABEL: test23d: 3312; LINUX-X64: mov{{l|q}} %fs: 3313; LINUX-X64: callq __stack_chk_fail 3314 3315; LINUX-KERNEL-X64-LABEL: test23d: 3316; LINUX-KERNEL-X64: mov{{l|q}} %gs: 3317; LINUX-KERNEL-X64: callq __stack_chk_fail 3318 3319; DARWIN-X64-LABEL: test23d: 3320; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 3321; DARWIN-X64: callq ___stack_chk_fail 3322 3323; MSVC-I386-LABEL: test23d: 3324; MSVC-I386: movl ___security_cookie, 3325; MSVC-I386: calll @__security_check_cookie@4 3326 %x = alloca %struct.deep, align 1 3327 %0 = load i8, ptr %x, align 1 3328 ret i8 %0 3329} 3330 3331; test24a: Variable sized alloca 3332; no ssp attribute 3333; Requires no protector. 3334define void @test24a(i32 %n) { 3335entry: 3336; LINUX-I386-LABEL: test24a: 3337; LINUX-I386-NOT: calll __stack_chk_fail 3338; LINUX-I386: .cfi_endproc 3339 3340; LINUX-X64-LABEL: test24a: 3341; LINUX-X64-NOT: callq __stack_chk_fail 3342; LINUX-X64: .cfi_endproc 3343 3344; LINUX-KERNEL-X64-LABEL: test24a: 3345; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 3346; LINUX-KERNEL-X64: .cfi_endproc 3347 3348; DARWIN-X64-LABEL: test24a: 3349; DARWIN-X64-NOT: callq ___stack_chk_fail 3350; DARWIN-X64: .cfi_endproc 3351 3352; MSVC-I386-LABEL: test24a: 3353; MSVC-I386-NOT: calll @__security_check_cookie@4 3354; MSVC-I386: retl 3355 %n.addr = alloca i32, align 4 3356 %a = alloca ptr, align 8 3357 store i32 %n, ptr %n.addr, align 4 3358 %0 = load i32, ptr %n.addr, align 4 3359 %conv = sext i32 %0 to i64 3360 %1 = alloca i8, i64 %conv 3361 store ptr %1, ptr %a, align 8 3362 ret void 3363} 3364 3365; test24b: Variable sized alloca 3366; ssp attribute 3367; Requires protector. 3368; Function Attrs: ssp 3369define void @test24b(i32 %n) #0 { 3370entry: 3371; LINUX-I386-LABEL: test24b: 3372; LINUX-I386: mov{{l|q}} %gs: 3373; LINUX-I386: calll __stack_chk_fail 3374 3375; LINUX-X64-LABEL: test24b: 3376; LINUX-X64: mov{{l|q}} %fs: 3377; LINUX-X64: callq __stack_chk_fail 3378 3379; LINUX-KERNEL-X64-LABEL: test24b: 3380; LINUX-KERNEL-X64: mov{{l|q}} %gs: 3381; LINUX-KERNEL-X64: callq __stack_chk_fail 3382 3383; DARWIN-X64-LABEL: test24b: 3384; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 3385; DARWIN-X64: callq ___stack_chk_fail 3386 3387; MSVC-I386-LABEL: test24b: 3388; MSVC-I386: movl ___security_cookie, 3389; MSVC-I386: calll @__security_check_cookie@4 3390 %n.addr = alloca i32, align 4 3391 %a = alloca ptr, align 8 3392 store i32 %n, ptr %n.addr, align 4 3393 %0 = load i32, ptr %n.addr, align 4 3394 %conv = sext i32 %0 to i64 3395 %1 = alloca i8, i64 %conv 3396 store ptr %1, ptr %a, align 8 3397 ret void 3398} 3399 3400; test24c: Variable sized alloca 3401; sspstrong attribute 3402; Requires protector. 3403; Function Attrs: sspstrong 3404define void @test24c(i32 %n) #1 { 3405entry: 3406; LINUX-I386-LABEL: test24c: 3407; LINUX-I386: mov{{l|q}} %gs: 3408; LINUX-I386: calll __stack_chk_fail 3409 3410; LINUX-X64-LABEL: test24c: 3411; LINUX-X64: mov{{l|q}} %fs: 3412; LINUX-X64: callq __stack_chk_fail 3413 3414; LINUX-KERNEL-X64-LABEL: test24c: 3415; LINUX-KERNEL-X64: mov{{l|q}} %gs: 3416; LINUX-KERNEL-X64: callq __stack_chk_fail 3417 3418; DARWIN-X64-LABEL: test24c: 3419; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 3420; DARWIN-X64: callq ___stack_chk_fail 3421 3422; MSVC-I386-LABEL: test24c: 3423; MSVC-I386: movl ___security_cookie, 3424; MSVC-I386: calll @__security_check_cookie@4 3425 %n.addr = alloca i32, align 4 3426 %a = alloca ptr, align 8 3427 store i32 %n, ptr %n.addr, align 4 3428 %0 = load i32, ptr %n.addr, align 4 3429 %conv = sext i32 %0 to i64 3430 %1 = alloca i8, i64 %conv 3431 store ptr %1, ptr %a, align 8 3432 ret void 3433} 3434 3435; test24d: Variable sized alloca 3436; sspreq attribute 3437; Requires protector. 3438; Function Attrs: sspreq 3439define void @test24d(i32 %n) #2 { 3440entry: 3441; LINUX-I386-LABEL: test24d: 3442; LINUX-I386: mov{{l|q}} %gs: 3443; LINUX-I386: calll __stack_chk_fail 3444 3445; LINUX-X64-LABEL: test24d: 3446; LINUX-X64: mov{{l|q}} %fs: 3447; LINUX-X64: callq __stack_chk_fail 3448 3449; LINUX-KERNEL-X64-LABEL: test24d: 3450; LINUX-KERNEL-X64: mov{{l|q}} %gs: 3451; LINUX-KERNEL-X64: callq __stack_chk_fail 3452 3453; DARWIN-X64-LABEL: test24d: 3454; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 3455; DARWIN-X64: callq ___stack_chk_fail 3456 3457; MSVC-I386-LABEL: test24d: 3458; MSVC-I386: movl ___security_cookie, 3459; MSVC-I386: calll @__security_check_cookie@4 3460 %n.addr = alloca i32, align 4 3461 %a = alloca ptr, align 8 3462 store i32 %n, ptr %n.addr, align 4 3463 %0 = load i32, ptr %n.addr, align 4 3464 %conv = sext i32 %0 to i64 3465 %1 = alloca i8, i64 %conv 3466 store ptr %1, ptr %a, align 8 3467 ret void 3468} 3469 3470; test25a: array of [4 x i32] 3471; no ssp attribute 3472; Requires no protector. 3473define i32 @test25a() { 3474entry: 3475; LINUX-I386-LABEL: test25a: 3476; LINUX-I386-NOT: calll __stack_chk_fail 3477; LINUX-I386: .cfi_endproc 3478 3479; LINUX-X64-LABEL: test25a: 3480; LINUX-X64-NOT: callq __stack_chk_fail 3481; LINUX-X64: .cfi_endproc 3482 3483; LINUX-KERNEL-X64-LABEL: test25a: 3484; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 3485; LINUX-KERNEL-X64: .cfi_endproc 3486 3487; DARWIN-X64-LABEL: test25a: 3488; DARWIN-X64-NOT: callq ___stack_chk_fail 3489; DARWIN-X64: .cfi_endproc 3490 3491; MSVC-I386-LABEL: test25a: 3492; MSVC-I386-NOT: calll @__security_check_cookie@4 3493; MSVC-I386: retl 3494 %a = alloca [4 x i32], align 16 3495 %0 = load i32, ptr %a, align 4 3496 ret i32 %0 3497} 3498 3499; test25b: array of [4 x i32] 3500; ssp attribute 3501; Requires no protector, except for Darwin which _does_ require a protector. 3502; Function Attrs: ssp 3503define i32 @test25b() #0 { 3504entry: 3505; LINUX-I386-LABEL: test25b: 3506; LINUX-I386-NOT: calll __stack_chk_fail 3507; LINUX-I386: .cfi_endproc 3508 3509; LINUX-X64-LABEL: test25b: 3510; LINUX-X64-NOT: callq __stack_chk_fail 3511; LINUX-X64: .cfi_endproc 3512 3513; LINUX-KERNEL-X64-LABEL: test25b: 3514; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 3515; LINUX-KERNEL-X64: .cfi_endproc 3516 3517; DARWIN-X64-LABEL: test25b: 3518; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 3519; DARWIN-X64: callq ___stack_chk_fail 3520 3521; MSVC-I386-LABEL: test25b: 3522; MSVC-I386-NOT: calll @__security_check_cookie@4 3523; MSVC-I386: retl 3524 3525; MINGW-X64-LABEL: test25b: 3526; MINGW-X64-NOT: callq __stack_chk_fail 3527; MINGW-X64: .seh_endproc 3528 3529 %a = alloca [4 x i32], align 16 3530 %0 = load i32, ptr %a, align 4 3531 ret i32 %0 3532} 3533 3534; test25c: array of [4 x i32] 3535; sspstrong attribute 3536; Requires protector. 3537; Function Attrs: sspstrong 3538define i32 @test25c() #1 { 3539entry: 3540; LINUX-I386-LABEL: test25c: 3541; LINUX-I386: mov{{l|q}} %gs: 3542; LINUX-I386: calll __stack_chk_fail 3543 3544; LINUX-X64-LABEL: test25c: 3545; LINUX-X64: mov{{l|q}} %fs: 3546; LINUX-X64: callq __stack_chk_fail 3547 3548; LINUX-KERNEL-X64-LABEL: test25c: 3549; LINUX-KERNEL-X64: mov{{l|q}} %gs: 3550; LINUX-KERNEL-X64: callq __stack_chk_fail 3551 3552; DARWIN-X64-LABEL: test25c: 3553; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 3554; DARWIN-X64: callq ___stack_chk_fail 3555 3556; MSVC-I386-LABEL: test25c: 3557; MSVC-I386: movl ___security_cookie, 3558; MSVC-I386: calll @__security_check_cookie@4 3559 %a = alloca [4 x i32], align 16 3560 %0 = load i32, ptr %a, align 4 3561 ret i32 %0 3562} 3563 3564; test25d: array of [4 x i32] 3565; sspreq attribute 3566; Requires protector. 3567; Function Attrs: sspreq 3568define i32 @test25d() #2 { 3569entry: 3570; LINUX-I386-LABEL: test25d: 3571; LINUX-I386: mov{{l|q}} %gs: 3572; LINUX-I386: calll __stack_chk_fail 3573 3574; LINUX-X64-LABEL: test25d: 3575; LINUX-X64: mov{{l|q}} %fs: 3576; LINUX-X64: callq __stack_chk_fail 3577 3578; LINUX-KERNEL-X64-LABEL: test25d: 3579; LINUX-KERNEL-X64: mov{{l|q}} %gs: 3580; LINUX-KERNEL-X64: callq __stack_chk_fail 3581 3582; DARWIN-X64-LABEL: test25d: 3583; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 3584; DARWIN-X64: callq ___stack_chk_fail 3585 3586; MSVC-I386-LABEL: test25d: 3587; MSVC-I386: movl ___security_cookie, 3588; MSVC-I386: calll @__security_check_cookie@4 3589 %a = alloca [4 x i32], align 16 3590 %0 = load i32, ptr %a, align 4 3591 ret i32 %0 3592} 3593 3594; test26: Nested structure, no arrays, no address-of expressions. 3595; Verify that the resulting gep-of-gep does not incorrectly trigger 3596; a stack protector. 3597; ssptrong attribute 3598; Requires no protector. 3599; Function Attrs: sspstrong 3600define void @test26() #1 { 3601entry: 3602; LINUX-I386-LABEL: test26: 3603; LINUX-I386-NOT: calll __stack_chk_fail 3604; LINUX-I386: .cfi_endproc 3605 3606; LINUX-X64-LABEL: test26: 3607; LINUX-X64-NOT: callq __stack_chk_fail 3608; LINUX-X64: .cfi_endproc 3609 3610; LINUX-KERNEL-X64-LABEL: test26: 3611; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 3612; LINUX-KERNEL-X64: .cfi_endproc 3613 3614; DARWIN-X64-LABEL: test26: 3615; DARWIN-X64-NOT: callq ___stack_chk_fail 3616; DARWIN-X64: .cfi_endproc 3617 3618; MSVC-I386-LABEL: test26: 3619; MSVC-I386-NOT: calll @__security_check_cookie@4 3620; MSVC-I386: retl 3621 %c = alloca %struct.nest, align 4 3622 %b = getelementptr inbounds %struct.nest, ptr %c, i32 0, i32 1 3623 %0 = load i32, ptr %b, align 4 3624 %call = call i32 (ptr, ...) @printf(ptr @.str, i32 %0) 3625 ret void 3626} 3627 3628; test27: Address-of a structure taken in a function with a loop where 3629; the alloca is an incoming value to a PHI node and a use of that PHI 3630; node is also an incoming value. 3631; Verify that the address-of analysis does not get stuck in infinite 3632; recursion when chasing the alloca through the PHI nodes. 3633; Requires protector. 3634; Function Attrs: sspstrong 3635define i32 @test27(i32 %arg) #1 { 3636bb: 3637; LINUX-I386-LABEL: test27: 3638; LINUX-I386: mov{{l|q}} %gs: 3639; LINUX-I386: calll __stack_chk_fail 3640 3641; LINUX-X64-LABEL: test27: 3642; LINUX-X64: mov{{l|q}} %fs: 3643; LINUX-X64: callq __stack_chk_fail 3644 3645; LINUX-KERNEL-X64-LABEL: test27: 3646; LINUX-KERNEL-X64: mov{{l|q}} %gs: 3647; LINUX-KERNEL-X64: callq __stack_chk_fail 3648 3649; DARWIN-X64-LABEL: test27: 3650; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 3651; DARWIN-X64: callq ___stack_chk_fail 3652 3653; MSVC-I386-LABEL: test27: 3654; MSVC-I386: movl ___security_cookie, 3655; MSVC-I386: calll @__security_check_cookie@4 3656 %tmp = alloca ptr, align 8 3657 %tmp1 = call i32 (...) @dummy(ptr %tmp) 3658 %tmp2 = load ptr, ptr %tmp, align 8 3659 %tmp3 = ptrtoint ptr %tmp2 to i64 3660 %tmp4 = trunc i64 %tmp3 to i32 3661 %tmp5 = icmp sgt i32 %tmp4, 0 3662 br i1 %tmp5, label %bb6, label %bb21 3663 3664bb6: ; preds = %bb17, %bb 3665 %tmp7 = phi ptr [ %tmp19, %bb17 ], [ %tmp2, %bb ] 3666 %tmp8 = phi i64 [ %tmp20, %bb17 ], [ 1, %bb ] 3667 %tmp9 = phi i32 [ %tmp14, %bb17 ], [ %tmp1, %bb ] 3668 %tmp11 = load i8, ptr %tmp7, align 1 3669 %tmp12 = icmp eq i8 %tmp11, 1 3670 %tmp13 = add nsw i32 %tmp9, 8 3671 %tmp14 = select i1 %tmp12, i32 %tmp13, i32 %tmp9 3672 %tmp15 = trunc i64 %tmp8 to i32 3673 %tmp16 = icmp eq i32 %tmp15, %tmp4 3674 br i1 %tmp16, label %bb21, label %bb17 3675 3676bb17: ; preds = %bb6 3677 %tmp18 = getelementptr inbounds ptr, ptr %tmp, i64 %tmp8 3678 %tmp19 = load ptr, ptr %tmp18, align 8 3679 %tmp20 = add i64 %tmp8, 1 3680 br label %bb6 3681 3682bb21: ; preds = %bb6, %bb 3683 %tmp22 = phi i32 [ %tmp1, %bb ], [ %tmp14, %bb6 ] 3684 %tmp23 = call i32 (...) @dummy(i32 %tmp22) 3685 ret i32 undef 3686} 3687 3688; test28a: An array of [32 x i8] and a requested ssp-buffer-size of 33. 3689; Requires no protector. 3690; Function Attrs: ssp stack-protector-buffer-size=33 3691define i32 @test28a() #3 { 3692entry: 3693; LINUX-I386-LABEL: test28a: 3694; LINUX-I386-NOT: calll __stack_chk_fail 3695; LINUX-I386: .cfi_endproc 3696 3697; LINUX-X64-LABEL: test28a: 3698; LINUX-X64-NOT: callq __stack_chk_fail 3699; LINUX-X64: .cfi_endproc 3700 3701; LINUX-KERNEL-X64-LABEL: test28a: 3702; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 3703; LINUX-KERNEL-X64: .cfi_endproc 3704 3705; DARWIN-X64-LABEL: test28a: 3706; DARWIN-X64-NOT: callq ___stack_chk_fail 3707; DARWIN-X64: .cfi_endproc 3708 3709; MSVC-I386-LABEL: test28a: 3710; MSVC-I386-NOT: calll @__security_check_cookie@4 3711; MSVC-I386: retl 3712 %test = alloca [32 x i8], align 16 3713 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %test) 3714 ret i32 %call 3715} 3716 3717; test28b: An array of [33 x i8] and a requested ssp-buffer-size of 33. 3718; Requires protector. 3719; Function Attrs: ssp stack-protector-buffer-size=33 3720define i32 @test28b() #3 { 3721entry: 3722; LINUX-I386-LABEL: test28b: 3723; LINUX-I386: mov{{l|q}} %gs: 3724; LINUX-I386: calll __stack_chk_fail 3725 3726; LINUX-X64-LABEL: test28b: 3727; LINUX-X64: mov{{l|q}} %fs: 3728; LINUX-X64: callq __stack_chk_fail 3729 3730; LINUX-KERNEL-X64-LABEL: test28b: 3731; LINUX-KERNEL-X64: mov{{l|q}} %gs: 3732; LINUX-KERNEL-X64: callq __stack_chk_fail 3733 3734; DARWIN-X64-LABEL: test28b: 3735; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 3736; DARWIN-X64: callq ___stack_chk_fail 3737 3738; MSVC-I386-LABEL: test28b: 3739; MSVC-I386: movl ___security_cookie, 3740; MSVC-I386: calll @__security_check_cookie@4 3741 %test = alloca [33 x i8], align 16 3742 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %test) 3743 ret i32 %call 3744} 3745 3746; test29a: An array of [4 x i8] and a requested ssp-buffer-size of 5. 3747; Requires no protector. 3748; Function Attrs: ssp stack-protector-buffer-size=5 3749define i32 @test29a() #4 { 3750entry: 3751; LINUX-I386-LABEL: test29a: 3752; LINUX-I386-NOT: calll __stack_chk_fail 3753; LINUX-I386: .cfi_endproc 3754 3755; LINUX-X64-LABEL: test29a: 3756; LINUX-X64-NOT: callq __stack_chk_fail 3757; LINUX-X64: .cfi_endproc 3758 3759; LINUX-KERNEL-X64-LABEL: test29a: 3760; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 3761; LINUX-KERNEL-X64: .cfi_endproc 3762 3763; DARWIN-X64-LABEL: test29a: 3764; DARWIN-X64-NOT: callq ___stack_chk_fail 3765; DARWIN-X64: .cfi_endproc 3766 3767; MSVC-I386-LABEL: test29a: 3768; MSVC-I386-NOT: calll @__security_check_cookie@4 3769; MSVC-I386: retl 3770 %test = alloca [4 x i8], align 1 3771 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %test) 3772 ret i32 %call 3773} 3774 3775; test29b: An array of [5 x i8] and a requested ssp-buffer-size of 5. 3776; Requires protector. 3777; Function Attrs: ssp stack-protector-buffer-size=5 3778define i32 @test29b() #4 { 3779entry: 3780; LINUX-I386-LABEL: test29b: 3781; LINUX-I386: mov{{l|q}} %gs: 3782; LINUX-I386: calll __stack_chk_fail 3783 3784; LINUX-X64-LABEL: test29b: 3785; LINUX-X64: mov{{l|q}} %fs: 3786; LINUX-X64: callq __stack_chk_fail 3787 3788; LINUX-KERNEL-X64-LABEL: test29b: 3789; LINUX-KERNEL-X64: mov{{l|q}} %gs: 3790; LINUX-KERNEL-X64: callq __stack_chk_fail 3791 3792; DARWIN-X64-LABEL: test29b: 3793; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 3794; DARWIN-X64: callq ___stack_chk_fail 3795 3796; MSVC-I386-LABEL: test29b: 3797; MSVC-I386: movl ___security_cookie, 3798; MSVC-I386: calll @__security_check_cookie@4 3799 %test = alloca [5 x i8], align 1 3800 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %test) 3801 ret i32 %call 3802} 3803 3804; test30a: An structure containing an i32 and an array of [5 x i8]. 3805; Requested ssp-buffer-size of 6. 3806; Requires no protector. 3807; Function Attrs: ssp stack-protector-buffer-size=6 3808define i32 @test30a() #5 { 3809entry: 3810; LINUX-I386-LABEL: test30a: 3811; LINUX-I386-NOT: calll __stack_chk_fail 3812; LINUX-I386: .cfi_endproc 3813 3814; LINUX-X64-LABEL: test30a: 3815; LINUX-X64-NOT: callq __stack_chk_fail 3816; LINUX-X64: .cfi_endproc 3817 3818; LINUX-KERNEL-X64-LABEL: test30a: 3819; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 3820; LINUX-KERNEL-X64: .cfi_endproc 3821 3822; DARWIN-X64-LABEL: test30a: 3823; DARWIN-X64-NOT: callq ___stack_chk_fail 3824; DARWIN-X64: .cfi_endproc 3825 3826; MSVC-I386-LABEL: test30a: 3827; MSVC-I386-NOT: calll @__security_check_cookie@4 3828; MSVC-I386: retl 3829 %test = alloca %struct.small_char, align 4 3830 %test.coerce = alloca { i64, i8 } 3831 call void @llvm.memcpy.p0.p0.i64(ptr %test.coerce, ptr %test, i64 12, i1 false) 3832 %0 = getelementptr { i64, i8 }, ptr %test.coerce, i32 0, i32 0 3833 %1 = load i64, ptr %0, align 1 3834 %2 = getelementptr { i64, i8 }, ptr %test.coerce, i32 0, i32 1 3835 %3 = load i8, ptr %2, align 1 3836 %call = call i32 (ptr, ...) @printf(ptr @.str, i64 %1, i8 %3) 3837 ret i32 %call 3838} 3839 3840; test30b: An structure containing an i32 and an array of [5 x i8]. 3841; Requested ssp-buffer-size of 5. 3842; Requires protector. 3843; Function Attrs: ssp stack-protector-buffer-size=5 3844define i32 @test30b() #4 { 3845entry: 3846; LINUX-I386-LABEL: test30b: 3847; LINUX-I386: mov{{l|q}} %gs: 3848; LINUX-I386: calll __stack_chk_fail 3849 3850; LINUX-X64-LABEL: test30b: 3851; LINUX-X64: mov{{l|q}} %fs: 3852; LINUX-X64: callq __stack_chk_fail 3853 3854; LINUX-KERNEL-X64-LABEL: test30b: 3855; LINUX-KERNEL-X64: mov{{l|q}} %gs: 3856; LINUX-KERNEL-X64: callq __stack_chk_fail 3857 3858; DARWIN-X64-LABEL: test30b: 3859; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 3860; DARWIN-X64: callq ___stack_chk_fail 3861 3862; MSVC-I386-LABEL: test30b: 3863; MSVC-I386: movl ___security_cookie, 3864; MSVC-I386: calll @__security_check_cookie@4 3865 %test = alloca %struct.small_char, align 4 3866 %test.coerce = alloca { i64, i8 } 3867 call void @llvm.memcpy.p0.p0.i64(ptr %test.coerce, ptr %test, i64 12, i1 false) 3868 %0 = getelementptr { i64, i8 }, ptr %test.coerce, i32 0, i32 0 3869 %1 = load i64, ptr %0, align 1 3870 %2 = getelementptr { i64, i8 }, ptr %test.coerce, i32 0, i32 1 3871 %3 = load i8, ptr %2, align 1 3872 %call = call i32 (ptr, ...) @printf(ptr @.str, i64 %1, i8 %3) 3873 ret i32 %call 3874} 3875 3876; test31a: An alloca of size 5. 3877; Requested ssp-buffer-size of 6. 3878; Requires no protector. 3879; Function Attrs: ssp stack-protector-buffer-size=6 3880define i32 @test31a() #5 { 3881entry: 3882; LINUX-I386-LABEL: test31a: 3883; LINUX-I386-NOT: calll __stack_chk_fail 3884; LINUX-I386: .cfi_endproc 3885 3886; LINUX-X64-LABEL: test31a: 3887; LINUX-X64-NOT: callq __stack_chk_fail 3888; LINUX-X64: .cfi_endproc 3889 3890; LINUX-KERNEL-X64-LABEL: test31a: 3891; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail 3892; LINUX-KERNEL-X64: .cfi_endproc 3893 3894; DARWIN-X64-LABEL: test31a: 3895; DARWIN-X64-NOT: callq ___stack_chk_fail 3896; DARWIN-X64: .cfi_endproc 3897 3898; MSVC-I386-LABEL: test31a: 3899; MSVC-I386-NOT: calll @__security_check_cookie@4 3900; MSVC-I386: retl 3901 %test = alloca ptr, align 8 3902 %0 = alloca i8, i64 4 3903 store ptr %0, ptr %test, align 8 3904 %1 = load ptr, ptr %test, align 8 3905 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %1) 3906 ret i32 %call 3907} 3908 3909; test31b: An alloca of size 5. 3910; Requested ssp-buffer-size of 5. 3911; Requires protector. 3912define i32 @test31b() #4 { 3913entry: 3914; LINUX-I386-LABEL: test31b: 3915; LINUX-I386: mov{{l|q}} %gs: 3916; LINUX-I386: calll __stack_chk_fail 3917 3918; LINUX-X64-LABEL: test31b: 3919; LINUX-X64: mov{{l|q}} %fs: 3920; LINUX-X64: callq __stack_chk_fail 3921 3922; LINUX-KERNEL-X64-LABEL: test31b: 3923; LINUX-KERNEL-X64: mov{{l|q}} %gs: 3924; LINUX-KERNEL-X64: callq __stack_chk_fail 3925 3926; DARWIN-X64-LABEL: test31b: 3927; DARWIN-X64: mov{{l|q}} ___stack_chk_guard 3928; DARWIN-X64: callq ___stack_chk_fail 3929 3930; MSVC-I386-LABEL: test31b: 3931; MSVC-I386: movl ___security_cookie, 3932; MSVC-I386: calll @__security_check_cookie@4 3933 %test = alloca ptr, align 8 3934 %0 = alloca i8, i64 5 3935 store ptr %0, ptr %test, align 8 3936 %1 = load ptr, ptr %test, align 8 3937 %call = call i32 (ptr, ...) @printf(ptr @.str, ptr %1) 3938 ret i32 %call 3939} 3940 3941define void @__stack_chk_fail() #1 !dbg !6 { 3942entry: 3943 ret void 3944} 3945 3946define void @test32() #1 !dbg !7 { 3947entry: 3948; LINUX-I386-LABEL: test32: 3949; LINUX-I386: .loc 1 4 2 prologue_end 3950; LINUX-I386: .loc 1 0 0 3951; LINUX-I386-NEXT: calll __stack_chk_fail 3952 3953; LINUX-X64-LABEL: test32: 3954; LINUX-X64: .loc 1 4 2 prologue_end 3955; LINUX-X64: .loc 1 0 0 3956; LINUX-X64-NEXT: callq __stack_chk_fail 3957 3958; LINUX-KERNEL-X64-LABEL: test32: 3959; LINUX-KERNEL-X64: .loc 1 4 2 prologue_end 3960; LINUX-KERNEL-X64: .loc 1 0 0 3961; LINUX-KERNEL-X64-NEXT: callq __stack_chk_fail 3962 3963; OPENBSD-AMD64-LABEL: test32: 3964; OPENBSD-AMD64: .loc 1 4 2 prologue_end 3965; OPENBSD-AMD64: .loc 1 0 0 3966; OPENBSD-AMD64-NEXT: movl 3967; OPENBSD-AMD64-NEXT: callq __stack_smash_handler 3968 %0 = alloca [5 x i8], align 1 3969 ret void, !dbg !9 3970} 3971 3972define i32 @IgnoreIntrinsicTest() #1 { 3973; IGNORE_INTRIN: IgnoreIntrinsicTest: 3974 %1 = alloca i32, align 4 3975 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) 3976 store volatile i32 1, ptr %1, align 4 3977 %2 = load volatile i32, ptr %1, align 4 3978 %3 = mul nsw i32 %2, 42 3979 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) 3980 ret i32 %3 3981; IGNORE_INTRIN-NOT: callq __stack_chk_fail 3982; IGNORE_INTRIN: .cfi_endproc 3983} 3984 3985declare double @testi_aux() 3986declare ptr @strcpy(ptr, ptr) 3987declare i32 @printf(ptr, ...) 3988declare void @funcall(ptr) 3989declare void @funcall2(ptr) 3990declare void @funfloat(ptr) 3991declare void @funfloat2(ptr) 3992declare void @_Z3exceptPi(ptr) 3993declare i32 @__gxx_personality_v0(...) 3994declare ptr @getp() 3995declare i32 @dummy(...) 3996declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1) 3997declare void @llvm.lifetime.start.p0(i64, ptr nocapture) 3998declare void @llvm.lifetime.end.p0(i64, ptr nocapture) 3999 4000attributes #0 = { ssp } 4001attributes #1 = { sspstrong } 4002attributes #2 = { sspreq } 4003attributes #3 = { ssp "stack-protector-buffer-size"="33" } 4004attributes #4 = { ssp "stack-protector-buffer-size"="5" } 4005attributes #5 = { ssp "stack-protector-buffer-size"="6" } 4006 4007!llvm.dbg.cu = !{!0} 4008!llvm.module.flags = !{!3, !4} 4009!llvm.ident = !{!5} 4010 4011!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, emissionKind: FullDebug) 4012!1 = !DIFile(filename: "test.c", directory: "/tmp") 4013!2 = !{} 4014!3 = !{i32 2, !"Dwarf Version", i32 4} 4015!4 = !{i32 2, !"Debug Info Version", i32 3} 4016!5 = !{!"clang version x.y.z"} 4017!6 = distinct !DISubprogram(name: "__stack_chk_fail", scope: !1, type: !8, unit: !0) 4018!7 = distinct !DISubprogram(name: "test32", scope: !1, type: !8, unit: !0) 4019!8 = !DISubroutineType(types: !2) 4020!9 = !DILocation(line: 4, column: 2, scope: !7) 4021