From cc2bda505893a65fdc118cb4ccb1c6325dfcc633 Mon Sep 17 00:00:00 2001 From: adithyaov Date: Mon, 7 Oct 2019 03:54:09 +0530 Subject: Compiling with -S and -fno-code no longer panics (fixes #17143) --- ghc/Main.hs | 4 ++++ testsuite/tests/driver/T17143.hs | 2 ++ testsuite/tests/driver/T17143.stderr | 2 ++ testsuite/tests/driver/all.T | 2 ++ 4 files changed, 10 insertions(+) create mode 100644 testsuite/tests/driver/T17143.hs create mode 100644 testsuite/tests/driver/T17143.stderr diff --git a/ghc/Main.hs b/ghc/Main.hs index 4cdf3ecb94..b66f567d2f 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -385,6 +385,10 @@ checkOptions mode dflags srcs objs = do StopBefore HCc | hscTarget dflags /= HscC -> throwGhcException $ UsageError $ "the option -C is only available with an unregisterised GHC" + StopBefore (As False) | ghcLink dflags == NoLink + -> throwGhcException $ UsageError $ + "the options -S and -fno-code are incompatible. Please omit -S" + _ -> return () -- Verify that output files point somewhere sensible. diff --git a/testsuite/tests/driver/T17143.hs b/testsuite/tests/driver/T17143.hs new file mode 100644 index 0000000000..d61ecb5dc7 --- /dev/null +++ b/testsuite/tests/driver/T17143.hs @@ -0,0 +1,2 @@ + +main = print "Hello world" diff --git a/testsuite/tests/driver/T17143.stderr b/testsuite/tests/driver/T17143.stderr new file mode 100644 index 0000000000..9573467e84 --- /dev/null +++ b/testsuite/tests/driver/T17143.stderr @@ -0,0 +1,2 @@ +ghc: the options -S and -fno-code are incompatible. Please omit -S +Usage: For basic information, try the `--help' option. \ No newline at end of file diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T index 370e360fc0..239a70d2ba 100644 --- a/testsuite/tests/driver/all.T +++ b/testsuite/tests/driver/all.T @@ -277,3 +277,5 @@ test('T16737', req_th, expect_broken_for(16541, ['ghci'])], compile_and_run, ['-optP=-isystem -optP=T16737include']) + +test('T17143', exit_code(1), run_command, ['{compiler} T17143.hs -S -fno-code']) \ No newline at end of file -- cgit v1.2.1