<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Assertion `Val && "isa<> used on a null pointer"' failed, since SVN r338464, "[P0936R0] add [[clang::lifetimebound]] attribute""
   href="https://bugs.llvm.org/show_bug.cgi?id=38421">38421</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion `Val && "isa<> used on a null pointer"' failed, since SVN r338464, "[P0936R0] add [[clang::lifetimebound]] attribute"
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>martin@martin.st
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When compiling Qt for i686 mingw-w64 with the very latest clang, this triggers
the assertion 'Val && "isa<> used on a null pointer"'.

This happens if clang is built GCC 5.3, but not when it's built in debug mode,
and not when built with clang.

When this happens, I get a backtrace like this:

clang-7: ../include/llvm/Support/Casting.h:106: static bool
llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To =
clang::AttributedType; From = clang::Type]: Assertion `Val && "isa<> used on a
null pointer"' failed.
Stack dump:
0.      Program arguments:
/home/martin/code/llvm-bisect/build-with-debug-info/bin/clang-7 -cc1 -triple
i686-w64-windows-gnu -emit-obj -mrelax-all -disable-free -main-file-name
qwindowsmime-638816.cpp -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-ver
bose -mconstructor-aliases -target-cpu pentium4 -dwarf-column-info
-debugger-tuning=gdb -coverage-notes-file /tmp/foo.gcno -resource-dir
/home/martin/code/llvm-bisect/build-with-debug-info/lib/clang/7.0.0 -D UNICODE
-internal-isystem /usr/i686-w64-mingw32/include/c++ -internal-isystem /u
sr/i686-w64-mingw32/include/c++/i686-w64-mingw32 -internal-isystem
/usr/i686-w64-mingw32/include/c++/backward -internal-isystem
/usr/i686-w64-mingw32/include/c++/5.3-win32 -internal-isystem
/usr/i686-w64-mingw32/include/c++/5.3-win32/i686-w64-mingw32 -internal-isystem
/usr/i686-w64-mingw
32/include/c++/5.3-win32/backward -internal-isystem /usr/include/c++/5.3-win32
-internal-isystem /usr/include/c++/5.3-win32/i686-w64-mingw32 -internal-isystem
/usr/include/c++/5.3-win32/backward -internal-isystem
/usr/lib/gcc/i686-w64-mingw32/5.3-win32/include/c++ -internal-isystem /usr/
lib/gcc/i686-w64-mingw32/5.3-win32/include/c++/i686-w64-mingw32
-internal-isystem /usr/lib/gcc/i686-w64-mingw32/5.3-win32/include/c++/backward
-internal-isystem
/home/martin/code/llvm-bisect/build-with-debug-info/lib/clang/7.0.0/include
-internal-isystem /usr/i686-w64-mingw32/sys-root/mi
ngw/include -internal-isystem /usr/i686-w64-mingw32/include -internal-isystem
/usr/include -fdeprecated-macro -fdebug-compilation-dir /tmp -ferror-limit 19
-fmessage-length 0 -fno-use-cxa-atexit -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdwarf-exceptions -fdiagnostics-show-option
 -o foo.o -x c++ qwindowsmime-638816.cpp 
1.      /home/martin/clang-nightly/i686-w64-mingw32/include/_mingw.h:552:32:
current parser token ';'
#0 0x00000000019ee72a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/martin/code/llvm-bisect/build-with-debug-info/../lib/Support/Unix/Signals.inc:494:0
#1 0x00000000019ecc3c llvm::sys::RunSignalHandlers()
/home/martin/code/llvm-bisect/build-with-debug-info/../lib/Support/Signals.cpp:67:0
#2 0x00000000019ecda7 SignalHandler(int)
/home/martin/code/llvm-bisect/build-with-debug-info/../lib/Support/Unix/Signals.inc:343:0
#3 0x00007fd88aa19390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x00007fd88978b428 gsignal
/build/glibc-Cl5G7W/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#5 0x00007fd88978d02a abort /build/glibc-Cl5G7W/glibc-2.23/stdlib/abort.c:91:0
#6 0x00007fd889783bd7 __assert_fail_base
/build/glibc-Cl5G7W/glibc-2.23/assert/assert.c:92:0
#7 0x00007fd889783c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x00000000008d6aea llvm::isa_impl_cl<clang::ElaboratedType, clang::Type
const*>::doit(clang::Type const*)
/home/martin/code/llvm-bisect/build-with-debug-info/../include/llvm/Support/Casting.h:142:0
#9 0x00000000008d6aea llvm::isa_impl_wrap<clang::ElaboratedType, clang::Type
const*, clang::Type const*>::doit(clang::Type const* const&)
/home/martin/code/llvm-bisect/build-with-debug-info/../include/llvm/Support/Casting.h:133:0
#10 0x00000000008d6aea llvm::isa_impl_wrap<clang::ElaboratedType, clang::Type
const* const, clang::Type const*>::doit(clang::Type const* const&)
/home/martin/code/llvm-bisect/build-with-debug-info/../include/llvm/Support/Casting.h:125:0
#11 0x00000000008d6aea bool llvm::isa<clang::ElaboratedType, clang::Type
const*>(clang::Type const* const&) (.isra.2083.part.2084)
/home/martin/code/llvm-bisect/build-with-debug-info/../include/llvm/Support/Casting.h:144:0
#12 0x0000000002e3b139 bool llvm::isa<clang::AttributedType, clang::Type
const*>(clang::Type const* const&)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Sema/SemaDecl.cpp:6020:0
#13 0x0000000002e3b139 llvm::cast_retty<clang::AttributedType, clang::Type
const*>::ret_type llvm::cast<clang::AttributedType, clang::Type
const>(clang::Type const*)
/home/martin/code/llvm-bisect/build-with-debug-info/../include/llvm/Support/Casting.h:255:0
#14 0x0000000002e3b139 clang::ConcreteTypeLoc<clang::UnqualTypeLoc,
clang::AttributedTypeLoc, clang::AttributedType,
clang::AttributedLocInfo>::getTypePtr() const
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/include/clang/AST/TypeLoc.h:405:0
#15 0x0000000002e3b139 clang::AttributedTypeLoc::getInnerType() const
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/include/clang/AST/TypeLoc.h:969:0
#16 0x0000000002e3b139 clang::ConcreteTypeLoc<clang::UnqualTypeLoc,
clang::AttributedTypeLoc, clang::AttributedType,
clang::AttributedLocInfo>::getNextTypeAlign() const
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/include/clang/AST/TypeLoc.h:459:0
#17 0x0000000002e3b139 clang::ConcreteTypeLoc<clang::UnqualTypeLoc,
clang::AttributedTypeLoc, clang::AttributedType,
clang::AttributedLocInfo>::getNonLocalData() const
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/include/clang/AST/TypeLoc.h:434:0
#18 0x0000000002e3b139 clang::ConcreteTypeLoc<clang::UnqualTypeLoc,
clang::AttributedTypeLoc, clang::AttributedType,
clang::AttributedLocInfo>::getInnerTypeLoc() const
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/include/clang/AST/TypeLoc.h:442:0
#19 0x0000000002e3b139 clang::AttributedTypeLoc::getModifiedLoc() const
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/include/clang/AST/TypeLoc.h:891:0
#20 0x0000000002e3b139 checkAttributesAfterMerging(clang::Sema&,
clang::NamedDecl&) (.constprop.2491)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Sema/SemaDecl.cpp:6014:0 
#21 0x0000000002e507f4 clang::Sema::ActOnFunctionDeclarator(clang::Scope*,
clang::Declarator&, clang::DeclContext*, clang::TypeSourceInfo*,
clang::LookupResult&, llvm::MutableArrayRef<clang::TemplateParameterList*>,
bool&)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Sema/SemaDecl.cpp:9122:0
#22 0x0000000002e54dcb clang::Sema::HandleDeclarator(clang::Scope*,
clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Sema/SemaDecl.cpp:5534:0
#23 0x0000000002e558fa clang::Sema::ActOnDeclarator(clang::Scope*,
clang::Declarator&)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Sema/SemaDecl.cpp:5207:0
#24 0x0000000002b31410
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Parse/ParseDecl.cpp:2214:0
#25 0x0000000002b43d47 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Parse/ParseDecl.cpp:2028:0
#26 0x0000000002b1d89c
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Parse/Parser.cpp:1013:0
#27 0x0000000002b1e0b1
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.196.constprop.198)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Parse/Parser.cpp:1028:0
#28 0x0000000002b1e10f
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Parse/Parser.cpp:1030:0
#29 0x0000000002b225d0
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Parse/Parser.cpp:853:0
#30 0x0000000002b5366c _ZN5clang6Parser25ParsedAttributesWithRangeD4Ev
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/include/clang/Parse/Parser.h:1398:0
#31 0x0000000002b5366c clang::Parser::ParseLinkage(clang::ParsingDeclSpec&,
clang::DeclaratorContext)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Parse/ParseDeclCXX.cpp:370:0
#32 0x0000000002b1da78
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Parse/Parser.cpp:1009:0
#33 0x0000000002b1e0b1
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.196.constprop.198)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Parse/Parser.cpp:1028:0
#34 0x0000000002b1e10f
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Parse/Parser.cpp:1030:0
#35 0x0000000002b225d0
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Parse/Parser.cpp:853:0
#36 0x0000000002b22ed2 _ZN5clang6Parser25ParsedAttributesWithRangeD4Ev
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/include/clang/Parse/Parser.h:1398:0
#37 0x0000000002b22ed2
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Parse/Parser.cpp:607:0
#38 0x0000000002b19d63 clang::ParseAST(clang::Sema&, bool, bool)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Parse/ParseAST.cpp:157:0
#39 0x000000000233887f clang::CodeGenAction::ExecuteAction()
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/CodeGen/CodeGenAction.cpp:1044:0
#40 0x0000000001fe7dce clang::FrontendAction::Execute()
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Frontend/FrontendAction.cpp:910:0
#41 0x0000000001fb40e6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/Frontend/CompilerInstance.cpp:962:0
#42 0x000000000207df5b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:257:0
#43 0x000000000099e358 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/tools/driver/cc1_main.cpp:218:0
#44 0x0000000000939756 ExecuteCC1Tool
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/tools/driver/driver.cpp:310:0
#45 0x0000000000939756 main
/home/martin/code/llvm-bisect/build-with-debug-info/../tools/clang/tools/driver/driver.cpp:382:0
#46 0x00007fd889776830 __libc_start_main
/build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:325:0
#47 0x000000000099a689 _start
(/home/martin/code/llvm-bisect/build-with-debug-info/bin/clang-7+0x99a689)
clang-7: error: unable to execute command: Aborted (core dumped)


I haven't managed to reduce the testcase significantly yet (creduce hasn't made
any significant process over quite some time), and the compressed source is
over the limit for what bugzilla accepts. The reproduction sample is available
at <a href="https://martin.st/temp/qwindowsmime-638816.cpp.xz">https://martin.st/temp/qwindowsmime-638816.cpp.xz</a> for now at least.

To reproduce:
$ wget <a href="https://martin.st/temp/qwindowsmime-638816.cpp.xz">https://martin.st/temp/qwindowsmime-638816.cpp.xz</a>
$ xz -d qwindowsmime-638816.cpp.xz 
$ clang -target i686-w64-mingw32 -c qwindowsmime-638816.cpp -DUNICODE</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>