Skip to content

GLOBAL_VAR being inlined?

I noticed that :def wasn't working in my HEAD (as of today) build of ghc. It would accept my command definitions silently, but they were ignored.

In InteractiveUI:

GLOBAL_VAR(commands, builtin_commands, [Command])

builtin_commands :: [Command]
builtin_commands = [ ...

After a random change :

builtin_commands = commands `seq` [ 
....
]

it seems to me that, under certain conditions (which?), GLOBAL_VARs can end up being inlined.

To see if you can reproduce this issue, simply try defining a new command in a -O2 HEAD build of ghci using :def, and then calling it.

Output of ghci005 here in my build of HEAD:

unknown command ':echo'
use :? for help.
unknown command ':echo'
use :? for help.
command 'echo' not defined
unknown command ':echo'
use :? for help.

With the seq'ing of commands above the test passes finely.

Trac metadata
Trac field Value
Version 6.7
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information