projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
11d36d9
)
Clamp -O flag to beween 0 and 2
author
simonpj@microsoft.com
<unknown>
Mon, 25 Jun 2007 15:26:16 +0000
(15:26 +0000)
committer
simonpj@microsoft.com
<unknown>
Mon, 25 Jun 2007 15:26:16 +0000
(15:26 +0000)
Fixes Trac #1272
compiler/main/DynFlags.hs
patch
|
blob
|
history
diff --git
a/compiler/main/DynFlags.hs
b/compiler/main/DynFlags.hs
index
b992228
..
7b06a48
100644
(file)
--- a/
compiler/main/DynFlags.hs
+++ b/
compiler/main/DynFlags.hs
@@
-561,13
+561,14
@@
data Option
updOptLevel :: Int -> DynFlags -> DynFlags
-- Set dynflags appropriate to the optimisation level
updOptLevel n dfs
updOptLevel :: Int -> DynFlags -> DynFlags
-- Set dynflags appropriate to the optimisation level
updOptLevel n dfs
- = dfs2{ optLevel = n }
+ = dfs2{ optLevel = final_n }
where
where
+ final_n = max 0 (min 2 n) -- Clamp to 0 <= n <= 2
dfs1 = foldr (flip dopt_unset) dfs remove_dopts
dfs2 = foldr (flip dopt_set) dfs1 extra_dopts
dfs1 = foldr (flip dopt_unset) dfs remove_dopts
dfs2 = foldr (flip dopt_set) dfs1 extra_dopts
- extra_dopts = [ f | (ns,f) <- optLevelFlags, n `elem` ns ]
- remove_dopts = [ f | (ns,f) <- optLevelFlags, n `notElem` ns ]
+ extra_dopts = [ f | (ns,f) <- optLevelFlags, final_n `elem` ns ]
+ remove_dopts = [ f | (ns,f) <- optLevelFlags, final_n `notElem` ns ]
optLevelFlags :: [([Int], DynFlag)]
optLevelFlags
optLevelFlags :: [([Int], DynFlag)]
optLevelFlags