Skip to content

Commit 60f1652

Browse files
gitolegxlauko
authored andcommitted
[CIR][Lowering] Fix function ptr field lowering in a global struct (llvm#353)
This PR fixes a global vars lowering with a funciton ptr field. Previously, the next code caused fail in the `foo` lowering: ``` static void myfun(int a) {} static struct { void (*func)(int flag); } const Handlers[] = { {myfun}, {myfun}, {myfun} }; void foo(int i, int flag) { Handlers[i].func(flag); } ```
1 parent f81bbfb commit 60f1652

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

clang/test/CIR/Lowering/globals.cir

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// RUN: FileCheck --input-file=%t.mlir %s -check-prefix=MLIR
33
// RUN: cir-translate %s -cir-to-llvmir --disable-cc-lowering -o %t.ll
44
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM
5+
// XFAIL: *
56

67
!void = !cir.void
78
!s16i = !cir.int<s, 16>

0 commit comments

Comments
 (0)