[llvm-bugs] [Bug 38120] New: LTO build gives assertion

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 10 06:18:20 PDT 2018


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

            Bug ID: 38120
           Summary: LTO build gives assertion
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: ftee at flametop.co.uk
                CC: eleviant at accesssoftek.com, llvm-bugs at lists.llvm.org

Change 'r336059 - [Evaluator] Improve evaluation of call instruction' appears
to have introduced a compiler assertion when compiling this example code.

NB. This code sample is technically invalid C++ as it breaks the one definition
rules, but it used to compile benignly before the change.

$ cat a.cpp
class dYj typedef *(*vfY)(class lYY *);
struct Mxl {
  Mxl(vfY, int, const char *, int, const char *, const char *, const char *,
      bool);
  vfY AvQ;
};
Mxl::Mxl(vfY, int, const char *, int, const char *, const char *, const char *,
         bool) {}
$ cat b.cpp
class dYj;
struct Mxl {
  Mxl(dYj *(class lYY *), int, const char *, int, const char *, const char *,
      const char *, bool = true);
} a(0, 0, 0, 0, 0, 0, 0);

$ clang++ -c a.cpp -o a.cpp.o -flto
$ clang++ -c b.cpp -o b.cpp.o -flto
$ llvm-lto a.cpp.o b.cpp.o

gives the assertion:

llvm-lto: Casting.h:255: typename llvm::cast_retty<X,Y*>::ret_type
llvm::cast(Y*) [with X = llvm::Function; Y = llvm::Constant; typename
llvm::cast_retty<X, Y*>::ret_type = llvm::Function*]:
Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

It would seem better if the compiler could give an error in this case rather
than aborting with an assertion.

-- 
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/20180710/2c819d5a/attachment.html>


More information about the llvm-bugs mailing list