From 3e3b8af96d4d957b77588be91df7715efbe2ed69 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Mon, 6 Nov 2023 14:58:17 -0500 Subject: [PATCH] Add check for 128-bit pointers Thanks to Andy Polyakov --- validat3.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/validat3.cpp b/validat3.cpp index 2cef7b60..b0d9e694 100644 --- a/validat3.cpp +++ b/validat3.cpp @@ -256,23 +256,43 @@ bool TestSettings() pass = false; } + // Machine word size does not agree with pointer size on Morello. Also see + // https://developer.arm.com/documentation/den0133/0100/Morello-prototype-architecture/Pointers-and-capabilities + if (sizeof(size_t) == 16) + { + std::cout << "passed: Your machine has 128-bit words.\n"; + } + else if (sizeof(size_t) == 8) + { + std::cout << "passed: Your machine has 64-bit words.\n"; + } + else if (sizeof(size_t) == 4) + { + std::cout << "passed: Your machine has 32-bit words.\n"; + } + else + { + std::cout << "FAILED: Your machine uses unknown word size.\n"; + pass = false; + } + // Morello uses 129-bit pointers. Also see // https://developer.arm.com/documentation/den0133/0100/Morello-prototype-architecture/Pointers-and-capabilities if (sizeof(void*) == 16) { - std::cout << "passed: Your machine is 128-bit.\n"; + std::cout << "passed: Your machine has 128-bit pointers.\n"; } else if (sizeof(void*) == 8) { - std::cout << "passed: Your machine is 64-bit.\n"; + std::cout << "passed: Your machine has 64-bit pointers.\n"; } else if (sizeof(void*) == 4) { - std::cout << "passed: Your machine is 32-bit.\n"; + std::cout << "passed: Your machine has 32-bit pointers.\n"; } else { - std::cout << "FAILED: Your machine is neither 32-bit nor 64-bit.\n"; + std::cout << "FAILED: Your machine uses unknown pointer size.\n"; pass = false; }