[llvm-bugs] [Bug 45350] New: Crash parsing C++20 constexpr stuff
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Mar 29 12:33:53 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45350
Bug ID: 45350
Summary: Crash parsing C++20 constexpr stuff
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++2a
Assignee: unassignedclangbugs at nondot.org
Reporter: cdgiessen at gmail.com
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
While working on my ConstExpr Raytracer, I encountered a clang crash.
The project has 12 'threads' (different translation units). I am only going to
attach one as they all have the same output, but it is worth noting in case its
related to that.
Command line output:
[14/18] Building CXX object CMakeFiles/cert.dir/src/threads/thread_11.cpp.o
FAILED: CMakeFiles/cert.dir/src/threads/thread_11.cpp.o
/usr/bin/clang++ -std=c++2a
-fconstexpr-steps=2147483647 -O3 -std=gnu++2a -MD -MT
CMakeFiles/cert.dir/src/threads/thread_11.cpp.o -MF
CMakeFiles/cert.dir/src/threads/thread_11.cpp.o.d -o
CMakeFiles/cert.dir/src/threads/thread_11.cpp.o -c
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/thread_11.cpp
In file included from
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/thread_11.cpp:1:
In file included from
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/threads.h:2:
In file included from
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/../raytracer.h:5:
In file included from
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/../vec3.h:5:
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/../util.h:316:17:
error: cannot combine with previous 'float' declaration specifier
float constexpr float asin_series (float
x, float sum, int n, float t) ^
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/../util.h:323:41:
error: unknown type name 'T'
t * x * x *
static_cast<T> (n) / (n + 3));
^
In file included from
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/thread_11.cpp:1:
In file included from
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/threads.h:2:
In file included from
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/../raytracer.h:11:
In file included from
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/../shape.h:3:
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/../material.h:125:12:
error: C++ requires a type specifier for all declarations
constexpr DiffuseTex
(std::function<Vec3 (Vec3 point, Vec3 normal, UV uv)> func)
~~~~~~~~~ ^
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/../material.h:126:2:
error: only constructors take base initializers
: Material (VEC3_ZERO), func (func)
^
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/../material.h:131:74:
error: unexpected ';' before '}'
return { .is_scattered =
false, .attenuation = func (point, normal, uv); };
^
In file included from
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/thread_11.cpp:1:
In file included from
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/threads.h:2:
In file included from
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/../raytracer.h:12:
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/../sphere.h:40:22:
error: use of undeclared identifier 'p'
float phi = atan2 (p.z,
p.x);
^
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/../sphere.h:40:27:
error: use of undeclared identifier 'p'
float phi = atan2 (p.z,
p.x);
^
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/../sphere.h:41:23:
error: use of undeclared identifier 'p'
float theta = asin (p.y);
^
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/../sphere.h:38:15:
error: no return statement in constexpr function constexpr UV
get_sphere_uv (Vec3 const& point) const ^
Stack dump:
0. Program arguments: /usr/bin/clang++ -std=c++2a
-fconstexpr-steps=2147483647 -O3 -std=gnu++2a -MD -MT
CMakeFiles/cert.dir/src/threads/thread_11.cpp.o -MF
CMakeFiles/cert.dir/src/threads/thread_11.cpp.o.d -o
CMakeFiles/cert.dir/src/threads/thread_11.cpp.o -c
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/thread_11.cpp
1.
/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/thread_11.cpp:4:87:
current parser token ';'
/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x1f)[0x7f26bfa9ba7f]
/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0x50)[0x7f26bfa99d40]
/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm3sys15CleanupOnSignalEm+0xdd)[0x7f26bfa9b1cd]
/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1(+0x8ef880)[0x7f26bf9ef880]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7f26beef2890]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa3f0b7)[0x7f26bd0bf0b7]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa2adb4)[0x7f26bd0aadb4]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa31bcf)[0x7f26bd0b1bcf]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa2ac2e)[0x7f26bd0aac2e]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa48932)[0x7f26bd0c8932]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa480ce)[0x7f26bd0c80ce]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa8109a)[0x7f26bd10109a]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa2fa44)[0x7f26bd0afa44]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa79e88)[0x7f26bd0f9e88]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa2ab34)[0x7f26bd0aab34]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa80d6e)[0x7f26bd100d6e]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa2fa44)[0x7f26bd0afa44]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa79e88)[0x7f26bd0f9e88]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa2ab34)[0x7f26bd0aab34]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa3f4dd)[0x7f26bd0bf4dd]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa2adb4)[0x7f26bd0aadb4]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa2aab6)[0x7f26bd0aaab6]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa4b1ff)[0x7f26bd0cb1ff]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa4b301)[0x7f26bd0cb301]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa489ed)[0x7f26bd0c89ed]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa480ce)[0x7f26bd0c80ce]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa2ff6d)[0x7f26bd0aff6d]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa72b57)[0x7f26bd0f2b57]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa72252)[0x7f26bd0f2252]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa2adb4)[0x7f26bd0aadb4]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa30873)[0x7f26bd0b0873]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa2fb9c)[0x7f26bd0afb9c]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa72b57)[0x7f26bd0f2b57]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa72252)[0x7f26bd0f2252]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa2adb4)[0x7f26bd0aadb4]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa2aab6)[0x7f26bd0aaab6]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa4b1ff)[0x7f26bd0cb1ff]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa4b301)[0x7f26bd0cb301]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa489ed)[0x7f26bd0c89ed]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa480ce)[0x7f26bd0c80ce]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa2ff6d)[0x7f26bd0aff6d]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa8c467)[0x7f26bd10c467]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa8a276)[0x7f26bd10a276]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa2b67f)[0x7f26bd0ab67f]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa48932)[0x7f26bd0c8932]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa480ce)[0x7f26bd0c80ce]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa2ff6d)[0x7f26bd0aff6d]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa81dc0)[0x7f26bd101dc0]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0xa2ab34)[0x7f26bd0aab34]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZNK5clang4Expr21EvaluateAsInitializerERNS_7APValueERKNS_10ASTContextEPKNS_7VarDeclERN4llvm15SmallVectorImplISt4pairINS_14SourceLocationENS_17PartialDiagnosticEEEE+0x426)[0x7f26bd0abe86]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZNK5clang7VarDecl13evaluateValueERN4llvm15SmallVectorImplISt4pairINS_14SourceLocationENS_17PartialDiagnosticEEEE+0xa0)[0x7f26bd02b5a0]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZN5clang4Sema32CheckCompleteVariableDeclarationEPNS_7VarDeclE+0xc07)[0x7f26bd579957]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZN5clang4Sema20AddInitializerToDeclEPNS_4DeclEPNS_4ExprEb+0x15ec)[0x7f26bd577e3c]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZN5clang6Parser44ParseDeclarationAfterDeclaratorAndAttributesERNS_10DeclaratorERKNS0_18ParsedTemplateInfoEPNS0_12ForRangeInitE+0x121f)[0x7f26bce89a7f]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZN5clang6Parser14ParseDeclGroupERNS_15ParsingDeclSpecENS_17DeclaratorContextEPNS_14SourceLocationEPNS0_12ForRangeInitE+0x84d)[0x7f26bce8736d]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZN5clang6Parser30ParseDeclOrFunctionDefInternalERNS0_25ParsedAttributesWithRangeERNS_15ParsingDeclSpecENS_15AccessSpecifierE+0x33d)[0x7f26bcf1d92d]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZN5clang6Parser36ParseDeclarationOrFunctionDefinitionERNS0_25ParsedAttributesWithRangeEPNS_15ParsingDeclSpecENS_15AccessSpecifierE+0x17c)[0x7f26bcf1d33c]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZN5clang6Parser24ParseExternalDeclarationERNS0_25ParsedAttributesWithRangeEPNS_15ParsingDeclSpecE+0xaac)[0x7f26bcf1c4bc]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZN5clang6Parser17ParseTopLevelDeclERNS_9OpaquePtrINS_12DeclGroupRefEEEb+0x51c)[0x7f26bcf1a7fc]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZN5clang8ParseASTERNS_4SemaEbb+0x1fd)[0x7f26bce72fcd]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZN5clang14FrontendAction7ExecuteEv+0x48)[0x7f26be37e818]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x641)[0x7f26be336dd1]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0x63f)[0x7f26be3e2c5f]
/usr/bin/clang++(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0x9b0)[0x412370]
/usr/bin/clang++[0x410691]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(+0x1a02e22)[0x7f26be082e22]
/usr/lib/x86_64-linux-gnu/libLLVM-11.so.1(_ZN4llvm20CrashRecoveryContext9RunSafelyENS_12function_refIFvvEEE+0xd7)[0x7f26bf9ef687]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZNK5clang6driver10CC1Command7ExecuteEN4llvm8ArrayRefINS2_8OptionalINS2_9StringRefEEEEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb+0x140)[0x7f26be082380]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZNK5clang6driver11Compilation14ExecuteCommandERKNS0_7CommandERPS3_+0x2df)[0x7f26be05aaaf]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZNK5clang6driver11Compilation11ExecuteJobsERKNS0_7JobListERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x76)[0x7f26be05ac56]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.11(_ZN5clang6driver6Driver18ExecuteCompilationERNS0_11CompilationERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0xdc)[0x7f26be06ddfc]
/usr/bin/clang++(main+0x2430)[0x410010]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f26bb951b97]
/usr/bin/clang++(_start+0x2a)[0x40d91a]
clang: error: clang frontend command
failed due to signal (use -v to see invocation) clang version
11.0.0-++20200222063817+e48849a2404-1~exp1~20200222174409.1519
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note:
diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and
include the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run
script(s) are located at: clang: note:
diagnostic msg: /tmp/thread_11-8ccc99.cpp
clang: note: diagnostic msg: /tmp/thread_11-8ccc99.sh
clang: note: diagnostic msg:
********************
ninja: build stopped: subcommand failed.
Shell script: (because I couldn't see how to make multiple attachments)
# Crash reproducer for clang version
11.0.0-++20200222063817+e48849a2404-1~exp1~20200222174409.1519
# Driver args: "--driver-mode=g++" "-std=c++2a" "-fconstexpr-steps=2147483647"
"-O3" "-std=gnu++2a" "-MD" "-MT"
"CMakeFiles/cert.dir/src/threads/thread_0.cpp.o" "-MF"
"CMakeFiles/cert.dir/src/threads/thread_0.cpp.o.d" "-o"
"CMakeFiles/cert.dir/src/threads/thread_0.cpp.o" "-c"
"/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/thread_0.cpp"
# Original command: "/usr/lib/llvm-11/bin/clang" "-cc1" "-triple"
"x86_64-pc-linux-gnu" "-emit-obj" "-disable-free" "-disable-llvm-verifier"
"-discard-value-names" "-main-file-name" "thread_0.cpp" "-mrelocation-model"
"static" "-mthread-model" "posix" "-mframe-pointer=none" "-fmath-errno"
"-fdenormal-fp-math=ieee,ieee" "-fdenormal-fp-math-f32=ieee,ieee"
"-fno-rounding-math" "-masm-verbose" "-mconstructor-aliases" "-munwind-tables"
"-target-cpu" "x86-64" "-dwarf-column-info" "-fno-split-dwarf-inlining"
"-debugger-tuning=gdb" "-resource-dir" "/usr/lib/llvm-11/lib/clang/11.0.0"
"-dependency-file" "CMakeFiles/cert.dir/src/threads/thread_0.cpp.o.d" "-MT"
"CMakeFiles/cert.dir/src/threads/thread_0.cpp.o" "-sys-header-deps"
"-internal-isystem"
"/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0"
"-internal-isystem"
"/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0"
"-internal-isystem"
"/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0"
"-internal-isystem"
"/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/backward"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/lib/llvm-11/lib/clang/11.0.0/include" "-internal-externc-isystem"
"/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include"
"-internal-externc-isystem" "/usr/include" "-O3" "-std=gnu++2a"
"-fdeprecated-macro" "-fdebug-compilation-dir"
"/mnt/c/Users/cdgiessen/Documents/projects/cert/linux-build"
"-fconstexpr-steps" "2147483647" "-ferror-limit" "19" "-fmessage-length" "0"
"-fgnuc-version=4.2.1" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions"
"-fdiagnostics-show-option" "-vectorize-loops" "-vectorize-slp" "-faddrsig"
"-o" "CMakeFiles/cert.dir/src/threads/thread_0.cpp.o" "-x" "c++"
"/mnt/c/Users/cdgiessen/Documents/projects/cert/cert/src/threads/thread_0.cpp"
"/usr/lib/llvm-11/bin/clang" "-cc1" "-triple" "x86_64-pc-linux-gnu"
"-emit-obj" "-disable-free" "-disable-llvm-verifier" "-discard-value-names"
"-main-file-name" "thread_0.cpp" "-mrelocation-model" "static" "-mthread-model"
"posix" "-mframe-pointer=none" "-fmath-errno" "-fdenormal-fp-math=ieee,ieee"
"-fdenormal-fp-math-f32=ieee,ieee" "-fno-rounding-math" "-masm-verbose"
"-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64"
"-dwarf-column-info" "-fno-split-dwarf-inlining" "-debugger-tuning=gdb"
"-sys-header-deps" "-O3" "-std=gnu++2a" "-fdeprecated-macro"
"-fconstexpr-steps" "2147483647" "-ferror-limit" "19" "-fmessage-length" "0"
"-fgnuc-version=4.2.1" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions"
"-fdiagnostics-show-option" "-vectorize-loops" "-vectorize-slp" "-faddrsig"
"-x" "c++" "thread_0-0e75f1.cpp"
--
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/20200329/bf927e1a/attachment-0001.html>
More information about the llvm-bugs
mailing list