<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/87944>87944</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
C++ parser crash with too many user-defined literals in an expression
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
christinabrien
</td>
</tr>
</table>
<pre>
[clang-crash.zip](https://github.com/llvm/llvm-project/files/14899001/clang-crash.zip)
The C++ parser crashes with "Illegal instruction" when compiling a C++ file with a very long expression consisting of user-defined literals. My use-case is in creating a bitstring from smaller bitstring literals.
I have used creduce to produce a minimal test case; removing a single expression avoids the crash. I believe this is valid C++ and is compiled correctly by GCC 13.2.0. I have included the creduce interestingness test.
```
christina@Orange:~/pi/all/top/clash/minimised$ ./test.sh
0
christina@Orange:~/pi/all/top/clash/minimised$ ./compile.sh
./compile.sh: line 4: 43889 Illegal instruction: 4 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" "-cc1" "-triple" "x86_64-apple-macosx12.0.0" "-Wundef-prefix=TARGET_OS_" "-Wdeprecated-objc-isa-usage" "-Werror=deprecated-objc-isa-usage" "-Werror=implicit-function-declaration" "-emit-obj" "--mrelax-relocations" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "AdaptationParameterSet.test.c++" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=all" "-mllvm" "-extra-vectorizer-passes" "-fno-strict-return" "-fno-rounding-math" "-funwind-tables=2" "-target-sdk-version=13.1" "-fvisibility-inlines-hidden-static-local-var" "-target-cpu" "skylake" "-debug-info-kind=standalone" "-dwarf-version=4" "-debugger-tuning=lldb" "-target-linker-version" "820.1" "-skip-unused-modulemap-deps" "-sys-header-deps" "-stdlib=libc++" "-O3" "-Werror" "-Wno-c++11-narrowing" "-Wno-ignored-attributes" "-Wno-c++20-extensions" "-Wno-c++17-extensions" "-Wno-reorder-init-list" "-Wno-implicit-int-float-conversion" "-Wno-c99-designator" "-Wno-final-dtor-non-final-class" "-Wno-extra-semi-stmt" "-Wno-misleading-indentation" "-Wno-quoted-include-in-framework-header" "-Wno-implicit-fallthrough" "-Wno-enum-enum-conversion" "-Wno-enum-float-conversion" "-Wno-elaborated-enum-base" "-Wno-reserved-identifier" "-Wno-gnu-folding-constant" "-Wno-cast-function-type" "-Wno-bitwise-instead-of-logical" "-std=c++14" "-fdeprecated-macro" "-fdebug-compilation-dir=/Users/christina/pi/all/top" "-ferror-limit" "19" "-stack-protector" "1" "-fstack-check" "-mdarwin-stkchk-strong-link" "-fblocks" "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" "-fgnuc-version=4.2.1" "-fno-cxx-modules" "-fcxx-exceptions" "-fexceptions" "-fmax-type-align=16" "-fcommon" "-vectorize-loops" "-vectorize-slp" "-clang-vendor-feature=+messageToSelfInClassMethodIdReturnType" "-clang-vendor-feature=+disableInferNewAvailabilityFromInit" "-clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation" "-fno-odr-hash-protocols" "-clang-vendor-feature=+enableAggressiveVLAFolding" "-clang-vendor-feature=+revert09abecef7bbf" "-clang-vendor-feature=+thisNoAlignAttr" "-clang-vendor-feature=+thisNoNullAttr" "-mllvm" "-disable-aligned-alloc-awareness=1" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-x" "c++" "too-many-literals-in-expression.cpp"
christina@Orange:~/pi/all/top/clash/minimised$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8WF9v4zgO_zTui6DAUdI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