Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / multi-dim-operator-new.cpp
blobf1eeb38371a6a05699493ffa801b5e9502346c68
1 // RUN: %clang_cc1 %s -triple x86_64-unknown-unknown -emit-llvm -o - | FileCheck %s
2 // PR6641
4 extern "C" int printf(const char *, ...);
6 struct Foo {
7 Foo() : iFoo (2) {
8 printf("%p\n", this);
10 int iFoo;
14 typedef Foo (*T)[3][4];
16 T bar() {
17 return new Foo[2][3][4];
20 T bug(int i) {
21 return new Foo[i][3][4];
24 void pr(T a) {
25 for (int i = 0; i < 3; i++)
26 for (int j = 0; j < 4; j++)
27 printf("%p\n", a[i][j]);
30 Foo *test() {
31 return new Foo[5];
34 int main() {
35 T f = bar();
36 pr(f);
37 f = bug(3);
38 pr(f);
40 Foo * g = test();
41 for (int i = 0; i < 5; i++)
42 printf("%d\n", g[i].iFoo);
43 return 0;
46 // CHECK: call noalias noundef nonnull ptr @_Znam
47 // CHECK: call noalias noundef nonnull ptr @_Znam
48 // CHECK: call noalias noundef nonnull ptr @_Znam