Skip to content

Commit

Permalink
Don't allow __int128 for purecap 32-bit targets
Browse files Browse the repository at this point in the history
We were incorrectly checking for pointer width rather than pointer range.
  • Loading branch information
arichardson committed Feb 9, 2024
1 parent 3f43128 commit 492b8b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/TargetInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions clang/test/Sema/cheri/32bit-int128.c
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 492b8b2

Please sign in to comment.