[llvm-bugs] [Bug 41206] New: Infinite loop in ARC destructor for C struct

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 22 13:50:40 PDT 2019


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: unassignedclangbugs at nondot.org
          Reporter: smeenai at fb.com
                CC: ahatanak at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk,
                    rjmccall at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190322/16e4c9d8/attachment.html>


More information about the llvm-bugs mailing list