kfdtest: Check for NULL at MCABackend creation

The function can return NULL if it fails to create the backend, so check
for NULL before using it.

Change-Id: I4d6501bffd6dd0fc0d0f2224720f7d6dca1646f3
Signed-off-by: Kent Russell <kent.russell@amd.com>


[ROCm/ROCR-Runtime commit: 545467be04]
This commit is contained in:
Kent Russell
2024-09-03 08:30:09 -04:00
parent b56dd0ef3b
commit 418b4d2006
@@ -350,6 +350,11 @@ int Assembler::RunAssemble(const char* const AssemblySource) {
#endif
MCAsmBackend* MAB = TheTarget->createMCAsmBackend(*STI, *MRI, MCOptions);
if (!MAB) {
outs() << "ASM Error: Unable to create MCA Backend\n";
return -1;
}
std::unique_ptr<MCStreamer> Streamer(TheTarget->createMCObjectStreamer(
TheTriple, Ctx,
std::unique_ptr<MCAsmBackend>(MAB), MAB->createObjectWriter(*OS),