Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-emit-supported-features driver option is not handled #74910

Open
rjmansfield opened this issue Jul 2, 2024 · 1 comment · May be fixed by swiftlang/swift-driver#1645 or #75061
Open

-emit-supported-features driver option is not handled #74910

rjmansfield opened this issue Jul 2, 2024 · 1 comment · May be fixed by swiftlang/swift-driver#1645 or #75061
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. driver

Comments

@rjmansfield
Copy link
Contributor

Description

Using both the new and older driver results in unhandled output modes.

$ swiftc -emit-supported-features
SwiftDriver/Driver.swift:2116: Fatal error: unhandled output mode option -emit-supported-features
Trace/BPT trap: 5
$ SWIFT_USE_OLD_DRIVER=1 ~/swift/build/Ninja-DebugAssert/swift-macosx-arm64/bin/swiftc -emit-supported-features 
<unknown>:0: warning: legacy driver is now deprecated; consider avoiding specifying '-disallow-use-new-driver'
unknown mode
UNREACHABLE executed at /Users/ryan_mansfield/swift/swift/lib/Driver/Driver.cpp:1237!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /Users/ryan_mansfield/swift/build/Ninja-DebugAssert/swift-macosx-arm64/bin/swiftc-legacy-driver -emit-supported-features
1.	Swift version 6.0-dev (LLVM 6b6d1cefaf4b4cc, Swift f7b4c4b26aa8116)
2.	Compilation construction
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend           0x0000000112117e60 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 80
1  swift-frontend           0x000000011211835c PrintStackTraceSignalHandler(void*) + 28
2  swift-frontend           0x00000001121164cc llvm::sys::RunSignalHandlers() + 152
3  swift-frontend           0x00000001121190c8 SignalHandler(int) + 276
4  libsystem_platform.dylib 0x0000000192f7ab64 _sigtramp + 56
5  libsystem_pthread.dylib  0x0000000192f44f50 pthread_kill + 288
6  libsystem_c.dylib        0x0000000192e51908 abort + 128
7  swift-frontend           0x0000000111ffc780 llvm::install_out_of_memory_new_handler() + 0
8  swift-frontend           0x0000000106dad228 swift::driver::Driver::buildOutputInfo(swift::driver::ToolChain const&, llvm::opt::DerivedArgList const&, bool, llvm::SmallVector<std::__1::pair<swift::file_types::ID, llvm::opt::Arg const*>, 16u> const&, swift::driver::OutputInfo&) const + 2928
9  swift-frontend           0x0000000106daabb4 swift::driver::Driver::buildCompilation(swift::driver::ToolChain const&, std::__1::unique_ptr<llvm::opt::InputArgList, std::__1::default_delete<llvm::opt::InputArgList>>, bool) + 696
10 swift-frontend           0x0000000104b07890 run_driver(llvm::StringRef, llvm::ArrayRef<char const*>, llvm::ArrayRef<char const*>) + 4712
11 swift-frontend           0x0000000104b05b80 swift::mainEntry(int, char const**) + 1160
12 swift-frontend           0x0000000104b053c0 main + 36
13 dyld                     0x0000000192bc3274 start + 2840
Abort trap: 6

Reproduction

$ swiftc -emit-supported-features
SwiftDriver/Driver.swift:2116: Fatal error: unhandled output mode option -emit-supported-features
Trace/BPT trap: 5

Expected behavior

The option as handled as described in the help message

  -emit-supported-features
                          Emit a JSON file including all supported compiler features

Environment

Swift version 6.0-dev (LLVM 6b6d1cefaf4b4cc, Swift f7b4c4b26aa8116)
Target: arm64-apple-macosx15.0

Additional information

No response

@rjmansfield rjmansfield added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Jul 2, 2024
rjmansfield added a commit to rjmansfield/swift-driver that referenced this issue Jul 2, 2024
rjmansfield added a commit to rjmansfield/swift that referenced this issue Jul 8, 2024
@rjmansfield
Copy link
Contributor Author

While this fixes the fatal error about the mode being unhandled, I noticed the behaviour of -emit-supported-features differs from that of the legacy driver in that the old driver would emit the json to stdout without an -o specified, while the new swift-driver will emit it to file e.g. hw.compilerFeatures-1.json. I'm not sure if this behaviour change is intentional, from emitSupportedCompilerFeaturesJob it looks like it should default to stdout.

@hborla hborla added driver and removed triage needed This issue needs more specific labels labels Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. driver
Projects
None yet
2 participants