Mercurial > projects > dstress
changeset 1448:b0b70172c68b
[Issue 1091] Wrong size reserved for critical sections
Frits van Bommel <fvbommel@wxs.nl>
2007-04-02
http://d.puremagic.com/issues/show_bug.cgi?id=1091
author | thomask |
---|---|
date | Wed, 04 Apr 2007 20:29:08 +0000 |
parents | ef3062e62d77 |
children | 6666662e4363 |
files | run/s/synchronized_03_A.d run/s/synchronized_03_B.d run/s/synchronized_03_C.d run/s/synchronized_03_D.d run/s/synchronized_03_E.d run/s/synchronized_03_F.d |
diffstat | 6 files changed, 188 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/synchronized_03_A.d Wed Apr 04 20:29:08 2007 +0000 @@ -0,0 +1,30 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Frits van Bommel <fvbommel@wxs.nl> +// @date@ 2007-04-02 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1091 +// @desc@ [Issue 1091] Wrong size reserved for critical sections + +module dstress.run.s.synchronized_03_A; + +long x; + +void foo(long a, long b){ + x = a * b; +} + +int main(){ + synchronized{ + synchronized{ + foo(2L, 3L); + } + } + + if(6L != x){ + assert(0); + } + return 0; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/synchronized_03_B.d Wed Apr 04 20:29:08 2007 +0000 @@ -0,0 +1,28 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Frits van Bommel <fvbommel@wxs.nl> +// @date@ 2007-04-02 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1091 +// @desc@ [Issue 1091] Wrong size reserved for critical sections + +module dstress.run.s.synchronized_03_B; + +long x; + +void foo(long a, long b){ + x = a * b; +} + +int main(){ + synchronized{ + foo(2L, 3L); + } + + if(6L != x){ + assert(0); + } + return 0; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/synchronized_03_C.d Wed Apr 04 20:29:08 2007 +0000 @@ -0,0 +1,30 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Frits van Bommel <fvbommel@wxs.nl> +// @date@ 2007-04-02 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1091 +// @desc@ [Issue 1091] Wrong size reserved for critical sections + +module dstress.run.s.synchronized_03_C; + +long x; + +void foo(long a){ + x = a * a; +} + +int main(){ + synchronized{ + synchronized{ + foo(3L); + } + } + + if(9L != x){ + assert(0); + } + return 0; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/synchronized_03_D.d Wed Apr 04 20:29:08 2007 +0000 @@ -0,0 +1,34 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Frits van Bommel <fvbommel@wxs.nl> +// @date@ 2007-04-02 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1091 +// @desc@ [Issue 1091] Wrong size reserved for critical sections + +module dstress.run.s.synchronized_03_C; + +long x; + +void foo(long a){ + x += a * a; +} + +int main(){ + synchronized{ + foo(5); + if(25L != x){ + assert(0); + } + synchronized{ + foo(3L); + } + } + + if(34L != x){ + assert(0); + } + return 0; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/synchronized_03_E.d Wed Apr 04 20:29:08 2007 +0000 @@ -0,0 +1,34 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Frits van Bommel <fvbommel@wxs.nl> +// @date@ 2007-04-02 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1091 +// @desc@ [Issue 1091] Wrong size reserved for critical sections + +module dstress.run.s.synchronized_03_E; + +long x; + +void foo(long a){ + x += a * a; +} + +int main(){ + synchronized{ + synchronized{ + foo(3L); + } + if(9L != x){ + assert(0); + } + foo(5); + } + + if(34L != x){ + assert(0); + } + return 0; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/s/synchronized_03_F.d Wed Apr 04 20:29:08 2007 +0000 @@ -0,0 +1,32 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Frits van Bommel <fvbommel@wxs.nl> +// @date@ 2007-04-02 +// @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1091 +// @desc@ [Issue 1091] Wrong size reserved for critical sections + +module dstress.run.s.synchronized_03_F; + +long x; + +void foo(long a){ + x += a * a; +} + +void bar(Object a, Object b){ + synchronized(a){ + synchronized(b){ + foo(3L); + } + } +} +int main(){ + bar(new Object(), new Object()); + + if(9L != x){ + assert(0); + } + return 0; +}