-
Notifications
You must be signed in to change notification settings - Fork 154
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
Enabling -O2 breaks Clash.Magic.clashSimulation #2736
Comments
clashSimulation = True
{-# OPAQUE clashSimulation #-} When enabled topEntity = case clashSimulation of
False -> b
True -> a into topEntity = a @christiaanb does this violate the contract of |
I guess it follows the letter of the contract, but not the spirit...
Since |
You could try compiling |
Maybe clashSimulation = unsafePerformIO (fromMaybe True <$> lookupEnv "XXX_ISSUE_2736")
{-# OPAQUE clashSimulation #-} Should be a |
Together with @leonschoorl we discoved that import GHC.Magic (noinline)
clashSimulation = noinline True
{-# OPAQUE clashSimulation #-} is a workaround/proper fix. At least it's not something where we need to wait for a new GHC release with a changed behavior with respect to OPAQUE. |
Related perhaps: #2570 ? |
@rowanG077 I don't think so, here the problem is happening inside a transformation inside GHC, with #2570 it seems to be inside transformations in clash |
When running clash on modules compiled by GHC, like in a starter-project setup, enabling
-O2
can breakClash.Magic.clashSimulation
.Specifically it's the option
-fspec-constr
, which is implied by-O2
.Steps to reproduce:
Change contents of
src/Example/Project.hs
to:or
Result:
We're living in a simulation 😱
This doesn't happen when running clash directly on the source file.
The text was updated successfully, but these errors were encountered: