[GHC] #14026: hs_init is not idempotent

#14026: hs_init is not idempotent -------------------------------------+------------------------------------- Reporter: Feuerbach | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- hs_init tries to be idempotent by ignoring all calls but the first one. However, subsequent calls to hs_init do not set argc and argv correctly. Here's a test case: {{{ #include "HsFFI.h" #include "stdio.h" void try_init() { char *argv[] = { "./test", "+RTS", "-s", "-RTS", "arg", 0 }; char **argv_ptr = argv; int argc = sizeof(argv)/sizeof(argv[0]) - 1; hs_init(&argc, &argv_ptr); printf("%d\n", argc); } int main() { try_init(); try_init(); } }}} Result: {{{ 2 5 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14026 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC