Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
4,324
Issues
4,324
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
360
Merge Requests
360
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
6d6e8483
Commit
6d6e8483
authored
Nov 15, 2007
by
Simon Marlow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test for
#1679
parent
a159d2d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
testsuite/tests/ghc-regress/ccall/should_run/1679.hs
testsuite/tests/ghc-regress/ccall/should_run/1679.hs
+19
-0
testsuite/tests/ghc-regress/ccall/should_run/1679.stdout
testsuite/tests/ghc-regress/ccall/should_run/1679.stdout
+2
-0
testsuite/tests/ghc-regress/ccall/should_run/all.T
testsuite/tests/ghc-regress/ccall/should_run/all.T
+3
-0
No files found.
testsuite/tests/ghc-regress/ccall/should_run/1679.hs
0 → 100644
View file @
6d6e8483
{-# LANGUAGE ForeignFunctionInterface #-}
import
System.Mem
import
Foreign
import
Control.Exception
-- Test for #1679. If there's a GC during a foreign call, the
-- interpreter could sometimes crash, because it was using the old
-- pointer to the byte code instructions, which has now moved. The
-- tricky bit is allocating enough so that the old instructions are
-- overwritten, hence performGC followed by sum [1..100000].
foreign
import
ccall
"wrapper"
mkF
::
IO
()
->
IO
(
FunPtr
(
IO
()
))
foreign
import
ccall
"dynamic"
call_F
::
FunPtr
(
IO
()
)
->
IO
()
main
=
do
fun
<-
mkF
(
do
performGC
print
(
sum
[
1
..
100000
]))
call_F
fun
putStrLn
"ok"
testsuite/tests/ghc-regress/ccall/should_run/1679.stdout
0 → 100644
View file @
6d6e8483
5000050000
ok
testsuite/tests/ghc-regress/ccall/should_run/all.T
View file @
6d6e8483
...
...
@@ -102,3 +102,6 @@ test('ffi018', only_ways(['ghci']), compile_and_run, ['ffi018_ghci_c.o'])
clean
(['
ffi018_ghci_c.o
'])
test
('
ffi019
',
normal
,
compile_and_run
,
[''])
# This one originally failed only GHCi, but doesn't hurt to test all ways.
test
('
1679
',
normal
,
compile_and_run
,
[''])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment