[all-commits] [llvm/llvm-project] 39402c: [compiler-rt][ubsan] Refactor cast-overflow test (...

Alexander Shaposhnikov via All-commits all-commits at lists.llvm.org
Mon Mar 3 12:33:20 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 39402cde6149b5a9f5d48455959df350dfe63017
      https://github.com/llvm/llvm-project/commit/39402cde6149b5a9f5d48455959df350dfe63017
  Author: Alexander Shaposhnikov <ashaposhnikov at google.com>
  Date:   2025-03-03 (Mon, 03 Mar 2025)

  Changed paths:
    M compiler-rt/test/ubsan/TestCases/Float/cast-overflow.cpp

  Log Message:
  -----------
  [compiler-rt][ubsan] Refactor cast-overflow test (#129460)

This PR cleans up cast-overflow.cpp, more specifically:
1. avoid using undefined value as an exit code (old case `9`)
2. narrowing conversions are allowed to produce `inf` and they are
well-defined. Remove dead code (old case `8`)
3. the same applies to the conversion int -> float16. Remove dead code
(old case `7`)

See also
https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#:~:text=%2Dfsanitize%3Dfloat%2Dcast,to%20integer%20types.

Currently ubsan doesn't properly detect UB on float16 -> int casts, I
have a fix for that (will send as a separate PR).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list