Commit: 8f0ca5e
Test code
nlohmann/json.hpp can be found at here
#include "nlohmann/json.hpp"
#include <iostream>
void aaa() {
// create an empty structure (null)
nlohmann::json j;
// add a number that is stored as double (note the implicit conversion of j to an object)
j["pi"] = 3.141;
// add a Boolean that is stored as bool
j["happy"] = true;
// add a string that is stored as std::string
j["name"] = "Niels";
// add another null object by passing nullptr
j["nothing"] = nullptr;
// add an object inside the object
j["answer"]["everything"] = 42;
// add an array that is stored as std::vector (using an initializer list)
j["list"] = { 1, 0, 2 };
// add another object (using an initializer list of pairs)
j["object"] = { {"currency", "USD"}, {"value", 42.99} };
std::string serialized_string = j.dump();
std::cout << serialized_string << "\n";
}
int main() {
for (int i=0; i<100; i++) {
aaa();
}
return 123;
}
Output
# clang++-19 -m32 -msoft-float -fno-exceptions -fno-rtti -O0 -g0 -S -emit-llvm -g 1.cpp
# llvm-cbe/build/tools/llvm-cbe/llvm-cbe 1.ll
LLVM ERROR: Code generator does not support intrinsic function 'llvm.is.fpclass.f64'!
#0 0x00007f7d06ab73c6 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-19/lib/libLLVM.so.19.1+0xeb73c6)
#1 0x00007f7d06ab5042 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-19/lib/libLLVM.so.19.1+0xeb5042)
#2 0x00007f7d06ab7a8b (/usr/lib/llvm-19/lib/libLLVM.so.19.1+0xeb7a8b)
#3 0x00007f7d05a5b050 (/lib/x86_64-linux-gnu/libc.so.6+0x3c050)
#4 0x00007f7d05aa9ebc __pthread_kill_implementation ./nptl/./nptl/pthread_kill.c:44:76
#5 0x00007f7d05a5afb2 raise ./signal/../sysdeps/posix/raise.c:27:6
#6 0x00007f7d05a45472 abort ./stdlib/./stdlib/abort.c:81:7
#7 0x00007f7d06a0bc24 llvm::report_fatal_error(llvm::Twine const&, bool) (/usr/lib/llvm-19/lib/libLLVM.so.19.1+0xe0bc24)
#8 0x00007f7d06ddf4f3 (/usr/lib/llvm-19/lib/libLLVM.so.19.1+0x11df4f3)
#9 0x0000557924541e47 llvm_cbe::CWriter::lowerIntrinsics(llvm::Function&) (/data3/llvm-cbe/build/tools/llvm-cbe/llvm-cbe+0x37e47)
#10 0x000055792452a29d llvm_cbe::CWriter::runOnFunction(llvm::Function&) (/data3/llvm-cbe/build/tools/llvm-cbe/llvm-cbe+0x2029d)
#11 0x00007f7d06c06504 llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/lib/llvm-19/lib/libLLVM.so.19.1+0x1006504)
#12 0x00007f7d06c0bdf3 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/lib/llvm-19/lib/libLLVM.so.19.1+0x100bdf3)
#13 0x00007f7d06c06c5e llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/llvm-19/lib/libLLVM.so.19.1+0x1006c5e)
#14 0x00005579245201f8 compileModule(char**, llvm::LLVMContext&) llvm-cbe.cpp:0:0
#15 0x000055792451f5ab main (/data3/llvm-cbe/build/tools/llvm-cbe/llvm-cbe+0x155ab)
#16 0x00007f7d05a4624a __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#17 0x00007f7d05a46305 call_init ./csu/../csu/libc-start.c:128:20
#18 0x00007f7d05a46305 __libc_start_main ./csu/../csu/libc-start.c:347:5
#19 0x000055792451ec01 _start (/data3/llvm-cbe/build/tools/llvm-cbe/llvm-cbe+0x14c01)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /data3/llvm-cbe/build/tools/llvm-cbe/llvm-cbe 1.ll
1. Running pass 'Function Pass Manager' on module '1.ll'.
2. Running pass 'C backend' on function '@_ZSt8isfinited'
[1] 3464385 IOT instruction (core dumped) llvm-cbe/build/tools/llvm-cbe/llvm-cbe 1.ll
Commit: 8f0ca5e
Test code
nlohmann/json.hppcan be found at hereOutput