[llvm-bugs] [Bug 35472] New: Error with ThinLTO: Invalid function metadata: outgoing forward refs

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 29 16:30:38 PST 2017


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

            Bug ID: 35472
           Summary: Error with ThinLTO: Invalid function metadata:
                    outgoing forward refs
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sunil_srivastava at playstation.sony.com
                CC: llvm-bugs at lists.llvm.org

As shown below, a ThinLTO run fails with an assertion failure on two simple
files, trimmed from a larger code.

The attribute nodebug on ~Echo() is needed for this crash to occur. In this
trimmed example the ~Echo() default declaration has been added to be able to
put that attribute.

-------------------------------------------------------------------------------

$ clang++ --version
clang version 6.0.0 (trunk 319376)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: ....
$ clang++ -c a.cpp -o a.bc --std=c++11 -O0 -g -flto=thin
$ clang++ -c b.cpp -o b.bc --std=c++11 -O0 -g -flto=thin
$ llvm-lto -thinlto-action=run a.bc b.bc
ThinLTO: b.bc: error: Invalid function metadata: outgoing forward refs
(Producer: 'LLVM6.0.0svn' Reader: 'LLVM 6.0.0svn')
LLVM ERROR: importFunctions failed
$ cat a.cpp
struct Charlie {
    __attribute__((__always_inline__)) ~Charlie() { Golf = 0; }
    int Golf;
};

struct Delta {
    Charlie Foxtrot;
};

struct Echo {
    Charlie Foxtrot;
    __attribute__((nodebug)) ~Echo() = default;
};

extern void Bravo();

void Bravo() {
    Delta Hotel;
    Echo India;
}
$ cat b.cpp
extern void Bravo();
extern void Alpha();
void Alpha() { Bravo(); }
$
--------------------------------------------------------------------------
The crash occurs in BitcodeReader.cpp at a point where it expects all Metadata
forward-refs to be resolved, but they are not. Around line 4615:

  // Unexpected unresolved metadata about to be dropped.
  if (MDLoader->hasFwdRefs())
    return error("Invalid function metadata: outgoing forward refs");

I am filing this bug under clang/CodeGen under the assumption that the incoming
IR at this point is defective. If not, please go ahead and assign it to another
component.

-- 
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/20171130/a80d3e10/attachment.html>


More information about the llvm-bugs mailing list