xref: /aosp_15_r20/external/clang/test/CodeGen/fixup-depth-overflow.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -O1 -disable-llvm-optzns -emit-llvm -o - %s | FileCheck %s
2*67e74705SXin Li 
3*67e74705SXin Li #define M if (x) goto L1;
4*67e74705SXin Li #define M10 M M M M M M M M M M
5*67e74705SXin Li #define M100 M10 M10 M10 M10 M10 M10 M10 M10 M10 M10
6*67e74705SXin Li #define M1000 M100 M100 M100 M100 M100 M100 M100 M100 M100 M100
7*67e74705SXin Li 
f(int x)8*67e74705SXin Li void f(int x) {
9*67e74705SXin Li   int h;
10*67e74705SXin Li 
11*67e74705SXin Li   // Many gotos to not-yet-emitted labels would cause EHScope's FixupDepth
12*67e74705SXin Li   // to overflow (PR23490).
13*67e74705SXin Li   M1000 M1000 M1000
14*67e74705SXin Li 
15*67e74705SXin Li   if (x == 5) {
16*67e74705SXin Li     // This will cause us to emit a clean-up of the stack variable. If the
17*67e74705SXin Li     // FixupDepths are broken, fixups will erroneously get threaded through it.
18*67e74705SXin Li     int i;
19*67e74705SXin Li   }
20*67e74705SXin Li 
21*67e74705SXin Li L1:
22*67e74705SXin Li   return;
23*67e74705SXin Li }
24*67e74705SXin Li 
25*67e74705SXin Li // CHECK-LABEL: define void @f
26*67e74705SXin Li // CHECK-NOT: cleanup
27