annotate run/bug_20041226_D.d @ 1630:d0efa3ae5522 default tip

run/mini/naked_asm5: New x86_64 ABI passes the arguments in reverse order.
author David Nadlinger <code@klickverbot.at>
date Sat, 23 Apr 2011 22:57:32 +0200
parents ec5e144583ea
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
1 // $HeadURL$
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
2 // $Date$
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
3 // $Author$
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
4
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
5 // @author@ h3r3tic <foo@bar.baz>
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
6 // @date@ 2004-12-26
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
7 // @uri@ news:cqmufn$26oj$1@digitaldaemon.com
1487
6e4063f99377 changed nntp: URLs to http: URLs
thomask
parents: 1383
diff changeset
8 // @uri@ http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=2606
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
9
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
10 module dstress.run.bug_20041226_D;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
11
678
f9e1d827a255 div. fixes
thomask
parents: 248
diff changeset
12 void dummy(...){
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
13 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
14
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
15 struct vec3{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
16 vec3 opSub(vec3 a){
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
17 vec3 x;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
18 return x;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
19 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
20 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
21
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
22 struct Face{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
23 vec3 a;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
24 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
25
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
26 struct Mesh{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
27 Face[] faces;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
28 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
29
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
30 struct GeomObject{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
31 Mesh mesh;
1559
ec5e144583ea D1 -> D2 : 1/N
thomask
parents: 1487
diff changeset
32 string name;
ec5e144583ea D1 -> D2 : 1/N
thomask
parents: 1487
diff changeset
33 vec3 xlate;
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
34 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
35
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
36 class AseLoader{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
37 this(){
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
38 GeomObject go;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
39 go.name = "NODE";
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
40 geomObjects ~= go;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
41 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
42
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
43 GeomObject[] geomObjects;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
44 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
45
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
46
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
47 void extractTriangles(GeomObject geomObj){
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
48 void foobar(){
678
f9e1d827a255 div. fixes
thomask
parents: 248
diff changeset
49 dummy("name: ", geomObj.name);
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
50
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
51 return; // avoid accessing the array with 0 elements in the next line
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
52 geomObj.mesh.faces[0].a - geomObj.xlate; // when this line is removed, the bug doesn't appear
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
53 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
54
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
55 foobar();
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
56 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
57
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
58 int main(){
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
59 try{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
60 AseLoader al = new AseLoader;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
61
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
62 foreach(GeomObject go; al.geomObjects){
678
f9e1d827a255 div. fixes
thomask
parents: 248
diff changeset
63 dummy("processing ", go.name);
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
64 extractTriangles(go);
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
65 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
66 }catch(Object err){
678
f9e1d827a255 div. fixes
thomask
parents: 248
diff changeset
67 dummy("Exception caught:", err);
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
68 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
69
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
70 return 0;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
71 }
678
f9e1d827a255 div. fixes
thomask
parents: 248
diff changeset
72