Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / safestack / buffer-copy.c
blob96b2302be1b1076df8b893935a4328252bf8e194
1 // RUN: %clang_safestack %s -o %t
2 // RUN: %run %t
4 #include "utils.h"
6 // Test that loads/stores work correctly for variables on the unsafe stack.
8 int main(int argc, char **argv)
10 int i;
11 char buffer[128];
13 // check that we can write to a buffer
14 for (i = 0; argv[0][i] && i < sizeof (buffer) - 1; ++i)
15 buffer[i] = argv[0][i];
16 buffer[i] = '\0';
18 break_optimization(buffer);
20 // check that we can read from a buffer
21 for (i = 0; argv[0][i] && i < sizeof (buffer) - 1; ++i)
22 if (buffer[i] != argv[0][i])
23 return 1;
24 return 0;