From e88a2f4178c3ca1f12752bcbbfdef532b172addb Mon Sep 17 00:00:00 2001 From: Bertrand Bellenot Date: Thu, 22 Jun 2023 11:21:40 +0200 Subject: [PATCH] [windows] work-around a compiler bug with VS 2022 v17.6.0 Fix a crash in root.exe due to a compiler bug with Visual Studio 2022 v17.6.0. The fix works the same way than it is supposed to do, since the (never reached) `default: break;` statement make the function returns `HasREX` anyway. To be reviewed and removed as soon as VS works again. --- interpreter/llvm/llvm-project.tag | 2 +- .../src/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/interpreter/llvm/llvm-project.tag b/interpreter/llvm/llvm-project.tag index 18b7d1ecafdab..1d57ad0c79aeb 100644 --- a/interpreter/llvm/llvm-project.tag +++ b/interpreter/llvm/llvm-project.tag @@ -1 +1 @@ -ROOT-llvm13-20230517-02 +ROOT-llvm13-20230623-01 diff --git a/interpreter/llvm/src/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp b/interpreter/llvm/src/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp index 714d2d839054d..c66ae29c7ae11 100644 --- a/interpreter/llvm/src/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp +++ b/interpreter/llvm/src/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp @@ -703,6 +703,13 @@ bool X86MCCodeEmitter::emitPrefixImpl(unsigned &CurOp, const MCInst &MI, HasREX = emitOpcodePrefix(MemoryOperand, MI, STI, OS); uint64_t Form = TSFlags & X86II::FormMask; + // FIXME (bellenot): Visual Studio v17.6.0 makes root.exe crash + // at the switch statement with Form being 0x002 or 0x001, values + // normally going to the 'default' switch branch, so the behavior + // doesn't change. + // To be reviewed and removed as soon as VS works again + if (Form <= 0x002) + return HasREX; switch (Form) { default: break;