Commit f2d9fb0c authored by Roland Senn's avatar Roland Senn Committed by Ben Gamari

Calling gcc: Pass optc flags as last options (#14452)

Test Plan: make test TEST=T14452

Reviewers: hvr, bgamari, monoidal, thomie, osa1

Reviewed By: osa1

Subscribers: rwbarton, carter

GHC Trac Issues: #14452

Differential Revision:
parent 014d6c1f
......@@ -62,7 +62,9 @@ runCc :: DynFlags -> [Option] -> IO ()
runCc dflags args = do
let (p,args0) = pgm_c dflags
args1 = map Option (getOpts dflags opt_c)
args2 = args0 ++ args1 ++ args
args2 = args0 ++ args ++ args1
-- We take care to pass -optc flags in args1 last to ensure that the
-- user can override flags passed by GHC. See #14452.
mb_env <- getGccEnv args2
runSomethingResponseFile dflags cc_filter "C Compiler" p args2 mb_env
......@@ -668,3 +668,8 @@ T12955:
mkdir -p ä
TMP=ä "$(TEST_HC)" $(TEST_HC_OPTS) --make T12971
.PHONY: T14452
"$(TEST_HC)" $(TEST_HC_OPTS) -v -c -O2 T14452.hs 2>&1 | grep 'O3' \
| awk 'NF{print $$NF; exit}' # awk: extract last word of line
{-# OPTIONS_GHC -optc-O3 #-}
module T14452 where
foreign import capi unsafe "stdlib.h exit" c_exit :: Int -> IO ()
......@@ -283,4 +283,5 @@ test('inline-check', omit_ways(['hpc', 'profasm'])
, compile
, ['-dinline-check foo -O -ddebug-output'])
test('T14452', [], run_command, ['$MAKE -s --no-print-directory T14452'])
test('T15396', normal, compile_and_run, ['-package ghc'])
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment