changeset 1105:70a814e4a1ee

[Issue 287] DMD optimization bug arround dynamic array length icee <iceelyne@gmail.com> 2006-08-14 news:bug-287-3@http.d.puremagic.com/issues/
author thomask
date Tue, 15 Aug 2006 12:13:26 +0000
parents a9bd4f3bb932
children 6ee0ee24bd25
files run/o/odd_bug_07_A.d run/o/odd_bug_07_B.d
diffstat 2 files changed, 86 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/o/odd_bug_07_A.d	Tue Aug 15 12:13:26 2006 +0000
@@ -0,0 +1,45 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	icee <iceelyne@gmail.com>
+// @date@	2006-08-14
+// @uri@	news:bug-287-3@http.d.puremagic.com/issues/
+// @desc@	[Issue 287] DMD optimization bug arround dynamic array length
+
+module dstress.run.o.odd_bug_07_A;
+
+int status;
+
+void validate(int a, int b){
+	if(a != status){
+		assert(0);
+	}
+	status += 4;
+	
+	if(b != status){
+		assert(0);
+	}
+}
+
+int main(){
+        int x = 0;
+        int y = 0;
+        char[] sa = "abcd";
+
+        for(int i = 0; i < 10; i++){
+                y = x + sa.length;
+		validate(x, y);
+                x = y;
+
+                y = x + sa.length;
+		validate(x, y);
+                x = y;
+        }
+
+	if(status != 80){
+		assert(0);
+	}
+
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/o/odd_bug_07_B.d	Tue Aug 15 12:13:26 2006 +0000
@@ -0,0 +1,41 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	icee <iceelyne@gmail.com>
+// @date@	2006-08-14
+// @uri@	news:bug-287-3@http.d.puremagic.com/issues/
+// @desc@	[Issue 287] DMD optimization bug arround dynamic array length
+
+module dstress.run.o.odd_bug_07_B;
+
+int status;
+
+void validate(int a, int b){
+	if(a != status){
+		assert(0);
+	}
+	status += 4;
+	
+	if(b != status){
+		assert(0);
+	}
+}
+
+int main(){
+        int x = 0;
+        int y = 0;
+        char[] sa = "abcd";
+
+        for(int i = 0; i < 10; i++){
+                y = x + sa.length;
+		validate(x, y);
+                x = y;
+        }
+
+	if(status != 40){
+		assert(0);
+	}
+
+	return 0;
+}