swift icon indicating copy to clipboard operation
swift copied to clipboard

Concurrency: remove workaround for silencing UB

Open compnerd opened this issue 9 months ago • 11 comments

The newer clang properly identifies UB on invalid pointer casts. This was previously being silenced by suppressing the warnings. Adjust the code to use std::bit_cast (or the shim implementation) to avoid the UB in this code.

compnerd avatar Mar 24 '25 18:03 compnerd

@swift-ci please smoke test

compnerd avatar Mar 24 '25 18:03 compnerd

@swift-ci please smoke test Linux platform

compnerd avatar Mar 24 '25 19:03 compnerd

@swift-ci please smoke test Linux platform

compnerd avatar Mar 24 '25 20:03 compnerd

@swift-ci please smoke test macOS platform

compnerd avatar Mar 24 '25 20:03 compnerd

@swift-ci please smoke test Linux platform

compnerd avatar Mar 24 '25 22:03 compnerd

@swift-ci please smoke test macOS platform

compnerd avatar Mar 24 '25 23:03 compnerd

@swift-ci please smoke test macOS platform

compnerd avatar Mar 25 '25 05:03 compnerd

@swift-ci please smoke test macOS platform

compnerd avatar Mar 25 '25 15:03 compnerd

macOS failures:

Failed Tests (3):
  Swift(macosx-x86_64) :: embedded/dependencies-concurrency-custom-executor.swift
  Swift(macosx-x86_64) :: embedded/dependencies-concurrency.swift
  Swift(macosx-x86_64) :: embedded/dependencies-concurrency2.swift

are because we gained a "memcpy" dependency:

******************** TEST 'Swift(macosx-x86_64) :: embedded/dependencies-concurrency-custom-executor.swift' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
___assert_rtn
___stack_chk_fail
___stack_chk_guard
_abort
_clock_gettime
_exit
_free
_malloc
_memcpy
_memmove
_memset_s
_posix_memalign
_putchar
_puts
_strlen
_strncpy
_vprintf
_vsnprintf
...
+ test -z _memcpy

Adding "memcpy" to the allowlist of deps should resolve it.

kubamracek avatar Mar 26 '25 16:03 kubamracek

Is there a reason that these tests are macOS only?

compnerd avatar Mar 27 '25 15:03 compnerd

@swift-ci please smoke test

compnerd avatar Mar 27 '25 15:03 compnerd

@swift-ci please test Windows platform

compnerd avatar Mar 28 '25 20:03 compnerd