From 492b8b25bb41505045d8df85a399c5babb395996 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 9 Feb 2024 15:36:26 -0800 Subject: [PATCH] Don't allow __int128 for purecap 32-bit targets We were incorrectly checking for pointer width rather than pointer range. --- clang/include/clang/Basic/TargetInfo.h | 2 +- clang/test/Sema/cheri/32bit-int128.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h index 642ea11e5e9c..c27f2db03f86 100644 --- a/clang/include/clang/Basic/TargetInfo.h +++ b/clang/include/clang/Basic/TargetInfo.h @@ -620,7 +620,7 @@ class TargetInfo : public virtual TransferrableTargetInfo, /// Determine whether the __int128 type is supported on this target. virtual bool hasInt128Type() const { - return (getPointerWidth(0) >= 64) || getTargetOpts().ForceEnableInt128; + return (getPointerRange(0) >= 64) || getTargetOpts().ForceEnableInt128; } // FIXME /// Determine whether the _BitInt type is supported on this target. This diff --git a/clang/test/Sema/cheri/32bit-int128.c b/clang/test/Sema/cheri/32bit-int128.c index e4a82492234b..7de1c9aadbe9 100644 --- a/clang/test/Sema/cheri/32bit-int128.c +++ b/clang/test/Sema/cheri/32bit-int128.c @@ -1,13 +1,11 @@ -/// Check that CHERI LLVM prohibits __int128 for 32-bit targets +/// Check that CHERI LLVM prohibits __int128 for 32-bit targets // RUN: %riscv32_cheri_cc1 -fsyntax-only -verify=expected32 %s -// RUN: %riscv32_cheri_purecap_cc1 -fsyntax-only -verify=fixme32 %s +// RUN: %riscv32_cheri_purecap_cc1 -fsyntax-only -verify=expected32 %s // RUN: %riscv32_cheri_cc1 -fsyntax-only -fforce-enable-int128 -verify=force-enable %s // RUN: %riscv32_cheri_purecap_cc1 -fsyntax-only -fforce-enable-int128 -verify=force-enable %s // RUN: %riscv64_cheri_cc1 -fsyntax-only -verify=expected64 %s // RUN: %riscv64_cheri_purecap_cc1 -fsyntax-only -verify=expected64 %s -// FIXME: Should not enable int128 for 32-bit purecap -// fixme32-no-diagnostics // expected64-no-diagnostics // force-enable-no-diagnostics