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 -mtriple=x86_64-apple-darwin < %s -o - | FileCheck --check-prefix=DARWIN-X64 %s
6 %struct.foo = type { [16 x i8] }
7 %struct.foo.0 = type { [4 x i8] }
8 %struct.pair = type { i32, i32 }
9 %struct.nest = type { %struct.pair, %struct.pair }
10 %struct.vec = type { <4 x i32> }
11 %class.A = type { [2 x i8] }
12 %struct.deep = type { %union.anon }
13 %union.anon = type { %struct.anon }
14 %struct.anon = type { %struct.anon.0 }
15 %struct.anon.0 = type { %union.anon.1 }
16 %union.anon.1 = type { [2 x i8] }
17 %struct.small = type { i8 }
19 @.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
21 ; test1a: array of [16 x i8]
23 ; Requires no protector.
24 define void @test1a(i8* %a) nounwind uwtable {
27 ; LINUX-I386-NOT: calll __stack_chk_fail
28 ; LINUX-I386: .cfi_endproc
31 ; LINUX-X64-NOT: callq __stack_chk_fail
32 ; LINUX-X64: .cfi_endproc
34 ; LINUX-KERNEL-X64: test1a:
35 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
36 ; LINUX-KERNEL-X64: .cfi_endproc
39 ; DARWIN-X64-NOT: callq ___stack_chk_fail
40 ; DARWIN-X64: .cfi_endproc
41 %a.addr = alloca i8*, align 8
42 %buf = alloca [16 x i8], align 16
43 store i8* %a, i8** %a.addr, align 8
44 %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
45 %0 = load i8** %a.addr, align 8
46 %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
47 %arraydecay1 = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
48 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1)
52 ; test1b: array of [16 x i8]
55 define void @test1b(i8* %a) nounwind uwtable ssp {
58 ; LINUX-I386: mov{{l|q}} %gs:
59 ; LINUX-I386: calll __stack_chk_fail
62 ; LINUX-X64: mov{{l|q}} %fs:
63 ; LINUX-X64: callq __stack_chk_fail
65 ; LINUX-KERNEL-X64: test1b:
66 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
67 ; LINUX-KERNEL-X64: callq __stack_chk_fail
70 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
71 ; DARWIN-X64: callq ___stack_chk_fail
72 %a.addr = alloca i8*, align 8
73 %buf = alloca [16 x i8], align 16
74 store i8* %a, i8** %a.addr, align 8
75 %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
76 %0 = load i8** %a.addr, align 8
77 %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
78 %arraydecay1 = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
79 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1)
83 ; test1c: array of [16 x i8]
86 define void @test1c(i8* %a) nounwind uwtable sspstrong {
89 ; LINUX-I386: mov{{l|q}} %gs:
90 ; LINUX-I386: calll __stack_chk_fail
93 ; LINUX-X64: mov{{l|q}} %fs:
94 ; LINUX-X64: callq __stack_chk_fail
96 ; LINUX-KERNEL-X64: test1c:
97 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
98 ; LINUX-KERNEL-X64: callq __stack_chk_fail
100 ; DARWIN-X64: test1c:
101 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
102 ; DARWIN-X64: callq ___stack_chk_fail
103 %a.addr = alloca i8*, align 8
104 %buf = alloca [16 x i8], align 16
105 store i8* %a, i8** %a.addr, align 8
106 %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
107 %0 = load i8** %a.addr, align 8
108 %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
109 %arraydecay1 = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
110 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1)
114 ; test1d: array of [16 x i8]
116 ; Requires protector.
117 define void @test1d(i8* %a) nounwind uwtable sspreq {
119 ; LINUX-I386: test1d:
120 ; LINUX-I386: mov{{l|q}} %gs:
121 ; LINUX-I386: calll __stack_chk_fail
124 ; LINUX-X64: mov{{l|q}} %fs:
125 ; LINUX-X64: callq __stack_chk_fail
127 ; LINUX-KERNEL-X64: test1d:
128 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
129 ; LINUX-KERNEL-X64: callq __stack_chk_fail
131 ; DARWIN-X64: test1d:
132 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
133 ; DARWIN-X64: callq ___stack_chk_fail
134 %a.addr = alloca i8*, align 8
135 %buf = alloca [16 x i8], align 16
136 store i8* %a, i8** %a.addr, align 8
137 %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
138 %0 = load i8** %a.addr, align 8
139 %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
140 %arraydecay1 = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
141 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1)
145 ; test2a: struct { [16 x i8] }
147 ; Requires no protector.
148 define void @test2a(i8* %a) nounwind uwtable {
150 ; LINUX-I386: test2a:
151 ; LINUX-I386-NOT: calll __stack_chk_fail
152 ; LINUX-I386: .cfi_endproc
155 ; LINUX-X64-NOT: callq __stack_chk_fail
156 ; LINUX-X64: .cfi_endproc
158 ; LINUX-KERNEL-X64: test2a:
159 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
160 ; LINUX-KERNEL-X64: .cfi_endproc
162 ; DARWIN-X64: test2a:
163 ; DARWIN-X64-NOT: callq ___stack_chk_fail
164 ; DARWIN-X64: .cfi_endproc
165 %a.addr = alloca i8*, align 8
166 %b = alloca %struct.foo, align 1
167 store i8* %a, i8** %a.addr, align 8
168 %buf = getelementptr inbounds %struct.foo* %b, i32 0, i32 0
169 %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
170 %0 = load i8** %a.addr, align 8
171 %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
172 %buf1 = getelementptr inbounds %struct.foo* %b, i32 0, i32 0
173 %arraydecay2 = getelementptr inbounds [16 x i8]* %buf1, i32 0, i32 0
174 %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2)
178 ; test2b: struct { [16 x i8] }
180 ; Requires protector.
181 define void @test2b(i8* %a) nounwind uwtable ssp {
183 ; LINUX-I386: test2b:
184 ; LINUX-I386: mov{{l|q}} %gs:
185 ; LINUX-I386: calll __stack_chk_fail
188 ; LINUX-X64: mov{{l|q}} %fs:
189 ; LINUX-X64: callq __stack_chk_fail
191 ; LINUX-KERNEL-X64: test2b:
192 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
193 ; LINUX-KERNEL-X64: callq __stack_chk_fail
195 ; DARWIN-X64: test2b:
196 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
197 ; DARWIN-X64: callq ___stack_chk_fail
198 %a.addr = alloca i8*, align 8
199 %b = alloca %struct.foo, align 1
200 store i8* %a, i8** %a.addr, align 8
201 %buf = getelementptr inbounds %struct.foo* %b, i32 0, i32 0
202 %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
203 %0 = load i8** %a.addr, align 8
204 %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
205 %buf1 = getelementptr inbounds %struct.foo* %b, i32 0, i32 0
206 %arraydecay2 = getelementptr inbounds [16 x i8]* %buf1, i32 0, i32 0
207 %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2)
211 ; test2c: struct { [16 x i8] }
212 ; sspstrong attribute
213 ; Requires protector.
214 define void @test2c(i8* %a) nounwind uwtable sspstrong {
216 ; LINUX-I386: test2c:
217 ; LINUX-I386: mov{{l|q}} %gs:
218 ; LINUX-I386: calll __stack_chk_fail
221 ; LINUX-X64: mov{{l|q}} %fs:
222 ; LINUX-X64: callq __stack_chk_fail
224 ; LINUX-KERNEL-X64: test2c:
225 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
226 ; LINUX-KERNEL-X64: callq __stack_chk_fail
228 ; DARWIN-X64: test2c:
229 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
230 ; DARWIN-X64: callq ___stack_chk_fail
231 %a.addr = alloca i8*, align 8
232 %b = alloca %struct.foo, align 1
233 store i8* %a, i8** %a.addr, align 8
234 %buf = getelementptr inbounds %struct.foo* %b, i32 0, i32 0
235 %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
236 %0 = load i8** %a.addr, align 8
237 %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
238 %buf1 = getelementptr inbounds %struct.foo* %b, i32 0, i32 0
239 %arraydecay2 = getelementptr inbounds [16 x i8]* %buf1, i32 0, i32 0
240 %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2)
244 ; test2d: struct { [16 x i8] }
246 ; Requires protector.
247 define void @test2d(i8* %a) nounwind uwtable sspreq {
249 ; LINUX-I386: test2d:
250 ; LINUX-I386: mov{{l|q}} %gs:
251 ; LINUX-I386: calll __stack_chk_fail
254 ; LINUX-X64: mov{{l|q}} %fs:
255 ; LINUX-X64: callq __stack_chk_fail
257 ; LINUX-KERNEL-X64: test2d:
258 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
259 ; LINUX-KERNEL-X64: callq __stack_chk_fail
261 ; DARWIN-X64: test2d:
262 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
263 ; DARWIN-X64: callq ___stack_chk_fail
264 %a.addr = alloca i8*, align 8
265 %b = alloca %struct.foo, align 1
266 store i8* %a, i8** %a.addr, align 8
267 %buf = getelementptr inbounds %struct.foo* %b, i32 0, i32 0
268 %arraydecay = getelementptr inbounds [16 x i8]* %buf, i32 0, i32 0
269 %0 = load i8** %a.addr, align 8
270 %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
271 %buf1 = getelementptr inbounds %struct.foo* %b, i32 0, i32 0
272 %arraydecay2 = getelementptr inbounds [16 x i8]* %buf1, i32 0, i32 0
273 %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2)
277 ; test3a: array of [4 x i8]
279 ; Requires no protector.
280 define void @test3a(i8* %a) nounwind uwtable {
282 ; LINUX-I386: test3a:
283 ; LINUX-I386-NOT: calll __stack_chk_fail
284 ; LINUX-I386: .cfi_endproc
287 ; LINUX-X64-NOT: callq __stack_chk_fail
288 ; LINUX-X64: .cfi_endproc
290 ; LINUX-KERNEL-X64: test3a:
291 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
292 ; LINUX-KERNEL-X64: .cfi_endproc
294 ; DARWIN-X64: test3a:
295 ; DARWIN-X64-NOT: callq ___stack_chk_fail
296 ; DARWIN-X64: .cfi_endproc
297 %a.addr = alloca i8*, align 8
298 %buf = alloca [4 x i8], align 1
299 store i8* %a, i8** %a.addr, align 8
300 %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
301 %0 = load i8** %a.addr, align 8
302 %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
303 %arraydecay1 = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
304 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1)
308 ; test3b: array [4 x i8]
310 ; Requires no protector.
311 define void @test3b(i8* %a) nounwind uwtable ssp {
313 ; LINUX-I386: test3b:
314 ; LINUX-I386-NOT: calll __stack_chk_fail
315 ; LINUX-I386: .cfi_endproc
318 ; LINUX-X64-NOT: callq __stack_chk_fail
319 ; LINUX-X64: .cfi_endproc
321 ; LINUX-KERNEL-X64: test3b:
322 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
323 ; LINUX-KERNEL-X64: .cfi_endproc
325 ; DARWIN-X64: test3b:
326 ; DARWIN-X64-NOT: callq ___stack_chk_fail
327 ; DARWIN-X64: .cfi_endproc
328 %a.addr = alloca i8*, align 8
329 %buf = alloca [4 x i8], align 1
330 store i8* %a, i8** %a.addr, align 8
331 %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
332 %0 = load i8** %a.addr, align 8
333 %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
334 %arraydecay1 = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
335 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1)
339 ; test3c: array of [4 x i8]
340 ; sspstrong attribute
341 ; Requires protector.
342 define void @test3c(i8* %a) nounwind uwtable sspstrong {
344 ; LINUX-I386: test3c:
345 ; LINUX-I386: mov{{l|q}} %gs:
346 ; LINUX-I386: calll __stack_chk_fail
349 ; LINUX-X64: mov{{l|q}} %fs:
350 ; LINUX-X64: callq __stack_chk_fail
352 ; LINUX-KERNEL-X64: test3c:
353 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
354 ; LINUX-KERNEL-X64: callq __stack_chk_fail
356 ; DARWIN-X64: test3c:
357 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
358 ; DARWIN-X64: callq ___stack_chk_fail
359 %a.addr = alloca i8*, align 8
360 %buf = alloca [4 x i8], align 1
361 store i8* %a, i8** %a.addr, align 8
362 %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
363 %0 = load i8** %a.addr, align 8
364 %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
365 %arraydecay1 = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
366 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1)
370 ; test3d: array of [4 x i8]
372 ; Requires protector.
373 define void @test3d(i8* %a) nounwind uwtable sspreq {
375 ; LINUX-I386: test3d:
376 ; LINUX-I386: mov{{l|q}} %gs:
377 ; LINUX-I386: calll __stack_chk_fail
380 ; LINUX-X64: mov{{l|q}} %fs:
381 ; LINUX-X64: callq __stack_chk_fail
383 ; LINUX-KERNEL-X64: test3d:
384 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
385 ; LINUX-KERNEL-X64: callq __stack_chk_fail
387 ; DARWIN-X64: test3d:
388 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
389 ; DARWIN-X64: callq ___stack_chk_fail
390 %a.addr = alloca i8*, align 8
391 %buf = alloca [4 x i8], align 1
392 store i8* %a, i8** %a.addr, align 8
393 %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
394 %0 = load i8** %a.addr, align 8
395 %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
396 %arraydecay1 = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
397 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay1)
401 ; test4a: struct { [4 x i8] }
403 ; Requires no protector.
404 define void @test4a(i8* %a) nounwind uwtable {
406 ; LINUX-I386: test4a:
407 ; LINUX-I386-NOT: calll __stack_chk_fail
408 ; LINUX-I386: .cfi_endproc
411 ; LINUX-X64-NOT: callq __stack_chk_fail
412 ; LINUX-X64: .cfi_endproc
414 ; LINUX-KERNEL-X64: test4a:
415 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
416 ; LINUX-KERNEL-X64: .cfi_endproc
418 ; DARWIN-X64: test4a:
419 ; DARWIN-X64-NOT: callq ___stack_chk_fail
420 ; DARWIN-X64: .cfi_endproc
421 %a.addr = alloca i8*, align 8
422 %b = alloca %struct.foo.0, align 1
423 store i8* %a, i8** %a.addr, align 8
424 %buf = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0
425 %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
426 %0 = load i8** %a.addr, align 8
427 %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
428 %buf1 = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0
429 %arraydecay2 = getelementptr inbounds [4 x i8]* %buf1, i32 0, i32 0
430 %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2)
434 ; test4b: struct { [4 x i8] }
436 ; Requires no protector.
437 define void @test4b(i8* %a) nounwind uwtable ssp {
439 ; LINUX-I386: test4b:
440 ; LINUX-I386-NOT: calll __stack_chk_fail
441 ; LINUX-I386: .cfi_endproc
444 ; LINUX-X64-NOT: callq __stack_chk_fail
445 ; LINUX-X64: .cfi_endproc
447 ; LINUX-KERNEL-X64: test4b:
448 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
449 ; LINUX-KERNEL-X64: .cfi_endproc
451 ; DARWIN-X64: test4b:
452 ; DARWIN-X64-NOT: callq ___stack_chk_fail
453 ; DARWIN-X64: .cfi_endproc
454 %a.addr = alloca i8*, align 8
455 %b = alloca %struct.foo.0, align 1
456 store i8* %a, i8** %a.addr, align 8
457 %buf = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0
458 %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
459 %0 = load i8** %a.addr, align 8
460 %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
461 %buf1 = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0
462 %arraydecay2 = getelementptr inbounds [4 x i8]* %buf1, i32 0, i32 0
463 %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2)
467 ; test4c: struct { [4 x i8] }
468 ; sspstrong attribute
469 ; Requires protector.
470 define void @test4c(i8* %a) nounwind uwtable sspstrong {
472 ; LINUX-I386: test4c:
473 ; LINUX-I386: mov{{l|q}} %gs:
474 ; LINUX-I386: calll __stack_chk_fail
477 ; LINUX-X64: mov{{l|q}} %fs:
478 ; LINUX-X64: callq __stack_chk_fail
480 ; LINUX-KERNEL-X64: test4c:
481 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
482 ; LINUX-KERNEL-X64: callq __stack_chk_fail
484 ; DARWIN-X64: test4c:
485 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
486 ; DARWIN-X64: callq ___stack_chk_fail
487 %a.addr = alloca i8*, align 8
488 %b = alloca %struct.foo.0, align 1
489 store i8* %a, i8** %a.addr, align 8
490 %buf = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0
491 %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
492 %0 = load i8** %a.addr, align 8
493 %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
494 %buf1 = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0
495 %arraydecay2 = getelementptr inbounds [4 x i8]* %buf1, i32 0, i32 0
496 %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2)
500 ; test4d: struct { [4 x i8] }
502 ; Requires protector.
503 define void @test4d(i8* %a) nounwind uwtable sspreq {
505 ; LINUX-I386: test4d:
506 ; LINUX-I386: mov{{l|q}} %gs:
507 ; LINUX-I386: calll __stack_chk_fail
510 ; LINUX-X64: mov{{l|q}} %fs:
511 ; LINUX-X64: callq __stack_chk_fail
513 ; LINUX-KERNEL-X64: test4d:
514 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
515 ; LINUX-KERNEL-X64: callq __stack_chk_fail
517 ; DARWIN-X64: test4d:
518 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
519 ; DARWIN-X64: callq ___stack_chk_fail
520 %a.addr = alloca i8*, align 8
521 %b = alloca %struct.foo.0, align 1
522 store i8* %a, i8** %a.addr, align 8
523 %buf = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0
524 %arraydecay = getelementptr inbounds [4 x i8]* %buf, i32 0, i32 0
525 %0 = load i8** %a.addr, align 8
526 %call = call i8* @strcpy(i8* %arraydecay, i8* %0)
527 %buf1 = getelementptr inbounds %struct.foo.0* %b, i32 0, i32 0
528 %arraydecay2 = getelementptr inbounds [4 x i8]* %buf1, i32 0, i32 0
529 %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %arraydecay2)
533 ; test5a: no arrays / no nested arrays
535 ; Requires no protector.
536 define void @test5a(i8* %a) nounwind uwtable {
538 ; LINUX-I386: test5a:
539 ; LINUX-I386-NOT: calll __stack_chk_fail
540 ; LINUX-I386: .cfi_endproc
543 ; LINUX-X64-NOT: callq __stack_chk_fail
544 ; LINUX-X64: .cfi_endproc
546 ; LINUX-KERNEL-X64: test5a:
547 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
548 ; LINUX-KERNEL-X64: .cfi_endproc
550 ; DARWIN-X64: test5a:
551 ; DARWIN-X64-NOT: callq ___stack_chk_fail
552 ; DARWIN-X64: .cfi_endproc
553 %a.addr = alloca i8*, align 8
554 store i8* %a, i8** %a.addr, align 8
555 %0 = load i8** %a.addr, align 8
556 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %0)
560 ; test5b: no arrays / no nested arrays
562 ; Requires no protector.
563 define void @test5b(i8* %a) nounwind uwtable ssp {
565 ; LINUX-I386: test5b:
566 ; LINUX-I386-NOT: calll __stack_chk_fail
567 ; LINUX-I386: .cfi_endproc
570 ; LINUX-X64-NOT: callq __stack_chk_fail
571 ; LINUX-X64: .cfi_endproc
573 ; LINUX-KERNEL-X64: test5b:
574 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
575 ; LINUX-KERNEL-X64: .cfi_endproc
577 ; DARWIN-X64: test5b:
578 ; DARWIN-X64-NOT: callq ___stack_chk_fail
579 ; DARWIN-X64: .cfi_endproc
580 %a.addr = alloca i8*, align 8
581 store i8* %a, i8** %a.addr, align 8
582 %0 = load i8** %a.addr, align 8
583 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %0)
587 ; test5c: no arrays / no nested arrays
588 ; sspstrong attribute
589 ; Requires no protector.
590 define void @test5c(i8* %a) nounwind uwtable sspstrong {
592 ; LINUX-I386: test5c:
593 ; LINUX-I386-NOT: calll __stack_chk_fail
594 ; LINUX-I386: .cfi_endproc
597 ; LINUX-X64-NOT: callq __stack_chk_fail
598 ; LINUX-X64: .cfi_endproc
600 ; LINUX-KERNEL-X64: test5c:
601 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
602 ; LINUX-KERNEL-X64: .cfi_endproc
604 ; DARWIN-X64: test5c:
605 ; DARWIN-X64-NOT: callq ___stack_chk_fail
606 ; DARWIN-X64: .cfi_endproc
607 %a.addr = alloca i8*, align 8
608 store i8* %a, i8** %a.addr, align 8
609 %0 = load i8** %a.addr, align 8
610 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %0)
614 ; test5d: no arrays / no nested arrays
616 ; Requires protector.
617 define void @test5d(i8* %a) nounwind uwtable sspreq {
619 ; LINUX-I386: test5d:
620 ; LINUX-I386: mov{{l|q}} %gs:
621 ; LINUX-I386: calll __stack_chk_fail
624 ; LINUX-X64: mov{{l|q}} %fs:
625 ; LINUX-X64: callq __stack_chk_fail
627 ; LINUX-KERNEL-X64: test5d:
628 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
629 ; LINUX-KERNEL-X64: callq __stack_chk_fail
631 ; DARWIN-X64: test5d:
632 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
633 ; DARWIN-X64: callq ___stack_chk_fail
634 %a.addr = alloca i8*, align 8
635 store i8* %a, i8** %a.addr, align 8
636 %0 = load i8** %a.addr, align 8
637 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* %0)
641 ; test6a: Address-of local taken (j = &a)
643 ; Requires no protector.
644 define void @test6a() nounwind uwtable {
646 ; LINUX-I386: test6a:
647 ; LINUX-I386-NOT: calll __stack_chk_fail
648 ; LINUX-I386: .cfi_endproc
651 ; LINUX-X64-NOT: callq __stack_chk_fail
652 ; LINUX-X64: .cfi_endproc
654 ; LINUX-KERNEL-X64: test6a:
655 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
656 ; LINUX-KERNEL-X64: .cfi_endproc
658 ; DARWIN-X64: test6a:
659 ; DARWIN-X64-NOT: callq ___stack_chk_fail
660 ; DARWIN-X64: .cfi_endproc
661 %retval = alloca i32, align 4
662 %a = alloca i32, align 4
663 %j = alloca i32*, align 8
664 store i32 0, i32* %retval
665 %0 = load i32* %a, align 4
666 %add = add nsw i32 %0, 1
667 store i32 %add, i32* %a, align 4
668 store i32* %a, i32** %j, align 8
672 ; test6b: Address-of local taken (j = &a)
674 ; Requires no protector.
675 define void @test6b() nounwind uwtable ssp {
677 ; LINUX-I386: test6b:
678 ; LINUX-I386-NOT: calll __stack_chk_fail
679 ; LINUX-I386: .cfi_endproc
682 ; LINUX-X64-NOT: callq __stack_chk_fail
683 ; LINUX-X64: .cfi_endproc
685 ; LINUX-KERNEL-X64: test6b:
686 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
687 ; LINUX-KERNEL-X64: .cfi_endproc
689 ; DARWIN-X64: test6b:
690 ; DARWIN-X64-NOT: callq ___stack_chk_fail
691 ; DARWIN-X64: .cfi_endproc
692 %retval = alloca i32, align 4
693 %a = alloca i32, align 4
694 %j = alloca i32*, align 8
695 store i32 0, i32* %retval
696 %0 = load i32* %a, align 4
697 %add = add nsw i32 %0, 1
698 store i32 %add, i32* %a, align 4
699 store i32* %a, i32** %j, align 8
703 ; test6c: Address-of local taken (j = &a)
704 ; sspstrong attribute
705 ; Requires protector.
706 define void @test6c() nounwind uwtable sspstrong {
708 ; LINUX-I386: test6c:
709 ; LINUX-I386: mov{{l|q}} %gs:
710 ; LINUX-I386: calll __stack_chk_fail
713 ; LINUX-X64: mov{{l|q}} %fs:
714 ; LINUX-X64: callq __stack_chk_fail
716 ; LINUX-KERNEL-X64: test6c:
717 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
718 ; LINUX-KERNEL-X64: callq __stack_chk_fail
720 ; DARWIN-X64: test6c:
721 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
722 ; DARWIN-X64: callq ___stack_chk_fail
723 %retval = alloca i32, align 4
724 %a = alloca i32, align 4
725 %j = alloca i32*, align 8
726 store i32 0, i32* %retval
727 %0 = load i32* %a, align 4
728 %add = add nsw i32 %0, 1
729 store i32 %add, i32* %a, align 4
730 store i32* %a, i32** %j, align 8
734 ; test6d: Address-of local taken (j = &a)
736 ; Requires protector.
737 define void @test6d() nounwind uwtable sspreq {
739 ; LINUX-I386: test6d:
740 ; LINUX-I386: mov{{l|q}} %gs:
741 ; LINUX-I386: calll __stack_chk_fail
744 ; LINUX-X64: mov{{l|q}} %fs:
745 ; LINUX-X64: callq __stack_chk_fail
747 ; LINUX-KERNEL-X64: test6d:
748 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
749 ; LINUX-KERNEL-X64: callq __stack_chk_fail
751 ; DARWIN-X64: test6d:
752 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
753 ; DARWIN-X64: callq ___stack_chk_fail
754 %retval = alloca i32, align 4
755 %a = alloca i32, align 4
756 %j = alloca i32*, align 8
757 store i32 0, i32* %retval
758 %0 = load i32* %a, align 4
759 %add = add nsw i32 %0, 1
760 store i32 %add, i32* %a, align 4
761 store i32* %a, i32** %j, align 8
765 ; test7a: PtrToInt Cast
767 ; Requires no protector.
768 define void @test7a() nounwind uwtable readnone {
770 ; LINUX-I386: test7a:
771 ; LINUX-I386-NOT: calll __stack_chk_fail
772 ; LINUX-I386: .cfi_endproc
775 ; LINUX-X64-NOT: callq __stack_chk_fail
776 ; LINUX-X64: .cfi_endproc
778 ; LINUX-KERNEL-X64: test7a:
779 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
780 ; LINUX-KERNEL-X64: .cfi_endproc
782 ; DARWIN-X64: test7a:
783 ; DARWIN-X64-NOT: callq ___stack_chk_fail
784 ; DARWIN-X64: .cfi_endproc
785 %a = alloca i32, align 4
786 %0 = ptrtoint i32* %a to i64
787 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0)
791 ; test7b: PtrToInt Cast
793 ; Requires no protector.
794 define void @test7b() nounwind uwtable readnone ssp {
796 ; LINUX-I386: test7b:
797 ; LINUX-I386-NOT: calll __stack_chk_fail
798 ; LINUX-I386: .cfi_endproc
801 ; LINUX-X64-NOT: callq __stack_chk_fail
802 ; LINUX-X64: .cfi_endproc
804 ; LINUX-KERNEL-X64: test7b:
805 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
806 ; LINUX-KERNEL-X64: .cfi_endproc
808 ; DARWIN-X64: test7b:
809 ; DARWIN-X64-NOT: callq ___stack_chk_fail
810 ; DARWIN-X64: .cfi_endproc
811 %a = alloca i32, align 4
812 %0 = ptrtoint i32* %a to i64
813 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0)
817 ; test7c: PtrToInt Cast
818 ; sspstrong attribute
819 ; Requires protector.
820 define void @test7c() nounwind uwtable readnone sspstrong {
822 ; LINUX-I386: test7c:
823 ; LINUX-I386: mov{{l|q}} %gs:
824 ; LINUX-I386: calll __stack_chk_fail
827 ; LINUX-X64: mov{{l|q}} %fs:
828 ; LINUX-X64: callq __stack_chk_fail
830 ; LINUX-KERNEL-X64: test7c:
831 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
832 ; LINUX-KERNEL-X64: callq __stack_chk_fail
834 ; DARWIN-X64: test7c:
835 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
836 ; DARWIN-X64: callq ___stack_chk_fail
837 %a = alloca i32, align 4
838 %0 = ptrtoint i32* %a to i64
839 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0)
843 ; test7d: PtrToInt Cast
845 ; Requires protector.
846 define void @test7d() nounwind uwtable readnone sspreq {
848 ; LINUX-I386: test7d:
849 ; LINUX-I386: mov{{l|q}} %gs:
850 ; LINUX-I386: calll __stack_chk_fail
853 ; LINUX-X64: mov{{l|q}} %fs:
854 ; LINUX-X64: callq __stack_chk_fail
856 ; LINUX-KERNEL-X64: test7d:
857 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
858 ; LINUX-KERNEL-X64: callq __stack_chk_fail
860 ; DARWIN-X64: test7d:
861 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
862 ; DARWIN-X64: callq ___stack_chk_fail
863 %a = alloca i32, align 4
864 %0 = ptrtoint i32* %a to i64
865 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0)
869 ; test8a: Passing addr-of to function call
871 ; Requires no protector.
872 define void @test8a() nounwind uwtable {
874 ; LINUX-I386: test8a:
875 ; LINUX-I386-NOT: calll __stack_chk_fail
876 ; LINUX-I386: .cfi_endproc
879 ; LINUX-X64-NOT: callq __stack_chk_fail
880 ; LINUX-X64: .cfi_endproc
882 ; LINUX-KERNEL-X64: test8a:
883 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
884 ; LINUX-KERNEL-X64: .cfi_endproc
886 ; DARWIN-X64: test8a:
887 ; DARWIN-X64-NOT: callq ___stack_chk_fail
888 ; DARWIN-X64: .cfi_endproc
889 %b = alloca i32, align 4
890 call void @funcall(i32* %b) nounwind
894 ; test8b: Passing addr-of to function call
896 ; Requires no protector.
897 define void @test8b() nounwind uwtable ssp {
899 ; LINUX-I386: test8b:
900 ; LINUX-I386-NOT: calll __stack_chk_fail
901 ; LINUX-I386: .cfi_endproc
904 ; LINUX-X64-NOT: callq __stack_chk_fail
905 ; LINUX-X64: .cfi_endproc
907 ; LINUX-KERNEL-X64: test8b:
908 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
909 ; LINUX-KERNEL-X64: .cfi_endproc
911 ; DARWIN-X64: test8b:
912 ; DARWIN-X64-NOT: callq ___stack_chk_fail
913 ; DARWIN-X64: .cfi_endproc
914 %b = alloca i32, align 4
915 call void @funcall(i32* %b) nounwind
919 ; test8c: Passing addr-of to function call
920 ; sspstrong attribute
921 ; Requires protector.
922 define void @test8c() nounwind uwtable sspstrong {
924 ; LINUX-I386: test8c:
925 ; LINUX-I386: mov{{l|q}} %gs:
926 ; LINUX-I386: calll __stack_chk_fail
929 ; LINUX-X64: mov{{l|q}} %fs:
930 ; LINUX-X64: callq __stack_chk_fail
932 ; LINUX-KERNEL-X64: test8c:
933 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
934 ; LINUX-KERNEL-X64: callq __stack_chk_fail
936 ; DARWIN-X64: test8c:
937 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
938 ; DARWIN-X64: callq ___stack_chk_fail
939 %b = alloca i32, align 4
940 call void @funcall(i32* %b) nounwind
944 ; test8d: Passing addr-of to function call
946 ; Requires protector.
947 define void @test8d() nounwind uwtable sspreq {
949 ; LINUX-I386: test8d:
950 ; LINUX-I386: mov{{l|q}} %gs:
951 ; LINUX-I386: calll __stack_chk_fail
954 ; LINUX-X64: mov{{l|q}} %fs:
955 ; LINUX-X64: callq __stack_chk_fail
957 ; LINUX-KERNEL-X64: test8d:
958 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
959 ; LINUX-KERNEL-X64: callq __stack_chk_fail
961 ; DARWIN-X64: test8d:
962 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
963 ; DARWIN-X64: callq ___stack_chk_fail
964 %b = alloca i32, align 4
965 call void @funcall(i32* %b) nounwind
969 ; test9a: Addr-of in select instruction
971 ; Requires no protector.
972 define void @test9a() nounwind uwtable {
974 ; LINUX-I386: test9a:
975 ; LINUX-I386-NOT: calll __stack_chk_fail
976 ; LINUX-I386: .cfi_endproc
979 ; LINUX-X64-NOT: callq __stack_chk_fail
980 ; LINUX-X64: .cfi_endproc
982 ; LINUX-KERNEL-X64: test9a:
983 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
984 ; LINUX-KERNEL-X64: .cfi_endproc
986 ; DARWIN-X64: test9a:
987 ; DARWIN-X64-NOT: callq ___stack_chk_fail
988 ; DARWIN-X64: .cfi_endproc
989 %x = alloca double, align 8
990 %call = call double @testi_aux() nounwind
991 store double %call, double* %x, align 8
992 %cmp2 = fcmp ogt double %call, 0.000000e+00
993 %y.1 = select i1 %cmp2, double* %x, double* null
994 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), double* %y.1)
998 ; test9b: Addr-of in select instruction
1000 ; Requires no protector.
1001 define void @test9b() nounwind uwtable ssp {
1003 ; LINUX-I386: test9b:
1004 ; LINUX-I386-NOT: calll __stack_chk_fail
1005 ; LINUX-I386: .cfi_endproc
1007 ; LINUX-X64: test9b:
1008 ; LINUX-X64-NOT: callq __stack_chk_fail
1009 ; LINUX-X64: .cfi_endproc
1011 ; LINUX-KERNEL-X64: test9b:
1012 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1013 ; LINUX-KERNEL-X64: .cfi_endproc
1015 ; DARWIN-X64: test9b:
1016 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1017 ; DARWIN-X64: .cfi_endproc
1018 %x = alloca double, align 8
1019 %call = call double @testi_aux() nounwind
1020 store double %call, double* %x, align 8
1021 %cmp2 = fcmp ogt double %call, 0.000000e+00
1022 %y.1 = select i1 %cmp2, double* %x, double* null
1023 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), double* %y.1)
1027 ; test9c: Addr-of in select instruction
1028 ; sspstrong attribute
1029 ; Requires protector.
1030 define void @test9c() nounwind uwtable sspstrong {
1032 ; LINUX-I386: test9c:
1033 ; LINUX-I386: mov{{l|q}} %gs:
1034 ; LINUX-I386: calll __stack_chk_fail
1036 ; LINUX-X64: test9c:
1037 ; LINUX-X64: mov{{l|q}} %fs:
1038 ; LINUX-X64: callq __stack_chk_fail
1040 ; LINUX-KERNEL-X64: test9c:
1041 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1042 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1044 ; DARWIN-X64: test9c:
1045 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1046 ; DARWIN-X64: callq ___stack_chk_fail
1047 %x = alloca double, align 8
1048 %call = call double @testi_aux() nounwind
1049 store double %call, double* %x, align 8
1050 %cmp2 = fcmp ogt double %call, 0.000000e+00
1051 %y.1 = select i1 %cmp2, double* %x, double* null
1052 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), double* %y.1)
1056 ; test9d: Addr-of in select instruction
1058 ; Requires protector.
1059 define void @test9d() nounwind uwtable sspreq {
1061 ; LINUX-I386: test9d:
1062 ; LINUX-I386: mov{{l|q}} %gs:
1063 ; LINUX-I386: calll __stack_chk_fail
1065 ; LINUX-X64: test9d:
1066 ; LINUX-X64: mov{{l|q}} %fs:
1067 ; LINUX-X64: callq __stack_chk_fail
1069 ; LINUX-KERNEL-X64: test9d:
1070 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1071 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1073 ; DARWIN-X64: test9d:
1074 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1075 ; DARWIN-X64: callq ___stack_chk_fail
1076 %x = alloca double, align 8
1077 %call = call double @testi_aux() nounwind
1078 store double %call, double* %x, align 8
1079 %cmp2 = fcmp ogt double %call, 0.000000e+00
1080 %y.1 = select i1 %cmp2, double* %x, double* null
1081 %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), double* %y.1)
1085 ; test10a: Addr-of in phi instruction
1087 ; Requires no protector.
1088 define void @test10a() nounwind uwtable {
1090 ; LINUX-I386: test10a:
1091 ; LINUX-I386-NOT: calll __stack_chk_fail
1092 ; LINUX-I386: .cfi_endproc
1094 ; LINUX-X64: test10a:
1095 ; LINUX-X64-NOT: callq __stack_chk_fail
1096 ; LINUX-X64: .cfi_endproc
1098 ; LINUX-KERNEL-X64: test10a:
1099 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1100 ; LINUX-KERNEL-X64: .cfi_endproc
1102 ; DARWIN-X64: test10a:
1103 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1104 ; DARWIN-X64: .cfi_endproc
1105 %x = alloca double, align 8
1106 %call = call double @testi_aux() nounwind
1107 store double %call, double* %x, align 8
1108 %cmp = fcmp ogt double %call, 3.140000e+00
1109 br i1 %cmp, label %if.then, label %if.else
1111 if.then: ; preds = %entry
1112 %call1 = call double @testi_aux() nounwind
1113 store double %call1, double* %x, align 8
1116 if.else: ; preds = %entry
1117 %cmp2 = fcmp ogt double %call, 1.000000e+00
1118 br i1 %cmp2, label %if.then3, label %if.end4
1120 if.then3: ; preds = %if.else
1123 if.end4: ; preds = %if.else, %if.then3, %if.then
1124 %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ]
1125 %call5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), double* %y.0) nounwind
1129 ; test10b: Addr-of in phi instruction
1131 ; Requires no protector.
1132 define void @test10b() nounwind uwtable ssp {
1134 ; LINUX-I386: test10b:
1135 ; LINUX-I386-NOT: calll __stack_chk_fail
1136 ; LINUX-I386: .cfi_endproc
1138 ; LINUX-X64: test10b:
1139 ; LINUX-X64-NOT: callq __stack_chk_fail
1140 ; LINUX-X64: .cfi_endproc
1142 ; LINUX-KERNEL-X64: test10b:
1143 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1144 ; LINUX-KERNEL-X64: .cfi_endproc
1146 ; DARWIN-X64: test10b:
1147 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1148 ; DARWIN-X64: .cfi_endproc
1149 %x = alloca double, align 8
1150 %call = call double @testi_aux() nounwind
1151 store double %call, double* %x, align 8
1152 %cmp = fcmp ogt double %call, 3.140000e+00
1153 br i1 %cmp, label %if.then, label %if.else
1155 if.then: ; preds = %entry
1156 %call1 = call double @testi_aux() nounwind
1157 store double %call1, double* %x, align 8
1160 if.else: ; preds = %entry
1161 %cmp2 = fcmp ogt double %call, 1.000000e+00
1162 br i1 %cmp2, label %if.then3, label %if.end4
1164 if.then3: ; preds = %if.else
1167 if.end4: ; preds = %if.else, %if.then3, %if.then
1168 %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ]
1169 %call5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), double* %y.0) nounwind
1173 ; test10c: Addr-of in phi instruction
1174 ; sspstrong attribute
1175 ; Requires protector.
1176 define void @test10c() nounwind uwtable sspstrong {
1178 ; LINUX-I386: test10c:
1179 ; LINUX-I386: mov{{l|q}} %gs:
1180 ; LINUX-I386: calll __stack_chk_fail
1182 ; LINUX-X64: test10c:
1183 ; LINUX-X64: mov{{l|q}} %fs:
1184 ; LINUX-X64: callq __stack_chk_fail
1186 ; LINUX-KERNEL-X64: test10c:
1187 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1188 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1190 ; DARWIN-X64: test10c:
1191 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1192 ; DARWIN-X64: callq ___stack_chk_fail
1193 %x = alloca double, align 8
1194 %call = call double @testi_aux() nounwind
1195 store double %call, double* %x, align 8
1196 %cmp = fcmp ogt double %call, 3.140000e+00
1197 br i1 %cmp, label %if.then, label %if.else
1199 if.then: ; preds = %entry
1200 %call1 = call double @testi_aux() nounwind
1201 store double %call1, double* %x, align 8
1204 if.else: ; preds = %entry
1205 %cmp2 = fcmp ogt double %call, 1.000000e+00
1206 br i1 %cmp2, label %if.then3, label %if.end4
1208 if.then3: ; preds = %if.else
1211 if.end4: ; preds = %if.else, %if.then3, %if.then
1212 %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ]
1213 %call5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), double* %y.0) nounwind
1217 ; test10d: Addr-of in phi instruction
1219 ; Requires protector.
1220 define void @test10d() nounwind uwtable sspreq {
1222 ; LINUX-I386: test10d:
1223 ; LINUX-I386: mov{{l|q}} %gs:
1224 ; LINUX-I386: calll __stack_chk_fail
1226 ; LINUX-X64: test10d:
1227 ; LINUX-X64: mov{{l|q}} %fs:
1228 ; LINUX-X64: callq __stack_chk_fail
1230 ; LINUX-KERNEL-X64: test10d:
1231 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1232 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1234 ; DARWIN-X64: test10d:
1235 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1236 ; DARWIN-X64: callq ___stack_chk_fail
1237 %x = alloca double, align 8
1238 %call = call double @testi_aux() nounwind
1239 store double %call, double* %x, align 8
1240 %cmp = fcmp ogt double %call, 3.140000e+00
1241 br i1 %cmp, label %if.then, label %if.else
1243 if.then: ; preds = %entry
1244 %call1 = call double @testi_aux() nounwind
1245 store double %call1, double* %x, align 8
1248 if.else: ; preds = %entry
1249 %cmp2 = fcmp ogt double %call, 1.000000e+00
1250 br i1 %cmp2, label %if.then3, label %if.end4
1252 if.then3: ; preds = %if.else
1255 if.end4: ; preds = %if.else, %if.then3, %if.then
1256 %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ]
1257 %call5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), double* %y.0) nounwind
1261 ; test11a: Addr-of struct element. (GEP followed by store).
1263 ; Requires no protector.
1264 define void @test11a() nounwind uwtable {
1266 ; LINUX-I386: test11a:
1267 ; LINUX-I386-NOT: calll __stack_chk_fail
1268 ; LINUX-I386: .cfi_endproc
1270 ; LINUX-X64: test11a:
1271 ; LINUX-X64-NOT: callq __stack_chk_fail
1272 ; LINUX-X64: .cfi_endproc
1274 ; LINUX-KERNEL-X64: test11a:
1275 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1276 ; LINUX-KERNEL-X64: .cfi_endproc
1278 ; DARWIN-X64: test11a:
1279 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1280 ; DARWIN-X64: .cfi_endproc
1281 %c = alloca %struct.pair, align 4
1282 %b = alloca i32*, align 8
1283 %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1
1284 store i32* %y, i32** %b, align 8
1285 %0 = load i32** %b, align 8
1286 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32* %0)
1290 ; test11b: Addr-of struct element. (GEP followed by store).
1292 ; Requires no protector.
1293 define void @test11b() nounwind uwtable ssp {
1295 ; LINUX-I386: test11b:
1296 ; LINUX-I386-NOT: calll __stack_chk_fail
1297 ; LINUX-I386: .cfi_endproc
1299 ; LINUX-X64: test11b:
1300 ; LINUX-X64-NOT: callq __stack_chk_fail
1301 ; LINUX-X64: .cfi_endproc
1303 ; LINUX-KERNEL-X64: test11b:
1304 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1305 ; LINUX-KERNEL-X64: .cfi_endproc
1307 ; DARWIN-X64: test11b:
1308 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1309 ; DARWIN-X64: .cfi_endproc
1310 %c = alloca %struct.pair, align 4
1311 %b = alloca i32*, align 8
1312 %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1
1313 store i32* %y, i32** %b, align 8
1314 %0 = load i32** %b, align 8
1315 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32* %0)
1319 ; test11c: Addr-of struct element. (GEP followed by store).
1320 ; sspstrong attribute
1321 ; Requires protector.
1322 define void @test11c() nounwind uwtable sspstrong {
1324 ; LINUX-I386: test11c:
1325 ; LINUX-I386: mov{{l|q}} %gs:
1326 ; LINUX-I386: calll __stack_chk_fail
1328 ; LINUX-X64: test11c:
1329 ; LINUX-X64: mov{{l|q}} %fs:
1330 ; LINUX-X64: callq __stack_chk_fail
1332 ; LINUX-KERNEL-X64: test11c:
1333 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1334 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1336 ; DARWIN-X64: test11c:
1337 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1338 ; DARWIN-X64: callq ___stack_chk_fail
1339 %c = alloca %struct.pair, align 4
1340 %b = alloca i32*, align 8
1341 %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1
1342 store i32* %y, i32** %b, align 8
1343 %0 = load i32** %b, align 8
1344 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32* %0)
1348 ; test11d: Addr-of struct element. (GEP followed by store).
1350 ; Requires protector.
1351 define void @test11d() nounwind uwtable sspreq {
1353 ; LINUX-I386: test11d:
1354 ; LINUX-I386: mov{{l|q}} %gs:
1355 ; LINUX-I386: calll __stack_chk_fail
1357 ; LINUX-X64: test11d:
1358 ; LINUX-X64: mov{{l|q}} %fs:
1359 ; LINUX-X64: callq __stack_chk_fail
1361 ; LINUX-KERNEL-X64: test11d:
1362 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1363 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1365 ; DARWIN-X64: test11d:
1366 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1367 ; DARWIN-X64: callq ___stack_chk_fail
1368 %c = alloca %struct.pair, align 4
1369 %b = alloca i32*, align 8
1370 %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1
1371 store i32* %y, i32** %b, align 8
1372 %0 = load i32** %b, align 8
1373 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32* %0)
1377 ; test12a: Addr-of struct element, GEP followed by ptrtoint.
1379 ; Requires no protector.
1380 define void @test12a() nounwind uwtable {
1382 ; LINUX-I386: test12a:
1383 ; LINUX-I386-NOT: calll __stack_chk_fail
1384 ; LINUX-I386: .cfi_endproc
1386 ; LINUX-X64: test12a:
1387 ; LINUX-X64-NOT: callq __stack_chk_fail
1388 ; LINUX-X64: .cfi_endproc
1390 ; LINUX-KERNEL-X64: test12a:
1391 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1392 ; LINUX-KERNEL-X64: .cfi_endproc
1394 ; DARWIN-X64: test12a:
1395 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1396 ; DARWIN-X64: .cfi_endproc
1397 %c = alloca %struct.pair, align 4
1398 %b = alloca i32*, align 8
1399 %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1
1400 %0 = ptrtoint i32* %y to i64
1401 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0)
1405 ; test12b: Addr-of struct element, GEP followed by ptrtoint.
1407 ; Requires no protector.
1408 define void @test12b() nounwind uwtable ssp {
1410 ; LINUX-I386: test12b:
1411 ; LINUX-I386-NOT: calll __stack_chk_fail
1412 ; LINUX-I386: .cfi_endproc
1414 ; LINUX-X64: test12b:
1415 ; LINUX-X64-NOT: callq __stack_chk_fail
1416 ; LINUX-X64: .cfi_endproc
1418 ; LINUX-KERNEL-X64: test12b:
1419 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1420 ; LINUX-KERNEL-X64: .cfi_endproc
1422 ; DARWIN-X64: test12b:
1423 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1424 ; DARWIN-X64: .cfi_endproc
1425 %c = alloca %struct.pair, align 4
1426 %b = alloca i32*, align 8
1427 %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1
1428 %0 = ptrtoint i32* %y to i64
1429 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0)
1433 ; test12c: Addr-of struct element, GEP followed by ptrtoint.
1434 ; sspstrong attribute
1435 ; Requires protector.
1436 define void @test12c() nounwind uwtable sspstrong {
1438 ; LINUX-I386: test12c:
1439 ; LINUX-I386: mov{{l|q}} %gs:
1440 ; LINUX-I386: calll __stack_chk_fail
1442 ; LINUX-X64: test12c:
1443 ; LINUX-X64: mov{{l|q}} %fs:
1444 ; LINUX-X64: callq __stack_chk_fail
1446 ; LINUX-KERNEL-X64: test12c:
1447 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1448 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1450 ; DARWIN-X64: test12c:
1451 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1452 ; DARWIN-X64: callq ___stack_chk_fail
1453 %c = alloca %struct.pair, align 4
1454 %b = alloca i32*, align 8
1455 %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1
1456 %0 = ptrtoint i32* %y to i64
1457 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0)
1461 ; test12d: Addr-of struct element, GEP followed by ptrtoint.
1463 ; Requires protector.
1464 define void @test12d() nounwind uwtable sspreq {
1466 ; LINUX-I386: test12d:
1467 ; LINUX-I386: mov{{l|q}} %gs:
1468 ; LINUX-I386: calll __stack_chk_fail
1470 ; LINUX-X64: test12d:
1471 ; LINUX-X64: mov{{l|q}} %fs:
1472 ; LINUX-X64: callq __stack_chk_fail
1474 ; LINUX-KERNEL-X64: test12d:
1475 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1476 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1478 ; DARWIN-X64: test12d:
1479 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1480 ; DARWIN-X64: callq ___stack_chk_fail
1481 %c = alloca %struct.pair, align 4
1482 %b = alloca i32*, align 8
1483 %y = getelementptr inbounds %struct.pair* %c, i32 0, i32 1
1484 %0 = ptrtoint i32* %y to i64
1485 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i64 %0)
1489 ; test13a: Addr-of struct element, GEP followed by callinst.
1491 ; Requires no protector.
1492 define void @test13a() nounwind uwtable {
1494 ; LINUX-I386: test13a:
1495 ; LINUX-I386-NOT: calll __stack_chk_fail
1496 ; LINUX-I386: .cfi_endproc
1498 ; LINUX-X64: test13a:
1499 ; LINUX-X64-NOT: callq __stack_chk_fail
1500 ; LINUX-X64: .cfi_endproc
1502 ; LINUX-KERNEL-X64: test13a:
1503 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1504 ; LINUX-KERNEL-X64: .cfi_endproc
1506 ; DARWIN-X64: test13a:
1507 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1508 ; DARWIN-X64: .cfi_endproc
1509 %c = alloca %struct.pair, align 4
1510 %y = getelementptr inbounds %struct.pair* %c, i64 0, i32 1
1511 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %y) nounwind
1515 ; test13b: Addr-of struct element, GEP followed by callinst.
1517 ; Requires no protector.
1518 define void @test13b() nounwind uwtable ssp {
1520 ; LINUX-I386: test13b:
1521 ; LINUX-I386-NOT: calll __stack_chk_fail
1522 ; LINUX-I386: .cfi_endproc
1524 ; LINUX-X64: test13b:
1525 ; LINUX-X64-NOT: callq __stack_chk_fail
1526 ; LINUX-X64: .cfi_endproc
1528 ; LINUX-KERNEL-X64: test13b:
1529 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1530 ; LINUX-KERNEL-X64: .cfi_endproc
1532 ; DARWIN-X64: test13b:
1533 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1534 ; DARWIN-X64: .cfi_endproc
1535 %c = alloca %struct.pair, align 4
1536 %y = getelementptr inbounds %struct.pair* %c, i64 0, i32 1
1537 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %y) nounwind
1541 ; test13c: Addr-of struct element, GEP followed by callinst.
1542 ; sspstrong attribute
1543 ; Requires protector.
1544 define void @test13c() nounwind uwtable sspstrong {
1546 ; LINUX-I386: test13c:
1547 ; LINUX-I386: mov{{l|q}} %gs:
1548 ; LINUX-I386: calll __stack_chk_fail
1550 ; LINUX-X64: test13c:
1551 ; LINUX-X64: mov{{l|q}} %fs:
1552 ; LINUX-X64: callq __stack_chk_fail
1554 ; LINUX-KERNEL-X64: test13c:
1555 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1556 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1558 ; DARWIN-X64: test13c:
1559 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1560 ; DARWIN-X64: callq ___stack_chk_fail
1561 %c = alloca %struct.pair, align 4
1562 %y = getelementptr inbounds %struct.pair* %c, i64 0, i32 1
1563 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %y) nounwind
1567 ; test13d: Addr-of struct element, GEP followed by callinst.
1569 ; Requires protector.
1570 define void @test13d() nounwind uwtable sspreq {
1572 ; LINUX-I386: test13d:
1573 ; LINUX-I386: mov{{l|q}} %gs:
1574 ; LINUX-I386: calll __stack_chk_fail
1576 ; LINUX-X64: test13d:
1577 ; LINUX-X64: mov{{l|q}} %fs:
1578 ; LINUX-X64: callq __stack_chk_fail
1580 ; LINUX-KERNEL-X64: test13d:
1581 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1582 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1584 ; DARWIN-X64: test13d:
1585 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1586 ; DARWIN-X64: callq ___stack_chk_fail
1587 %c = alloca %struct.pair, align 4
1588 %y = getelementptr inbounds %struct.pair* %c, i64 0, i32 1
1589 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %y) nounwind
1593 ; test14a: Addr-of a local, optimized into a GEP (e.g., &a - 12)
1595 ; Requires no protector.
1596 define void @test14a() nounwind uwtable {
1598 ; LINUX-I386: test14a:
1599 ; LINUX-I386-NOT: calll __stack_chk_fail
1600 ; LINUX-I386: .cfi_endproc
1602 ; LINUX-X64: test14a:
1603 ; LINUX-X64-NOT: callq __stack_chk_fail
1604 ; LINUX-X64: .cfi_endproc
1606 ; LINUX-KERNEL-X64: test14a:
1607 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1608 ; LINUX-KERNEL-X64: .cfi_endproc
1610 ; DARWIN-X64: test14a:
1611 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1612 ; DARWIN-X64: .cfi_endproc
1613 %a = alloca i32, align 4
1614 %add.ptr5 = getelementptr inbounds i32* %a, i64 -12
1615 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) nounwind
1619 ; test14b: Addr-of a local, optimized into a GEP (e.g., &a - 12)
1621 ; Requires no protector.
1622 define void @test14b() nounwind uwtable ssp {
1624 ; LINUX-I386: test14b:
1625 ; LINUX-I386-NOT: calll __stack_chk_fail
1626 ; LINUX-I386: .cfi_endproc
1628 ; LINUX-X64: test14b:
1629 ; LINUX-X64-NOT: callq __stack_chk_fail
1630 ; LINUX-X64: .cfi_endproc
1632 ; LINUX-KERNEL-X64: test14b:
1633 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1634 ; LINUX-KERNEL-X64: .cfi_endproc
1636 ; DARWIN-X64: test14b:
1637 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1638 ; DARWIN-X64: .cfi_endproc
1639 %a = alloca i32, align 4
1640 %add.ptr5 = getelementptr inbounds i32* %a, i64 -12
1641 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) nounwind
1645 ; test14c: Addr-of a local, optimized into a GEP (e.g., &a - 12)
1646 ; sspstrong attribute
1647 ; Requires protector.
1648 define void @test14c() nounwind uwtable sspstrong {
1650 ; LINUX-I386: test14c:
1651 ; LINUX-I386: mov{{l|q}} %gs:
1652 ; LINUX-I386: calll __stack_chk_fail
1654 ; LINUX-X64: test14c:
1655 ; LINUX-X64: mov{{l|q}} %fs:
1656 ; LINUX-X64: callq __stack_chk_fail
1658 ; LINUX-KERNEL-X64: test14c:
1659 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1660 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1662 ; DARWIN-X64: test14c:
1663 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1664 ; DARWIN-X64: callq ___stack_chk_fail
1665 %a = alloca i32, align 4
1666 %add.ptr5 = getelementptr inbounds i32* %a, i64 -12
1667 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) nounwind
1671 ; test14d: Addr-of a local, optimized into a GEP (e.g., &a - 12)
1673 ; Requires protector.
1674 define void @test14d() nounwind uwtable sspreq {
1676 ; LINUX-I386: test14d:
1677 ; LINUX-I386: mov{{l|q}} %gs:
1678 ; LINUX-I386: calll __stack_chk_fail
1680 ; LINUX-X64: test14d:
1681 ; LINUX-X64: mov{{l|q}} %fs:
1682 ; LINUX-X64: callq __stack_chk_fail
1684 ; LINUX-KERNEL-X64: test14d:
1685 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1686 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1688 ; DARWIN-X64: test14d:
1689 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1690 ; DARWIN-X64: callq ___stack_chk_fail
1691 %a = alloca i32, align 4
1692 %add.ptr5 = getelementptr inbounds i32* %a, i64 -12
1693 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32* %add.ptr5) nounwind
1697 ; test15a: Addr-of a local cast to a ptr of a different type
1698 ; (e.g., int a; ... ; float *b = &a;)
1700 ; Requires no protector.
1701 define void @test15a() nounwind uwtable {
1703 ; LINUX-I386: test15a:
1704 ; LINUX-I386-NOT: calll __stack_chk_fail
1705 ; LINUX-I386: .cfi_endproc
1707 ; LINUX-X64: test15a:
1708 ; LINUX-X64-NOT: callq __stack_chk_fail
1709 ; LINUX-X64: .cfi_endproc
1711 ; LINUX-KERNEL-X64: test15a:
1712 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1713 ; LINUX-KERNEL-X64: .cfi_endproc
1715 ; DARWIN-X64: test15a:
1716 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1717 ; DARWIN-X64: .cfi_endproc
1718 %a = alloca i32, align 4
1719 %b = alloca float*, align 8
1720 store i32 0, i32* %a, align 4
1721 %0 = bitcast i32* %a to float*
1722 store float* %0, float** %b, align 8
1723 %1 = load float** %b, align 8
1724 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), float* %1)
1728 ; test15b: Addr-of a local cast to a ptr of a different type
1729 ; (e.g., int a; ... ; float *b = &a;)
1731 ; Requires no protector.
1732 define void @test15b() nounwind uwtable ssp {
1734 ; LINUX-I386: test15b:
1735 ; LINUX-I386-NOT: calll __stack_chk_fail
1736 ; LINUX-I386: .cfi_endproc
1738 ; LINUX-X64: test15b:
1739 ; LINUX-X64-NOT: callq __stack_chk_fail
1740 ; LINUX-X64: .cfi_endproc
1742 ; LINUX-KERNEL-X64: test15b:
1743 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1744 ; LINUX-KERNEL-X64: .cfi_endproc
1746 ; DARWIN-X64: test15b:
1747 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1748 ; DARWIN-X64: .cfi_endproc
1749 %a = alloca i32, align 4
1750 %b = alloca float*, align 8
1751 store i32 0, i32* %a, align 4
1752 %0 = bitcast i32* %a to float*
1753 store float* %0, float** %b, align 8
1754 %1 = load float** %b, align 8
1755 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), float* %1)
1759 ; test15c: Addr-of a local cast to a ptr of a different type
1760 ; (e.g., int a; ... ; float *b = &a;)
1761 ; sspstrong attribute
1762 ; Requires protector.
1763 define void @test15c() nounwind uwtable sspstrong {
1765 ; LINUX-I386: test15c:
1766 ; LINUX-I386: mov{{l|q}} %gs:
1767 ; LINUX-I386: calll __stack_chk_fail
1769 ; LINUX-X64: test15c:
1770 ; LINUX-X64: mov{{l|q}} %fs:
1771 ; LINUX-X64: callq __stack_chk_fail
1773 ; LINUX-KERNEL-X64: test15c:
1774 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1775 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1777 ; DARWIN-X64: test15c:
1778 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1779 ; DARWIN-X64: callq ___stack_chk_fail
1780 %a = alloca i32, align 4
1781 %b = alloca float*, align 8
1782 store i32 0, i32* %a, align 4
1783 %0 = bitcast i32* %a to float*
1784 store float* %0, float** %b, align 8
1785 %1 = load float** %b, align 8
1786 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), float* %1)
1790 ; test15d: Addr-of a local cast to a ptr of a different type
1791 ; (e.g., int a; ... ; float *b = &a;)
1793 ; Requires protector.
1794 define void @test15d() nounwind uwtable sspreq {
1796 ; LINUX-I386: test15d:
1797 ; LINUX-I386: mov{{l|q}} %gs:
1798 ; LINUX-I386: calll __stack_chk_fail
1800 ; LINUX-X64: test15d:
1801 ; LINUX-X64: mov{{l|q}} %fs:
1802 ; LINUX-X64: callq __stack_chk_fail
1804 ; LINUX-KERNEL-X64: test15d:
1805 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1806 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1808 ; DARWIN-X64: test15d:
1809 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1810 ; DARWIN-X64: callq ___stack_chk_fail
1811 %a = alloca i32, align 4
1812 %b = alloca float*, align 8
1813 store i32 0, i32* %a, align 4
1814 %0 = bitcast i32* %a to float*
1815 store float* %0, float** %b, align 8
1816 %1 = load float** %b, align 8
1817 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), float* %1)
1821 ; test16a: Addr-of a local cast to a ptr of a different type (optimized)
1822 ; (e.g., int a; ... ; float *b = &a;)
1824 ; Requires no protector.
1825 define void @test16a() nounwind uwtable {
1827 ; LINUX-I386: test16a:
1828 ; LINUX-I386-NOT: calll __stack_chk_fail
1829 ; LINUX-I386: .cfi_endproc
1831 ; LINUX-X64: test16a:
1832 ; LINUX-X64-NOT: callq __stack_chk_fail
1833 ; LINUX-X64: .cfi_endproc
1835 ; LINUX-KERNEL-X64: test16a:
1836 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1837 ; LINUX-KERNEL-X64: .cfi_endproc
1839 ; DARWIN-X64: test16a:
1840 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1841 ; DARWIN-X64: .cfi_endproc
1842 %a = alloca i32, align 4
1843 store i32 0, i32* %a, align 4
1844 %0 = bitcast i32* %a to float*
1845 call void @funfloat(float* %0) nounwind
1849 ; test16b: Addr-of a local cast to a ptr of a different type (optimized)
1850 ; (e.g., int a; ... ; float *b = &a;)
1852 ; Requires no protector.
1853 define void @test16b() nounwind uwtable ssp {
1855 ; LINUX-I386: test16b:
1856 ; LINUX-I386-NOT: calll __stack_chk_fail
1857 ; LINUX-I386: .cfi_endproc
1859 ; LINUX-X64: test16b:
1860 ; LINUX-X64-NOT: callq __stack_chk_fail
1861 ; LINUX-X64: .cfi_endproc
1863 ; LINUX-KERNEL-X64: test16b:
1864 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1865 ; LINUX-KERNEL-X64: .cfi_endproc
1867 ; DARWIN-X64: test16b:
1868 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1869 ; DARWIN-X64: .cfi_endproc
1870 %a = alloca i32, align 4
1871 store i32 0, i32* %a, align 4
1872 %0 = bitcast i32* %a to float*
1873 call void @funfloat(float* %0) nounwind
1877 ; test16c: Addr-of a local cast to a ptr of a different type (optimized)
1878 ; (e.g., int a; ... ; float *b = &a;)
1879 ; sspstrong attribute
1880 ; Requires protector.
1881 define void @test16c() nounwind uwtable sspstrong {
1883 ; LINUX-I386: test16c:
1884 ; LINUX-I386: mov{{l|q}} %gs:
1885 ; LINUX-I386: calll __stack_chk_fail
1887 ; LINUX-X64: test16c:
1888 ; LINUX-X64: mov{{l|q}} %fs:
1889 ; LINUX-X64: callq __stack_chk_fail
1891 ; LINUX-KERNEL-X64: test16c:
1892 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1893 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1895 ; DARWIN-X64: test16c:
1896 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1897 ; DARWIN-X64: callq ___stack_chk_fail
1898 %a = alloca i32, align 4
1899 store i32 0, i32* %a, align 4
1900 %0 = bitcast i32* %a to float*
1901 call void @funfloat(float* %0) nounwind
1905 ; test16d: Addr-of a local cast to a ptr of a different type (optimized)
1906 ; (e.g., int a; ... ; float *b = &a;)
1908 ; Requires protector.
1909 define void @test16d() nounwind uwtable sspreq {
1911 ; LINUX-I386: test16d:
1912 ; LINUX-I386: mov{{l|q}} %gs:
1913 ; LINUX-I386: calll __stack_chk_fail
1915 ; LINUX-X64: test16d:
1916 ; LINUX-X64: mov{{l|q}} %fs:
1917 ; LINUX-X64: callq __stack_chk_fail
1919 ; LINUX-KERNEL-X64: test16d:
1920 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
1921 ; LINUX-KERNEL-X64: callq __stack_chk_fail
1923 ; DARWIN-X64: test16d:
1924 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
1925 ; DARWIN-X64: callq ___stack_chk_fail
1926 %a = alloca i32, align 4
1927 store i32 0, i32* %a, align 4
1928 %0 = bitcast i32* %a to float*
1929 call void @funfloat(float* %0) nounwind
1933 ; test17a: Addr-of a vector nested in a struct
1935 ; Requires no protector.
1936 define void @test17a() nounwind uwtable {
1938 ; LINUX-I386: test17a:
1939 ; LINUX-I386-NOT: calll __stack_chk_fail
1940 ; LINUX-I386: .cfi_endproc
1942 ; LINUX-X64: test17a:
1943 ; LINUX-X64-NOT: callq __stack_chk_fail
1944 ; LINUX-X64: .cfi_endproc
1946 ; LINUX-KERNEL-X64: test17a:
1947 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1948 ; LINUX-KERNEL-X64: .cfi_endproc
1950 ; DARWIN-X64: test17a:
1951 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1952 ; DARWIN-X64: .cfi_endproc
1953 %c = alloca %struct.vec, align 16
1954 %y = getelementptr inbounds %struct.vec* %c, i64 0, i32 0
1955 %add.ptr = getelementptr inbounds <4 x i32>* %y, i64 -12
1956 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), <4 x i32>* %add.ptr) nounwind
1960 ; test17b: Addr-of a vector nested in a struct
1962 ; Requires no protector.
1963 define void @test17b() nounwind uwtable ssp {
1965 ; LINUX-I386: test17b:
1966 ; LINUX-I386-NOT: calll __stack_chk_fail
1967 ; LINUX-I386: .cfi_endproc
1969 ; LINUX-X64: test17b:
1970 ; LINUX-X64-NOT: callq __stack_chk_fail
1971 ; LINUX-X64: .cfi_endproc
1973 ; LINUX-KERNEL-X64: test17b:
1974 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
1975 ; LINUX-KERNEL-X64: .cfi_endproc
1977 ; DARWIN-X64: test17b:
1978 ; DARWIN-X64-NOT: callq ___stack_chk_fail
1979 ; DARWIN-X64: .cfi_endproc
1980 %c = alloca %struct.vec, align 16
1981 %y = getelementptr inbounds %struct.vec* %c, i64 0, i32 0
1982 %add.ptr = getelementptr inbounds <4 x i32>* %y, i64 -12
1983 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), <4 x i32>* %add.ptr) nounwind
1987 ; test17c: Addr-of a vector nested in a struct
1988 ; sspstrong attribute
1989 ; Requires protector.
1990 define void @test17c() nounwind uwtable sspstrong {
1992 ; LINUX-I386: test17c:
1993 ; LINUX-I386: mov{{l|q}} %gs:
1994 ; LINUX-I386: calll __stack_chk_fail
1996 ; LINUX-X64: test17c:
1997 ; LINUX-X64: mov{{l|q}} %fs:
1998 ; LINUX-X64: callq __stack_chk_fail
2000 ; LINUX-KERNEL-X64: test17c:
2001 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2002 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2004 ; DARWIN-X64: test17c:
2005 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2006 ; DARWIN-X64: callq ___stack_chk_fail
2007 %c = alloca %struct.vec, align 16
2008 %y = getelementptr inbounds %struct.vec* %c, i64 0, i32 0
2009 %add.ptr = getelementptr inbounds <4 x i32>* %y, i64 -12
2010 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), <4 x i32>* %add.ptr) nounwind
2014 ; test17d: Addr-of a vector nested in a struct
2016 ; Requires protector.
2017 define void @test17d() nounwind uwtable sspreq {
2019 ; LINUX-I386: test17d:
2020 ; LINUX-I386: mov{{l|q}} %gs:
2021 ; LINUX-I386: calll __stack_chk_fail
2023 ; LINUX-X64: test17d:
2024 ; LINUX-X64: mov{{l|q}} %fs:
2025 ; LINUX-X64: callq __stack_chk_fail
2027 ; LINUX-KERNEL-X64: test17d:
2028 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2029 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2031 ; DARWIN-X64: test17d:
2032 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2033 ; DARWIN-X64: callq ___stack_chk_fail
2034 %c = alloca %struct.vec, align 16
2035 %y = getelementptr inbounds %struct.vec* %c, i64 0, i32 0
2036 %add.ptr = getelementptr inbounds <4 x i32>* %y, i64 -12
2037 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), <4 x i32>* %add.ptr) nounwind
2041 ; test18a: Addr-of a variable passed into an invoke instruction.
2043 ; Requires no protector.
2044 define i32 @test18a() uwtable {
2046 ; LINUX-I386: test18a:
2047 ; LINUX-I386-NOT: calll __stack_chk_fail
2048 ; LINUX-I386: .cfi_endproc
2050 ; LINUX-X64: test18a:
2051 ; LINUX-X64-NOT: callq __stack_chk_fail
2052 ; LINUX-X64: .cfi_endproc
2054 ; LINUX-KERNEL-X64: test18a:
2055 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2056 ; LINUX-KERNEL-X64: .cfi_endproc
2058 ; DARWIN-X64: test18a:
2059 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2060 ; DARWIN-X64: .cfi_endproc
2061 %a = alloca i32, align 4
2062 %exn.slot = alloca i8*
2063 %ehselector.slot = alloca i32
2064 store i32 0, i32* %a, align 4
2065 invoke void @_Z3exceptPi(i32* %a)
2066 to label %invoke.cont unwind label %lpad
2072 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
2077 ; test18b: Addr-of a variable passed into an invoke instruction.
2079 ; Requires no protector.
2080 define i32 @test18b() uwtable ssp {
2082 ; LINUX-I386: test18b:
2083 ; LINUX-I386-NOT: calll __stack_chk_fail
2084 ; LINUX-I386: .cfi_endproc
2086 ; LINUX-X64: test18b:
2087 ; LINUX-X64-NOT: callq __stack_chk_fail
2088 ; LINUX-X64: .cfi_endproc
2090 ; LINUX-KERNEL-X64: test18b:
2091 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2092 ; LINUX-KERNEL-X64: .cfi_endproc
2094 ; DARWIN-X64: test18b:
2095 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2096 ; DARWIN-X64: .cfi_endproc
2097 %a = alloca i32, align 4
2098 %exn.slot = alloca i8*
2099 %ehselector.slot = alloca i32
2100 store i32 0, i32* %a, align 4
2101 invoke void @_Z3exceptPi(i32* %a)
2102 to label %invoke.cont unwind label %lpad
2108 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
2113 ; test18c: Addr-of a variable passed into an invoke instruction.
2114 ; sspstrong attribute
2115 ; Requires protector.
2116 define i32 @test18c() uwtable sspstrong {
2118 ; LINUX-I386: test18c:
2119 ; LINUX-I386: mov{{l|q}} %gs:
2120 ; LINUX-I386: calll __stack_chk_fail
2122 ; LINUX-X64: test18c:
2123 ; LINUX-X64: mov{{l|q}} %fs:
2124 ; LINUX-X64: callq __stack_chk_fail
2126 ; LINUX-KERNEL-X64: test18c:
2127 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2128 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2130 ; DARWIN-X64: test18c:
2131 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2132 ; DARWIN-X64: callq ___stack_chk_fail
2133 %a = alloca i32, align 4
2134 %exn.slot = alloca i8*
2135 %ehselector.slot = alloca i32
2136 store i32 0, i32* %a, align 4
2137 invoke void @_Z3exceptPi(i32* %a)
2138 to label %invoke.cont unwind label %lpad
2144 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
2149 ; test18d: Addr-of a variable passed into an invoke instruction.
2151 ; Requires protector.
2152 define i32 @test18d() uwtable sspreq {
2154 ; LINUX-I386: test18d:
2155 ; LINUX-I386: mov{{l|q}} %gs:
2156 ; LINUX-I386: calll __stack_chk_fail
2158 ; LINUX-X64: test18d:
2159 ; LINUX-X64: mov{{l|q}} %fs:
2160 ; LINUX-X64: callq __stack_chk_fail
2162 ; LINUX-KERNEL-X64: test18d:
2163 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2164 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2166 ; DARWIN-X64: test18d:
2167 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2168 ; DARWIN-X64: callq ___stack_chk_fail
2169 %a = alloca i32, align 4
2170 %exn.slot = alloca i8*
2171 %ehselector.slot = alloca i32
2172 store i32 0, i32* %a, align 4
2173 invoke void @_Z3exceptPi(i32* %a)
2174 to label %invoke.cont unwind label %lpad
2180 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
2185 ; test19a: Addr-of a struct element passed into an invoke instruction.
2186 ; (GEP followed by an invoke)
2188 ; Requires no protector.
2189 define i32 @test19a() uwtable {
2191 ; LINUX-I386: test19a:
2192 ; LINUX-I386-NOT: calll __stack_chk_fail
2193 ; LINUX-I386: .cfi_endproc
2195 ; LINUX-X64: test19a:
2196 ; LINUX-X64-NOT: callq __stack_chk_fail
2197 ; LINUX-X64: .cfi_endproc
2199 ; LINUX-KERNEL-X64: test19a:
2200 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2201 ; LINUX-KERNEL-X64: .cfi_endproc
2203 ; DARWIN-X64: test19a:
2204 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2205 ; DARWIN-X64: .cfi_endproc
2206 %c = alloca %struct.pair, align 4
2207 %exn.slot = alloca i8*
2208 %ehselector.slot = alloca i32
2209 %a = getelementptr inbounds %struct.pair* %c, i32 0, i32 0
2210 store i32 0, i32* %a, align 4
2211 %a1 = getelementptr inbounds %struct.pair* %c, i32 0, i32 0
2212 invoke void @_Z3exceptPi(i32* %a1)
2213 to label %invoke.cont unwind label %lpad
2219 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
2224 ; test19b: Addr-of a struct element passed into an invoke instruction.
2225 ; (GEP followed by an invoke)
2227 ; Requires no protector.
2228 define i32 @test19b() uwtable ssp {
2230 ; LINUX-I386: test19b:
2231 ; LINUX-I386-NOT: calll __stack_chk_fail
2232 ; LINUX-I386: .cfi_endproc
2234 ; LINUX-X64: test19b:
2235 ; LINUX-X64-NOT: callq __stack_chk_fail
2236 ; LINUX-X64: .cfi_endproc
2238 ; LINUX-KERNEL-X64: test19b:
2239 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2240 ; LINUX-KERNEL-X64: .cfi_endproc
2242 ; DARWIN-X64: test19b:
2243 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2244 ; DARWIN-X64: .cfi_endproc
2245 %c = alloca %struct.pair, align 4
2246 %exn.slot = alloca i8*
2247 %ehselector.slot = alloca i32
2248 %a = getelementptr inbounds %struct.pair* %c, i32 0, i32 0
2249 store i32 0, i32* %a, align 4
2250 %a1 = getelementptr inbounds %struct.pair* %c, i32 0, i32 0
2251 invoke void @_Z3exceptPi(i32* %a1)
2252 to label %invoke.cont unwind label %lpad
2258 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
2263 ; test19c: Addr-of a struct element passed into an invoke instruction.
2264 ; (GEP followed by an invoke)
2265 ; sspstrong attribute
2266 ; Requires protector.
2267 define i32 @test19c() uwtable sspstrong {
2269 ; LINUX-I386: test19c:
2270 ; LINUX-I386: mov{{l|q}} %gs:
2271 ; LINUX-I386: calll __stack_chk_fail
2273 ; LINUX-X64: test19c:
2274 ; LINUX-X64: mov{{l|q}} %fs:
2275 ; LINUX-X64: callq __stack_chk_fail
2277 ; LINUX-KERNEL-X64: test19c:
2278 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2279 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2281 ; DARWIN-X64: test19c:
2282 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2283 ; DARWIN-X64: callq ___stack_chk_fail
2284 %c = alloca %struct.pair, align 4
2285 %exn.slot = alloca i8*
2286 %ehselector.slot = alloca i32
2287 %a = getelementptr inbounds %struct.pair* %c, i32 0, i32 0
2288 store i32 0, i32* %a, align 4
2289 %a1 = getelementptr inbounds %struct.pair* %c, i32 0, i32 0
2290 invoke void @_Z3exceptPi(i32* %a1)
2291 to label %invoke.cont unwind label %lpad
2297 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
2302 ; test19d: Addr-of a struct element passed into an invoke instruction.
2303 ; (GEP followed by an invoke)
2305 ; Requires protector.
2306 define i32 @test19d() uwtable sspreq {
2308 ; LINUX-I386: test19d:
2309 ; LINUX-I386: mov{{l|q}} %gs:
2310 ; LINUX-I386: calll __stack_chk_fail
2312 ; LINUX-X64: test19d:
2313 ; LINUX-X64: mov{{l|q}} %fs:
2314 ; LINUX-X64: callq __stack_chk_fail
2316 ; LINUX-KERNEL-X64: test19d:
2317 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2318 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2320 ; DARWIN-X64: test19d:
2321 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2322 ; DARWIN-X64: callq ___stack_chk_fail
2323 %c = alloca %struct.pair, align 4
2324 %exn.slot = alloca i8*
2325 %ehselector.slot = alloca i32
2326 %a = getelementptr inbounds %struct.pair* %c, i32 0, i32 0
2327 store i32 0, i32* %a, align 4
2328 %a1 = getelementptr inbounds %struct.pair* %c, i32 0, i32 0
2329 invoke void @_Z3exceptPi(i32* %a1)
2330 to label %invoke.cont unwind label %lpad
2336 %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
2341 ; test20a: Addr-of a pointer
2343 ; Requires no protector.
2344 define void @test20a() nounwind uwtable {
2346 ; LINUX-I386: test20a:
2347 ; LINUX-I386-NOT: calll __stack_chk_fail
2348 ; LINUX-I386: .cfi_endproc
2350 ; LINUX-X64: test20a:
2351 ; LINUX-X64-NOT: callq __stack_chk_fail
2352 ; LINUX-X64: .cfi_endproc
2354 ; LINUX-KERNEL-X64: test20a:
2355 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2356 ; LINUX-KERNEL-X64: .cfi_endproc
2358 ; DARWIN-X64: test20a:
2359 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2360 ; DARWIN-X64: .cfi_endproc
2361 %a = alloca i32*, align 8
2362 %b = alloca i32**, align 8
2363 %call = call i32* @getp()
2364 store i32* %call, i32** %a, align 8
2365 store i32** %a, i32*** %b, align 8
2366 %0 = load i32*** %b, align 8
2367 call void @funcall2(i32** %0)
2371 ; test20b: Addr-of a pointer
2373 ; Requires no protector.
2374 define void @test20b() nounwind uwtable ssp {
2376 ; LINUX-I386: test20b:
2377 ; LINUX-I386-NOT: calll __stack_chk_fail
2378 ; LINUX-I386: .cfi_endproc
2380 ; LINUX-X64: test20b:
2381 ; LINUX-X64-NOT: callq __stack_chk_fail
2382 ; LINUX-X64: .cfi_endproc
2384 ; LINUX-KERNEL-X64: test20b:
2385 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2386 ; LINUX-KERNEL-X64: .cfi_endproc
2388 ; DARWIN-X64: test20b:
2389 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2390 ; DARWIN-X64: .cfi_endproc
2391 %a = alloca i32*, align 8
2392 %b = alloca i32**, align 8
2393 %call = call i32* @getp()
2394 store i32* %call, i32** %a, align 8
2395 store i32** %a, i32*** %b, align 8
2396 %0 = load i32*** %b, align 8
2397 call void @funcall2(i32** %0)
2401 ; test20c: Addr-of a pointer
2402 ; sspstrong attribute
2403 ; Requires protector.
2404 define void @test20c() nounwind uwtable sspstrong {
2406 ; LINUX-I386: test20c:
2407 ; LINUX-I386: mov{{l|q}} %gs:
2408 ; LINUX-I386: calll __stack_chk_fail
2410 ; LINUX-X64: test20c:
2411 ; LINUX-X64: mov{{l|q}} %fs:
2412 ; LINUX-X64: callq __stack_chk_fail
2414 ; LINUX-KERNEL-X64: test20c:
2415 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2416 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2418 ; DARWIN-X64: test20c:
2419 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2420 ; DARWIN-X64: callq ___stack_chk_fail
2421 %a = alloca i32*, align 8
2422 %b = alloca i32**, align 8
2423 %call = call i32* @getp()
2424 store i32* %call, i32** %a, align 8
2425 store i32** %a, i32*** %b, align 8
2426 %0 = load i32*** %b, align 8
2427 call void @funcall2(i32** %0)
2431 ; test20d: Addr-of a pointer
2433 ; Requires protector.
2434 define void @test20d() nounwind uwtable sspreq {
2436 ; LINUX-I386: test20d:
2437 ; LINUX-I386: mov{{l|q}} %gs:
2438 ; LINUX-I386: calll __stack_chk_fail
2440 ; LINUX-X64: test20d:
2441 ; LINUX-X64: mov{{l|q}} %fs:
2442 ; LINUX-X64: callq __stack_chk_fail
2444 ; LINUX-KERNEL-X64: test20d:
2445 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2446 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2448 ; DARWIN-X64: test20d:
2449 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2450 ; DARWIN-X64: callq ___stack_chk_fail
2451 %a = alloca i32*, align 8
2452 %b = alloca i32**, align 8
2453 %call = call i32* @getp()
2454 store i32* %call, i32** %a, align 8
2455 store i32** %a, i32*** %b, align 8
2456 %0 = load i32*** %b, align 8
2457 call void @funcall2(i32** %0)
2461 ; test21a: Addr-of a casted pointer
2463 ; Requires no protector.
2464 define void @test21a() nounwind uwtable {
2466 ; LINUX-I386: test21a:
2467 ; LINUX-I386-NOT: calll __stack_chk_fail
2468 ; LINUX-I386: .cfi_endproc
2470 ; LINUX-X64: test21a:
2471 ; LINUX-X64-NOT: callq __stack_chk_fail
2472 ; LINUX-X64: .cfi_endproc
2474 ; LINUX-KERNEL-X64: test21a:
2475 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2476 ; LINUX-KERNEL-X64: .cfi_endproc
2478 ; DARWIN-X64: test21a:
2479 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2480 ; DARWIN-X64: .cfi_endproc
2481 %a = alloca i32*, align 8
2482 %b = alloca float**, align 8
2483 %call = call i32* @getp()
2484 store i32* %call, i32** %a, align 8
2485 %0 = bitcast i32** %a to float**
2486 store float** %0, float*** %b, align 8
2487 %1 = load float*** %b, align 8
2488 call void @funfloat2(float** %1)
2492 ; test21b: Addr-of a casted pointer
2494 ; Requires no protector.
2495 define void @test21b() nounwind uwtable ssp {
2497 ; LINUX-I386: test21b:
2498 ; LINUX-I386-NOT: calll __stack_chk_fail
2499 ; LINUX-I386: .cfi_endproc
2501 ; LINUX-X64: test21b:
2502 ; LINUX-X64-NOT: callq __stack_chk_fail
2503 ; LINUX-X64: .cfi_endproc
2505 ; LINUX-KERNEL-X64: test21b:
2506 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2507 ; LINUX-KERNEL-X64: .cfi_endproc
2509 ; DARWIN-X64: test21b:
2510 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2511 ; DARWIN-X64: .cfi_endproc
2512 %a = alloca i32*, align 8
2513 %b = alloca float**, align 8
2514 %call = call i32* @getp()
2515 store i32* %call, i32** %a, align 8
2516 %0 = bitcast i32** %a to float**
2517 store float** %0, float*** %b, align 8
2518 %1 = load float*** %b, align 8
2519 call void @funfloat2(float** %1)
2523 ; test21c: Addr-of a casted pointer
2524 ; sspstrong attribute
2525 ; Requires protector.
2526 define void @test21c() nounwind uwtable sspstrong {
2528 ; LINUX-I386: test21c:
2529 ; LINUX-I386: mov{{l|q}} %gs:
2530 ; LINUX-I386: calll __stack_chk_fail
2532 ; LINUX-X64: test21c:
2533 ; LINUX-X64: mov{{l|q}} %fs:
2534 ; LINUX-X64: callq __stack_chk_fail
2536 ; LINUX-KERNEL-X64: test21c:
2537 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2538 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2540 ; DARWIN-X64: test21c:
2541 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2542 ; DARWIN-X64: callq ___stack_chk_fail
2543 %a = alloca i32*, align 8
2544 %b = alloca float**, align 8
2545 %call = call i32* @getp()
2546 store i32* %call, i32** %a, align 8
2547 %0 = bitcast i32** %a to float**
2548 store float** %0, float*** %b, align 8
2549 %1 = load float*** %b, align 8
2550 call void @funfloat2(float** %1)
2554 ; test21d: Addr-of a casted pointer
2556 ; Requires protector.
2557 define void @test21d() nounwind uwtable sspreq {
2559 ; LINUX-I386: test21d:
2560 ; LINUX-I386: mov{{l|q}} %gs:
2561 ; LINUX-I386: calll __stack_chk_fail
2563 ; LINUX-X64: test21d:
2564 ; LINUX-X64: mov{{l|q}} %fs:
2565 ; LINUX-X64: callq __stack_chk_fail
2567 ; LINUX-KERNEL-X64: test21d:
2568 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2569 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2571 ; DARWIN-X64: test21d:
2572 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2573 ; DARWIN-X64: callq ___stack_chk_fail
2574 %a = alloca i32*, align 8
2575 %b = alloca float**, align 8
2576 %call = call i32* @getp()
2577 store i32* %call, i32** %a, align 8
2578 %0 = bitcast i32** %a to float**
2579 store float** %0, float*** %b, align 8
2580 %1 = load float*** %b, align 8
2581 call void @funfloat2(float** %1)
2585 ; test22a: [2 x i8] in a class
2587 ; Requires no protector.
2588 define signext i8 @test22a() nounwind uwtable {
2590 ; LINUX-I386: test22a:
2591 ; LINUX-I386-NOT: calll __stack_chk_fail
2592 ; LINUX-I386: .cfi_endproc
2594 ; LINUX-X64: test22a:
2595 ; LINUX-X64-NOT: callq __stack_chk_fail
2596 ; LINUX-X64: .cfi_endproc
2598 ; LINUX-KERNEL-X64: test22a:
2599 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2600 ; LINUX-KERNEL-X64: .cfi_endproc
2602 ; DARWIN-X64: test22a:
2603 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2604 ; DARWIN-X64: .cfi_endproc
2605 %a = alloca %class.A, align 1
2606 %array = getelementptr inbounds %class.A* %a, i32 0, i32 0
2607 %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0
2608 %0 = load i8* %arrayidx, align 1
2612 ; test22b: [2 x i8] in a class
2614 ; Requires no protector.
2615 define signext i8 @test22b() nounwind uwtable ssp {
2617 ; LINUX-I386: test22b:
2618 ; LINUX-I386-NOT: calll __stack_chk_fail
2619 ; LINUX-I386: .cfi_endproc
2621 ; LINUX-X64: test22b:
2622 ; LINUX-X64-NOT: callq __stack_chk_fail
2623 ; LINUX-X64: .cfi_endproc
2625 ; LINUX-KERNEL-X64: test22b:
2626 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2627 ; LINUX-KERNEL-X64: .cfi_endproc
2629 ; DARWIN-X64: test22b:
2630 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2631 ; DARWIN-X64: .cfi_endproc
2632 %a = alloca %class.A, align 1
2633 %array = getelementptr inbounds %class.A* %a, i32 0, i32 0
2634 %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0
2635 %0 = load i8* %arrayidx, align 1
2639 ; test22c: [2 x i8] in a class
2640 ; sspstrong attribute
2641 ; Requires protector.
2642 define signext i8 @test22c() nounwind uwtable sspstrong {
2644 ; LINUX-I386: test22c:
2645 ; LINUX-I386: mov{{l|q}} %gs:
2646 ; LINUX-I386: calll __stack_chk_fail
2648 ; LINUX-X64: test22c:
2649 ; LINUX-X64: mov{{l|q}} %fs:
2650 ; LINUX-X64: callq __stack_chk_fail
2652 ; LINUX-KERNEL-X64: test22c:
2653 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2654 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2656 ; DARWIN-X64: test22c:
2657 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2658 ; DARWIN-X64: callq ___stack_chk_fail
2659 %a = alloca %class.A, align 1
2660 %array = getelementptr inbounds %class.A* %a, i32 0, i32 0
2661 %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0
2662 %0 = load i8* %arrayidx, align 1
2666 ; test22d: [2 x i8] in a class
2668 ; Requires protector.
2669 define signext i8 @test22d() nounwind uwtable sspreq {
2671 ; LINUX-I386: test22d:
2672 ; LINUX-I386: mov{{l|q}} %gs:
2673 ; LINUX-I386: calll __stack_chk_fail
2675 ; LINUX-X64: test22d:
2676 ; LINUX-X64: mov{{l|q}} %fs:
2677 ; LINUX-X64: callq __stack_chk_fail
2679 ; LINUX-KERNEL-X64: test22d:
2680 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2681 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2683 ; DARWIN-X64: test22d:
2684 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2685 ; DARWIN-X64: callq ___stack_chk_fail
2686 %a = alloca %class.A, align 1
2687 %array = getelementptr inbounds %class.A* %a, i32 0, i32 0
2688 %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0
2689 %0 = load i8* %arrayidx, align 1
2693 ; test23a: [2 x i8] nested in several layers of structs and unions
2695 ; Requires no protector.
2696 define signext i8 @test23a() nounwind uwtable {
2698 ; LINUX-I386: test23a:
2699 ; LINUX-I386-NOT: calll __stack_chk_fail
2700 ; LINUX-I386: .cfi_endproc
2702 ; LINUX-X64: test23a:
2703 ; LINUX-X64-NOT: callq __stack_chk_fail
2704 ; LINUX-X64: .cfi_endproc
2706 ; LINUX-KERNEL-X64: test23a:
2707 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2708 ; LINUX-KERNEL-X64: .cfi_endproc
2710 ; DARWIN-X64: test23a:
2711 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2712 ; DARWIN-X64: .cfi_endproc
2713 %x = alloca %struct.deep, align 1
2714 %b = getelementptr inbounds %struct.deep* %x, i32 0, i32 0
2715 %c = bitcast %union.anon* %b to %struct.anon*
2716 %d = getelementptr inbounds %struct.anon* %c, i32 0, i32 0
2717 %e = getelementptr inbounds %struct.anon.0* %d, i32 0, i32 0
2718 %array = bitcast %union.anon.1* %e to [2 x i8]*
2719 %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0
2720 %0 = load i8* %arrayidx, align 1
2724 ; test23b: [2 x i8] nested in several layers of structs and unions
2726 ; Requires no protector.
2727 define signext i8 @test23b() nounwind uwtable ssp {
2729 ; LINUX-I386: test23b:
2730 ; LINUX-I386-NOT: calll __stack_chk_fail
2731 ; LINUX-I386: .cfi_endproc
2733 ; LINUX-X64: test23b:
2734 ; LINUX-X64-NOT: callq __stack_chk_fail
2735 ; LINUX-X64: .cfi_endproc
2737 ; LINUX-KERNEL-X64: test23b:
2738 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2739 ; LINUX-KERNEL-X64: .cfi_endproc
2741 ; DARWIN-X64: test23b:
2742 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2743 ; DARWIN-X64: .cfi_endproc
2744 %x = alloca %struct.deep, align 1
2745 %b = getelementptr inbounds %struct.deep* %x, i32 0, i32 0
2746 %c = bitcast %union.anon* %b to %struct.anon*
2747 %d = getelementptr inbounds %struct.anon* %c, i32 0, i32 0
2748 %e = getelementptr inbounds %struct.anon.0* %d, i32 0, i32 0
2749 %array = bitcast %union.anon.1* %e to [2 x i8]*
2750 %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0
2751 %0 = load i8* %arrayidx, align 1
2755 ; test23c: [2 x i8] nested in several layers of structs and unions
2756 ; sspstrong attribute
2757 ; Requires protector.
2758 define signext i8 @test23c() nounwind uwtable sspstrong {
2760 ; LINUX-I386: test23c:
2761 ; LINUX-I386: mov{{l|q}} %gs:
2762 ; LINUX-I386: calll __stack_chk_fail
2764 ; LINUX-X64: test23c:
2765 ; LINUX-X64: mov{{l|q}} %fs:
2766 ; LINUX-X64: callq __stack_chk_fail
2768 ; LINUX-KERNEL-X64: test23c:
2769 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2770 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2772 ; DARWIN-X64: test23c:
2773 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2774 ; DARWIN-X64: callq ___stack_chk_fail
2775 %x = alloca %struct.deep, align 1
2776 %b = getelementptr inbounds %struct.deep* %x, i32 0, i32 0
2777 %c = bitcast %union.anon* %b to %struct.anon*
2778 %d = getelementptr inbounds %struct.anon* %c, i32 0, i32 0
2779 %e = getelementptr inbounds %struct.anon.0* %d, i32 0, i32 0
2780 %array = bitcast %union.anon.1* %e to [2 x i8]*
2781 %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0
2782 %0 = load i8* %arrayidx, align 1
2786 ; test23d: [2 x i8] nested in several layers of structs and unions
2788 ; Requires protector.
2789 define signext i8 @test23d() nounwind uwtable sspreq {
2791 ; LINUX-I386: test23d:
2792 ; LINUX-I386: mov{{l|q}} %gs:
2793 ; LINUX-I386: calll __stack_chk_fail
2795 ; LINUX-X64: test23d:
2796 ; LINUX-X64: mov{{l|q}} %fs:
2797 ; LINUX-X64: callq __stack_chk_fail
2799 ; LINUX-KERNEL-X64: test23d:
2800 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2801 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2803 ; DARWIN-X64: test23d:
2804 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2805 ; DARWIN-X64: callq ___stack_chk_fail
2806 %x = alloca %struct.deep, align 1
2807 %b = getelementptr inbounds %struct.deep* %x, i32 0, i32 0
2808 %c = bitcast %union.anon* %b to %struct.anon*
2809 %d = getelementptr inbounds %struct.anon* %c, i32 0, i32 0
2810 %e = getelementptr inbounds %struct.anon.0* %d, i32 0, i32 0
2811 %array = bitcast %union.anon.1* %e to [2 x i8]*
2812 %arrayidx = getelementptr inbounds [2 x i8]* %array, i32 0, i64 0
2813 %0 = load i8* %arrayidx, align 1
2817 ; test24a: Variable sized alloca
2819 ; Requires no protector.
2820 define void @test24a(i32 %n) nounwind uwtable {
2822 ; LINUX-I386: test24a:
2823 ; LINUX-I386-NOT: calll __stack_chk_fail
2824 ; LINUX-I386: .cfi_endproc
2826 ; LINUX-X64: test24a:
2827 ; LINUX-X64-NOT: callq __stack_chk_fail
2828 ; LINUX-X64: .cfi_endproc
2830 ; LINUX-KERNEL-X64: test24a:
2831 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2832 ; LINUX-KERNEL-X64: .cfi_endproc
2834 ; DARWIN-X64: test24a:
2835 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2836 ; DARWIN-X64: .cfi_endproc
2837 %n.addr = alloca i32, align 4
2838 %a = alloca i32*, align 8
2839 store i32 %n, i32* %n.addr, align 4
2840 %0 = load i32* %n.addr, align 4
2841 %conv = sext i32 %0 to i64
2842 %1 = alloca i8, i64 %conv
2843 %2 = bitcast i8* %1 to i32*
2844 store i32* %2, i32** %a, align 8
2848 ; test24b: Variable sized alloca
2850 ; Requires protector.
2851 define void @test24b(i32 %n) nounwind uwtable ssp {
2853 ; LINUX-I386: test24b:
2854 ; LINUX-I386: mov{{l|q}} %gs:
2855 ; LINUX-I386: calll __stack_chk_fail
2857 ; LINUX-X64: test24b:
2858 ; LINUX-X64: mov{{l|q}} %fs:
2859 ; LINUX-X64: callq __stack_chk_fail
2861 ; LINUX-KERNEL-X64: test24b:
2862 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2863 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2865 ; DARWIN-X64: test24b:
2866 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2867 ; DARWIN-X64: callq ___stack_chk_fail
2868 %n.addr = alloca i32, align 4
2869 %a = alloca i32*, align 8
2870 store i32 %n, i32* %n.addr, align 4
2871 %0 = load i32* %n.addr, align 4
2872 %conv = sext i32 %0 to i64
2873 %1 = alloca i8, i64 %conv
2874 %2 = bitcast i8* %1 to i32*
2875 store i32* %2, i32** %a, align 8
2879 ; test24c: Variable sized alloca
2880 ; sspstrong attribute
2881 ; Requires protector.
2882 define void @test24c(i32 %n) nounwind uwtable sspstrong {
2884 ; LINUX-I386: test24c:
2885 ; LINUX-I386: mov{{l|q}} %gs:
2886 ; LINUX-I386: calll __stack_chk_fail
2888 ; LINUX-X64: test24c:
2889 ; LINUX-X64: mov{{l|q}} %fs:
2890 ; LINUX-X64: callq __stack_chk_fail
2892 ; LINUX-KERNEL-X64: test24c:
2893 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2894 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2896 ; DARWIN-X64: test24c:
2897 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2898 ; DARWIN-X64: callq ___stack_chk_fail
2899 %n.addr = alloca i32, align 4
2900 %a = alloca i32*, align 8
2901 store i32 %n, i32* %n.addr, align 4
2902 %0 = load i32* %n.addr, align 4
2903 %conv = sext i32 %0 to i64
2904 %1 = alloca i8, i64 %conv
2905 %2 = bitcast i8* %1 to i32*
2906 store i32* %2, i32** %a, align 8
2910 ; test24d: Variable sized alloca
2912 ; Requires protector.
2913 define void @test24d(i32 %n) nounwind uwtable sspreq {
2915 ; LINUX-I386: test24d:
2916 ; LINUX-I386: mov{{l|q}} %gs:
2917 ; LINUX-I386: calll __stack_chk_fail
2919 ; LINUX-X64: test24d:
2920 ; LINUX-X64: mov{{l|q}} %fs:
2921 ; LINUX-X64: callq __stack_chk_fail
2923 ; LINUX-KERNEL-X64: test24d:
2924 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
2925 ; LINUX-KERNEL-X64: callq __stack_chk_fail
2927 ; DARWIN-X64: test24d:
2928 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2929 ; DARWIN-X64: callq ___stack_chk_fail
2930 %n.addr = alloca i32, align 4
2931 %a = alloca i32*, align 8
2932 store i32 %n, i32* %n.addr, align 4
2933 %0 = load i32* %n.addr, align 4
2934 %conv = sext i32 %0 to i64
2935 %1 = alloca i8, i64 %conv
2936 %2 = bitcast i8* %1 to i32*
2937 store i32* %2, i32** %a, align 8
2941 ; test25a: array of [4 x i32]
2943 ; Requires no protector.
2944 define i32 @test25a() nounwind uwtable {
2946 ; LINUX-I386: test25a:
2947 ; LINUX-I386-NOT: calll __stack_chk_fail
2948 ; LINUX-I386: .cfi_endproc
2950 ; LINUX-X64: test25a:
2951 ; LINUX-X64-NOT: callq __stack_chk_fail
2952 ; LINUX-X64: .cfi_endproc
2954 ; LINUX-KERNEL-X64: test25a:
2955 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2956 ; LINUX-KERNEL-X64: .cfi_endproc
2958 ; DARWIN-X64: test25a:
2959 ; DARWIN-X64-NOT: callq ___stack_chk_fail
2960 ; DARWIN-X64: .cfi_endproc
2961 %a = alloca [4 x i32], align 16
2962 %arrayidx = getelementptr inbounds [4 x i32]* %a, i32 0, i64 0
2963 %0 = load i32* %arrayidx, align 4
2967 ; test25b: array of [4 x i32]
2969 ; Requires no protector, except for Darwin which _does_ require a protector.
2970 define i32 @test25b() nounwind uwtable ssp {
2972 ; LINUX-I386: test25b:
2973 ; LINUX-I386-NOT: calll __stack_chk_fail
2974 ; LINUX-I386: .cfi_endproc
2976 ; LINUX-X64: test25b:
2977 ; LINUX-X64-NOT: callq __stack_chk_fail
2978 ; LINUX-X64: .cfi_endproc
2980 ; LINUX-KERNEL-X64: test25b:
2981 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
2982 ; LINUX-KERNEL-X64: .cfi_endproc
2984 ; DARWIN-X64: test25b:
2985 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
2986 ; DARWIN-X64: callq ___stack_chk_fail
2987 %a = alloca [4 x i32], align 16
2988 %arrayidx = getelementptr inbounds [4 x i32]* %a, i32 0, i64 0
2989 %0 = load i32* %arrayidx, align 4
2993 ; test25c: array of [4 x i32]
2994 ; sspstrong attribute
2995 ; Requires protector.
2996 define i32 @test25c() nounwind uwtable sspstrong {
2998 ; LINUX-I386: test25c:
2999 ; LINUX-I386: mov{{l|q}} %gs:
3000 ; LINUX-I386: calll __stack_chk_fail
3002 ; LINUX-X64: test25c:
3003 ; LINUX-X64: mov{{l|q}} %fs:
3004 ; LINUX-X64: callq __stack_chk_fail
3006 ; LINUX-KERNEL-X64: test25c:
3007 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
3008 ; LINUX-KERNEL-X64: callq __stack_chk_fail
3010 ; DARWIN-X64: test25c:
3011 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
3012 ; DARWIN-X64: callq ___stack_chk_fail
3013 %a = alloca [4 x i32], align 16
3014 %arrayidx = getelementptr inbounds [4 x i32]* %a, i32 0, i64 0
3015 %0 = load i32* %arrayidx, align 4
3019 ; test25d: array of [4 x i32]
3021 ; Requires protector.
3022 define i32 @test25d() nounwind uwtable sspreq {
3024 ; LINUX-I386: test25d:
3025 ; LINUX-I386: mov{{l|q}} %gs:
3026 ; LINUX-I386: calll __stack_chk_fail
3028 ; LINUX-X64: test25d:
3029 ; LINUX-X64: mov{{l|q}} %fs:
3030 ; LINUX-X64: callq __stack_chk_fail
3032 ; LINUX-KERNEL-X64: test25d:
3033 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
3034 ; LINUX-KERNEL-X64: callq __stack_chk_fail
3036 ; DARWIN-X64: test25d:
3037 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
3038 ; DARWIN-X64: callq ___stack_chk_fail
3039 %a = alloca [4 x i32], align 16
3040 %arrayidx = getelementptr inbounds [4 x i32]* %a, i32 0, i64 0
3041 %0 = load i32* %arrayidx, align 4
3045 ; test26: Nested structure, no arrays, no address-of expressions.
3046 ; Verify that the resulting gep-of-gep does not incorrectly trigger
3047 ; a stack protector.
3048 ; ssptrong attribute
3049 ; Requires no protector.
3050 define void @test26() nounwind uwtable sspstrong {
3052 ; LINUX-I386: test26:
3053 ; LINUX-I386-NOT: calll __stack_chk_fail
3054 ; LINUX-I386: .cfi_endproc
3056 ; LINUX-X64: test26:
3057 ; LINUX-X64-NOT: callq __stack_chk_fail
3058 ; LINUX-X64: .cfi_endproc
3060 ; LINUX-KERNEL-X64: test26:
3061 ; LINUX-KERNEL-X64-NOT: callq __stack_chk_fail
3062 ; LINUX-KERNEL-X64: .cfi_endproc
3064 ; DARWIN-X64: test26:
3065 ; DARWIN-X64-NOT: callq ___stack_chk_fail
3066 ; DARWIN-X64: .cfi_endproc
3067 %c = alloca %struct.nest, align 4
3068 %b = getelementptr inbounds %struct.nest* %c, i32 0, i32 1
3069 %_a = getelementptr inbounds %struct.pair* %b, i32 0, i32 0
3070 %0 = load i32* %_a, align 4
3071 %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32 %0)
3075 ; test27: Address-of a structure taken in a function with a loop where
3076 ; the alloca is an incoming value to a PHI node and a use of that PHI
3077 ; node is also an incoming value.
3078 ; Verify that the address-of analysis does not get stuck in infinite
3079 ; recursion when chasing the alloca through the PHI nodes.
3080 ; Requires protector.
3081 define i32 @test27(i32 %arg) nounwind uwtable sspstrong {
3083 ; LINUX-I386: test27:
3084 ; LINUX-I386: mov{{l|q}} %gs:
3085 ; LINUX-I386: calll __stack_chk_fail
3087 ; LINUX-X64: test27:
3088 ; LINUX-X64: mov{{l|q}} %fs:
3089 ; LINUX-X64: callq __stack_chk_fail
3091 ; LINUX-KERNEL-X64: test27:
3092 ; LINUX-KERNEL-X64: mov{{l|q}} %gs:
3093 ; LINUX-KERNEL-X64: callq __stack_chk_fail
3095 ; DARWIN-X64: test27:
3096 ; DARWIN-X64: mov{{l|q}} ___stack_chk_guard
3097 ; DARWIN-X64: callq ___stack_chk_fail
3098 %tmp = alloca %struct.small*, align 8
3099 %tmp1 = call i32 (...)* @dummy(%struct.small** %tmp) nounwind
3100 %tmp2 = load %struct.small** %tmp, align 8
3101 %tmp3 = ptrtoint %struct.small* %tmp2 to i64
3102 %tmp4 = trunc i64 %tmp3 to i32
3103 %tmp5 = icmp sgt i32 %tmp4, 0
3104 br i1 %tmp5, label %bb6, label %bb21
3106 bb6: ; preds = %bb17, %bb
3107 %tmp7 = phi %struct.small* [ %tmp19, %bb17 ], [ %tmp2, %bb ]
3108 %tmp8 = phi i64 [ %tmp20, %bb17 ], [ 1, %bb ]
3109 %tmp9 = phi i32 [ %tmp14, %bb17 ], [ %tmp1, %bb ]
3110 %tmp10 = getelementptr inbounds %struct.small* %tmp7, i64 0, i32 0
3111 %tmp11 = load i8* %tmp10, align 1
3112 %tmp12 = icmp eq i8 %tmp11, 1
3113 %tmp13 = add nsw i32 %tmp9, 8
3114 %tmp14 = select i1 %tmp12, i32 %tmp13, i32 %tmp9
3115 %tmp15 = trunc i64 %tmp8 to i32
3116 %tmp16 = icmp eq i32 %tmp15, %tmp4
3117 br i1 %tmp16, label %bb21, label %bb17
3119 bb17: ; preds = %bb6
3120 %tmp18 = getelementptr inbounds %struct.small** %tmp, i64 %tmp8
3121 %tmp19 = load %struct.small** %tmp18, align 8
3122 %tmp20 = add i64 %tmp8, 1
3125 bb21: ; preds = %bb6, %bb
3126 %tmp22 = phi i32 [ %tmp1, %bb ], [ %tmp14, %bb6 ]
3127 %tmp23 = call i32 (...)* @dummy(i32 %tmp22) nounwind
3131 declare double @testi_aux()
3132 declare i8* @strcpy(i8*, i8*)
3133 declare i32 @printf(i8*, ...)
3134 declare void @funcall(i32*)
3135 declare void @funcall2(i32**)
3136 declare void @funfloat(float*)
3137 declare void @funfloat2(float**)
3138 declare void @_Z3exceptPi(i32*)
3139 declare i32 @__gxx_personality_v0(...)
3140 declare i32* @getp()
3141 declare i32 @dummy(...)