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

            Bug ID: 44363
           Summary: Segmentation fault when expanding C++ 11 template
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangb...@nondot.org
          Reporter: evandroc...@hotmail.com
                CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
                    llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk

I was just building some simple template code and the clang compiler crashed.

It crashes both with clang 5 (windows release) and 8 (cygwin release).

This is the command line output from clang 5 and 8, plus the source code:


Professional@PROFESSIONAL-PC$ whereis clang
clang: /usr/bin/clang /usr/lib/clang /cygdrive/c/Program
Files/LLVM/bin/clang.exe /usr/share/man/man1/clang.1.gz


$ clang++ -Xclang -ast-print -fsyntax-only test_debugger.cpp > main.exe
clang-8: error: unable to execute command: Segmentation fault (core dumped)
clang-8: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 8.0.1 (tags/RELEASE_801/final)
Target: x86_64-unknown-windows-cygnus
Thread model: posix
InstalledDir: /usr/bin
clang-8: note: diagnostic msg: PLEASE submit a bug report to  and include the
crash backtrace, preprocessed source, and associated run script.
clang-8: error: unable to execute command: Segmentation fault (core dumped)
clang-8: note: diagnostic msg: Error generating preprocessed source(s).


$ /cygdrive/c/Program\ Files/LLVM/bin/clang.exe -Xclang -ast-print
-fsyntax-only test_debugger.cpp > main.exe
Wrote crash dump file
"C:\Users\PROFES~1\AppData\Local\Temp\clang.exe-2c8cc4.dmp"
clang.exe: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.1 (tags/RELEASE_501/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
clang.exe: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang.exe: note: diagnostic msg: Error generating preprocessed source(s).


Source code:
#include <array>
#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)

template< unsigned int PathIndex, unsigned int PathLength >
constexpr unsigned int findlastslash(const char (&path)[PathLength])
{
    constexpr const unsigned int end = PathLength - PathIndex;
    return (end >= 0 && path[end] != '/' && path[end] != '\\') ? findlastslash<
PathIndex - 1 >( path ) : ( end + 1 );
}

int main(int argc, char const *argv[])
{
    STATIC_ASSERT( findlastslash< 1 >( "cppdebugger/test_debugger.cpp" ) == 17
);
}

-- 
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