https://bugs.llvm.org/show_bug.cgi?id=41206

            Bug ID: 41206
           Summary: Infinite loop in ARC destructor for C struct
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangb...@nondot.org
          Reporter: smee...@fb.com
                CC: ahata...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk,
                    rjmcc...@apple.com

$ cat /tmp/reduced.m
@class I;

typedef struct {
  I *name;
} Foo;

typedef struct {
  Foo foo;
} Bar;

I *getI();

void f() {
  Foo foo = {getI()};
  Bar bar = {foo};
}

$ clang -cc1 -triple x86_64-apple-ios12.1.0 -fobjc-arc -emit-llvm -o -
/tmp/reduced.m
...
define linkonce_odr hidden void @__destructor_8_s0(i8** %dst) #3 {
entry:
  %dst.addr = alloca i8**, align 8
  store i8** %dst, i8*** %dst.addr, align 8
  %0 = load i8**, i8*** %dst.addr, align 8
  call void @__destructor_8_s0(i8** %0) #2
  ret void
}
...

__destructor_8_s0 has an unconditional call to itself, resulting in an infinite
loop.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to