Skip to content

Conversation

delcypher
Copy link

In rdar://158088410
(#11455) the -funique-traps flag was removed in favor of a different implementation controlled by the -fbounds-safety-unique-traps flag.

It turns out the -funique-traps flag is being used by an adopter of -fbounds-safety. To unbreak adopters of the flag this patch reintroduces the old flag (and its negation) as an alias of
-fbounds-safety-unique-traps (-fno-bounds-safety-unique-traps) along with a diagnostic warning that -funique-traps (-fno-unique-traps) is deprecated.

This patch doesn't use the Alias<> mixin in the
clang/Driver/Options.td so "technically" at the implementation level -funique-traps isn't an alias of -fbounds-safety-unique-traps. This is done so that is possible distinguish use of the legacy flag from the new flag so that it is possible emit a deprecation warning. However, from the user's perspective -funique-traps and
-fbounds-safety-unique-traps are aliases.

We should remove -funique-traps eventually and that is tracked by rdar://162215869.

rdar://162204734
(cherry picked from commit 38b7776)

…bounds-safety-unique-traps`

In rdar://158088410
(swiftlang#11455) the
`-funique-traps` flag was removed in favor of a different implementation
controlled by the `-fbounds-safety-unique-traps` flag.

It turns out the `-funique-traps` flag is being used by an adopter of
`-fbounds-safety`. To unbreak adopters of the flag this patch reintroduces
the old flag (and its negation) as an alias of
`-fbounds-safety-unique-traps` (`-fno-bounds-safety-unique-traps`) along
with a diagnostic warning that `-funique-traps` (`-fno-unique-traps`) is
deprecated.

This patch doesn't use the `Alias<>` mixin in the
`clang/Driver/Options.td` so "technically" at the implementation level
`-funique-traps` isn't an alias of `-fbounds-safety-unique-traps`. This
is done so that is possible distinguish use of the legacy flag from the
new flag so that it is possible emit a deprecation warning. However,
from the user's perspective `-funique-traps` and
`-fbounds-safety-unique-traps` are aliases.

We should remove `-funique-traps` eventually and that is tracked by
rdar://162215869.

rdar://162204734
(cherry picked from commit 38b7776)
@delcypher delcypher self-assigned this Oct 9, 2025
@delcypher delcypher added the clang:bounds-safety Issue relating to the experimental -fbounds-safety feature in Clang label Oct 9, 2025
@delcypher
Copy link
Author

@swift-ci test llvm

@delcypher
Copy link
Author

@swift-ci test

@delcypher delcypher changed the title [BoundsSafety] Re-introduce -funique-traps as a legacy alias of -fbounds-safety-unique-traps 🍒 [BoundsSafety] Re-introduce -funique-traps as a legacy alias of -fbounds-safety-unique-traps Oct 9, 2025
@delcypher
Copy link
Author

Windows testing failed due to timeout:

19:16:48  PASS: lldb-shell :: Expr/TestIRMemoryMapWindows.test (2461 of 2462)
21:30:31  Cancelling nested steps due to timeout
21:30:31  Sending interrupt signal to process
21:30:41  Error: Error: cmake.exe exited with code -1.
21:30:41  Invocation:
21:30:41    C:\Program Files\CMake\bin\cmake.exe --build T:\5 --target check-lldb
21:30:41  Call stack:
21:30:41    at Invoke-Program, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 1046
21:30:41    at <ScriptBlock>, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 1882
21:30:41    at Invoke-IsolatingEnvVars, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 1065
21:30:41    at Build-CMakeProject, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 1472
21:30:41    at <ScriptBlock>, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 2293
21:30:41    at Invoke-IsolatingEnvVars, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 1065
21:30:41    at Test-Compilers, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 2237
21:30:41    at <ScriptBlock>, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 829
21:30:41    at Record-OperationTime, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 653
21:30:41    at Invoke-BuildStep, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 828
21:30:41    at <ScriptBlock>, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 4301
21:30:41  
21:30:41      at Invoke-Program, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 1050
21:30:41      at <ScriptBlock>, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 1882
21:30:41      at Invoke-IsolatingEnvVars, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 1065
21:30:41      at Build-CMakeProject, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 1472
21:30:41      at <ScriptBlock>, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 2293
21:30:41      at Invoke-IsolatingEnvVars, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 1065
21:30:41      at Test-Compilers, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 2237
21:30:41      at <ScriptBlock>, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 829
21:30:41      at Record-OperationTime, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 653
21:30:41      at Invoke-BuildStep, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 828
21:30:41      at <ScriptBlock>, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 4301
21:30:41    From System.Management.Automation.RuntimeException: Error: cmake.exe exited with code -1.
21:30:41    Invocation:
21:30:41      C:\Program Files\CMake\bin\cmake.exe --build T:\5 --target check-lldb
21:30:41    Call stack:
21:30:41      at Invoke-Program, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 1046
21:30:41      at <ScriptBlock>, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 1882
21:30:41      at Invoke-IsolatingEnvVars, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 1065
21:30:41      at Build-CMakeProject, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 1472
21:30:41      at <ScriptBlock>, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 2293
21:30:41      at Invoke-IsolatingEnvVars, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 1065
21:30:41      at Test-Compilers, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 2237
21:30:41      at <ScriptBlock>, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 829
21:30:41      at Record-OperationTime, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 653
21:30:41      at Invoke-BuildStep, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 828
21:30:41      at <ScriptBlock>, C:\Users\swift-ci\jenkins\workspace\apple-llvm-project-pull-request-windows\swift\utils\build.ps1: line 4301

@delcypher
Copy link
Author

@swift-ci Please test Windows platform

@delcypher delcypher merged commit d7be913 into swiftlang:stable/21.x Oct 10, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:bounds-safety Issue relating to the experimental -fbounds-safety feature in Clang

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant