[llvm] [Flang-rt][build] fixes building warnings under gcc: (PR #173955)
Eugene Epshteyn via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 1 04:35:08 PST 2026
================
@@ -452,7 +452,13 @@ float RTNAME(Rand)(int *i, const char *sourceFile, int line) {
if (radix == 2) {
mask = ~(unsigned)0u << (32 - digits + 1);
} else if (radix == 16) {
- mask = ~(unsigned)0u << ((8 - digits) * 4 + 1);
+ int shift_val = ((8 - digits) * 4 + 1);
+ if (shift_val < 0) {
+ Terminator terminator{sourceFile, line};
+ terminator.Crash("Radix 16: negative shift for mask. digits value maybe invalid.");
+ } else {
+ mask = ~(unsigned)0u << shift_val;
+ }
----------------
eugeneepshteyn wrote:
I don't mind removing `radix == 16` case if it's not used. Let's wait for @JDPailleux to comment.
https://github.com/llvm/llvm-project/pull/173955
More information about the llvm-commits
mailing list