[clang] [compiler-rt] [llvm] [SPARC] Properly handle CC for long double on sparc32 (PR #162226)

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 27 05:32:56 PST 2025


================
@@ -1009,9 +1009,9 @@ else ()
         list(APPEND BUILTIN_CFLAGS_${arch} -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET)
       endif()
 
-      # For RISCV32, we must force enable int128 for compiling long
+      # For RISCV32 and 32-bit SPARC, we must force enable int128 for compiling long
       # double routines.
-      if(COMPILER_RT_ENABLE_SOFTWARE_INT128 OR "${arch}" STREQUAL "riscv32")
+      if(COMPILER_RT_ENABLE_SOFTWARE_INT128 OR "${arch}" STREQUAL "riscv32" OR ("${arch}" STREQUAL "sparc" AND NOT CMAKE_COMPILER_IS_GNUCC))
----------------
koachan wrote:

Thanks for the hint! I tried running it and seems like I found some other long double related failures:
```
SanitizerCommon-asan-sparc-Linux :: printf-ldbl.c
SanitizerCommon-asan-sparc-Linux :: scanf-ldbl.c
SanitizerCommon-ubsan-sparc-Linux :: printf-ldbl.c                                                                                                                                                                                                                            
SanitizerCommon-ubsan-sparc-Linux :: scanf-ldbl.c
```
Because clang lowers the printf/scanf calls into something like `__nldbl_snprintf` and `__nldbl___isoc99_sscanf`...
Seems like I missed defining `__LONG_DOUBLE_128__`, lemme fix this.

https://github.com/llvm/llvm-project/pull/162226


More information about the llvm-commits mailing list