Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Changes in Upcast branch don't execute list.txt correctly #33

Closed
TheRealMichaelWang opened this issue May 2, 2022 · 6 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@TheRealMichaelWang
Copy link
Owner

TheRealMichaelWang commented May 2, 2022

Not sure how serious the issue is at the moment, I am still investigating. It looks pretty serious, but I don't think it has anything to do with the memory saftey additons made in #31, but rather the changes made in #30.

The program segfaults because of an invalid array at IP 177.

@TheRealMichaelWang
Copy link
Owner Author

Here is the link for list.txt. Here is the latest working commit.

@TheRealMichaelWang TheRealMichaelWang pinned this issue May 2, 2022
@TheRealMichaelWang
Copy link
Owner Author

@TheRealMichaelWang
Copy link
Owner Author

This is the working binary:

0:	offset          	48	0	0
1:	newframe        	0	0	0
2:	lbl(g)          	39	4	0
3:	jmp             	14	0	0
4:	mov(lg)         	2	0	0
5:	len(ll)         	3	1	0
6:	lless(lll)      	2	3	3
7:	jmpcheck(l)     	3	12	0
8:	ldalloc(lll)    	1	2	3
9:	foreign(gll)    	1	3	0
10:	ladd(lgl)       	2	2	2
11:	jmp             	5	0	0
12:	return          	0	0	0
13:	abort           	17	0	0
14:	lbl(g)          	40	16	0
15:	jmp             	22	0	0
16:	mov(ll)         	3	1	0
17:	call(g)         	39	2	0
18:	deoffset        	2	0	0
19:	foreign(ggl)    	1	3	0
20:	return          	0	0	0
21:	abort           	17	0	0
22:	lbl(g)          	41	24	0
23:	jmp             	27	0	0
24:	foreign(gll)    	7	1	0
25:	return          	0	0	0
26:	abort           	17	0	0
27:	lbl(g)          	42	29	0
28:	jmp             	65	0	0
29:	newframe        	0	0	0
30:	ldalloc_i(ll)   	1	4	2
31:	ladd(lgl)       	4	2	4
32:	stoalloc_i(ll)  	1	4	2
33:	ldalloc_i(ll)   	1	4	2
34:	lmore(lgl)      	4	2	4
35:	jmpcheck(l)     	4	52	0
36:	ldalloc_i(ll)   	1	4	1
37:	stoalloc_i(lg)  	4	12	1
38:	ldalloc_i(ll)   	1	4	1
39:	alloc_i(l)      	5	3	2
40:	stoalloc_i(ll)  	5	2	2
41:	stoalloc_i(lg)  	5	11	1
42:	conft_i(l)      	5	0	1
43:	conft_i(l)      	5	1	0
44:	dynconft_i(ll)  	5	2	3
45:	gctrace(l)      	5	0	0
46:	stoalloc_i(ll)  	4	5	0
47:	stoalloc_i(ll)  	1	5	1
48:	mov(ll)         	0	5	0
49:	gcclean         	0	0	0
50:	return          	0	0	0
51:	jmp             	64	0	0
52:	alloc_i(l)      	4	3	2
53:	stoalloc_i(ll)  	4	2	2
54:	stoalloc_i(lg)  	4	11	1
55:	conft_i(l)      	4	0	1
56:	conft_i(l)      	4	1	0
57:	dynconft_i(ll)  	4	2	3
58:	gctrace(l)      	4	0	0
59:	stoalloc_i(ll)  	1	4	1
60:	stoalloc_i(ll)  	1	4	0
61:	mov(ll)         	0	4	0
62:	gcclean         	0	0	0
63:	return          	0	0	0
64:	abort           	17	0	0
65:	lbl(g)          	43	67	0
66:	jmp             	80	0	0
67:	ldalloc_i(ll)   	1	4	0
68:	jmpcheck(g)     	12	78	0
69:	ldalloc_i(ll)   	4	6	2
70:	call(l)         	2	5	0
71:	deoffset        	5	0	0
72:	ldalloc_i(ll)   	4	5	1
73:	jmpcheck(l)     	5	76	0
74:	ldalloc_i(ll)   	4	4	0
75:	jmp             	77	0	0
76:	jmp             	78	0	0
77:	jmp             	68	0	0
78:	return          	0	0	0
79:	abort           	17	0	0
80:	lbl(g)          	44	82	0
81:	jmp             	156	0	0
82:	newframe        	0	0	0
83:	alloc_i(l)      	1	3	2
84:	stoalloc_i(lg)  	1	0	2
85:	conft_i(l)      	1	0	1
86:	conft_i(l)      	1	1	1
87:	conft_i(l)      	1	2	0
88:	mov(ll)         	3	1	0
89:	alloc_i(l)      	4	2	2
90:	alloc_i(l)      	5	7	0
91:	stoalloc_i(lg)  	5	13	0
92:	stoalloc_i(lg)  	5	14	1
93:	stoalloc_i(lg)  	5	15	2
94:	stoalloc_i(lg)  	5	16	3
95:	stoalloc_i(lg)  	5	17	4
96:	stoalloc_i(lg)  	5	18	5
97:	stoalloc_i(lg)  	5	19	6
98:	stoalloc_i(ll)  	4	5	0
99:	stoalloc_i(lg)  	4	20	1
100:	conft_i(l)      	4	0	1
101:	conft_i(l)      	4	1	0
102:	set(l)          	5	1	0
103:	call(g)         	42	2	0
104:	deoffset        	2	0	0
105:	mov(ll)         	3	1	0
106:	alloc_i(l)      	4	2	2
107:	alloc_i(l)      	5	3	0
108:	stoalloc_i(lg)  	5	26	0
109:	stoalloc_i(lg)  	5	14	1
110:	stoalloc_i(lg)  	5	27	2
111:	stoalloc_i(ll)  	4	5	0
112:	stoalloc_i(lg)  	4	28	1
113:	conft_i(l)      	4	0	1
114:	conft_i(l)      	4	1	0
115:	set(l)          	5	1	0
116:	call(g)         	42	2	0
117:	deoffset        	2	0	0
118:	mov(ll)         	3	1	0
119:	alloc_i(l)      	4	2	2
120:	alloc_i(l)      	5	4	0
121:	stoalloc_i(lg)  	5	29	0
122:	stoalloc_i(lg)  	5	14	1
123:	stoalloc_i(lg)  	5	15	2
124:	stoalloc_i(lg)  	5	30	3
125:	stoalloc_i(ll)  	4	5	0
126:	stoalloc_i(lg)  	4	31	1
127:	conft_i(l)      	4	0	1
128:	conft_i(l)      	4	1	0
129:	set(l)          	5	1	0
130:	call(g)         	42	2	0
131:	deoffset        	2	0	0
132:	mov(ll)         	3	1	0
133:	alloc_i(l)      	4	3	2
134:	alloc_i(l)      	5	7	0
135:	stoalloc_i(lg)  	5	21	0
136:	stoalloc_i(lg)  	5	22	1
137:	stoalloc_i(lg)  	5	17	2
138:	stoalloc_i(lg)  	5	23	3
139:	stoalloc_i(lg)  	5	19	4
140:	stoalloc_i(lg)  	5	18	5
141:	stoalloc_i(lg)  	5	24	6
142:	stoalloc_i(ll)  	4	5	0
143:	stoalloc_i(lg)  	4	25	2
144:	stoalloc_i(lg)  	4	20	1
145:	conft_i(l)      	4	2	0
146:	conft_i(l)      	4	0	1
147:	conft_i(l)      	4	1	0
148:	set(l)          	5	1	0
149:	call(g)         	42	2	0
150:	deoffset        	2	0	0
151:	gctrace(l)      	1	0	0
152:	mov(ll)         	0	1	0
153:	gcclean         	0	0	0
154:	return          	0	0	0
155:	abort           	17	0	0
156:	call(g)         	44	0	0
157:	mov(ll)         	2	0	0
158:	lbl(g)          	45	160	0
159:	jmp             	183	0	0
160:	newframe        	0	0	0
161:	ldalloc_i(ll)   	1	3	0
162:	gctrace(l)      	3	0	0
163:	call(g)         	39	2	0
164:	deoffset        	2	0	0
165:	alloc_i(l)      	3	6	0
166:	stoalloc_i(lg)  	3	32	0
167:	stoalloc_i(lg)  	3	33	1
168:	stoalloc_i(lg)  	3	34	2
169:	stoalloc_i(lg)  	3	18	3
170:	stoalloc_i(lg)  	3	35	4
171:	stoalloc_i(lg)  	3	36	5
172:	call(g)         	39	2	0
173:	deoffset        	2	0	0
174:	ldalloc_i(ll)   	1	4	1
175:	call(g)         	41	3	0
176:	deoffset        	3	0	0
177:	gctrace(l)      	3	1	0
178:	call(g)         	40	2	0
179:	deoffset        	2	0	0
180:	gcclean         	0	0	0
181:	return          	0	0	0
182:	abort           	17	0	0
183:	mov(lg)         	3	45	0
184:	set(l)          	4	1	0
185:	call(g)         	43	1	0
186:	deoffset        	1	0	0
187:	mov(ll)         	2	0	0
188:	lbl(g)          	46	190	0
189:	jmp             	202	0	0
190:	alloc_i(l)      	2	8	0
191:	stoalloc_i(lg)  	2	37	0
192:	stoalloc_i(lg)  	2	23	1
193:	stoalloc_i(lg)  	2	22	2
194:	stoalloc_i(lg)  	2	14	3
195:	stoalloc_i(lg)  	2	22	4
196:	stoalloc_i(lg)  	2	19	5
197:	stoalloc_i(lg)  	2	18	6
198:	stoalloc_i(lg)  	2	38	7
199:	stoalloc_i(ll)  	1	2	0
200:	return          	0	0	0
201:	abort           	17	0	0
202:	mov(lg)         	3	46	0
203:	set(l)          	4	1	0
204:	call(g)         	43	1	0
205:	deoffset        	1	0	0
206:	mov(ll)         	2	0	0
207:	lbl(g)          	47	209	0
208:	jmp             	232	0	0
209:	newframe        	0	0	0
210:	ldalloc_i(ll)   	1	3	0
211:	gctrace(l)      	3	0	0
212:	call(g)         	39	2	0
213:	deoffset        	2	0	0
214:	alloc_i(l)      	3	6	0
215:	stoalloc_i(lg)  	3	32	0
216:	stoalloc_i(lg)  	3	33	1
217:	stoalloc_i(lg)  	3	34	2
218:	stoalloc_i(lg)  	3	18	3
219:	stoalloc_i(lg)  	3	35	4
220:	stoalloc_i(lg)  	3	36	5
221:	call(g)         	39	2	0
222:	deoffset        	2	0	0
223:	ldalloc_i(ll)   	1	4	1
224:	call(g)         	41	3	0
225:	deoffset        	3	0	0
226:	gctrace(l)      	3	1	0
227:	call(g)         	40	2	0
228:	deoffset        	2	0	0
229:	gcclean         	0	0	0
230:	return          	0	0	0
231:	abort           	17	0	0
232:	mov(lg)         	3	47	0
233:	set(l)          	4	1	0
234:	call(g)         	43	1	0
235:	deoffset        	1	0	0
236:	gcclean         	0	0	0
237:	abort           	0	0	0

@TheRealMichaelWang
Copy link
Owner Author

TheRealMichaelWang commented May 2, 2022

Broken Binaries:

0:	offset          	48	0	0
1:	newframe        	0	0	0
2:	lbl(g)          	39	4	0
3:	jmp             	14	0	0
4:	mov(lg)         	2	0	0
5:	len(ll)         	3	1	0
6:	lless(lll)      	2	3	3
7:	jmpcheck(l)     	3	12	0
8:	ldalloc(lll)    	1	2	3
9:	foreign(gll)    	1	3	0
10:	ladd(lgl)       	2	2	2
11:	jmp             	5	0	0
12:	return          	0	0	0
13:	abort           	19	0	0
14:	lbl(g)          	40	16	0
15:	jmp             	22	0	0
16:	mov(ll)         	3	1	0
17:	call(g)         	39	2	0
18:	deoffset        	2	0	0
19:	foreign(ggl)    	1	3	0
20:	return          	0	0	0
21:	abort           	19	0	0
22:	lbl(g)          	41	24	0
23:	jmp             	27	0	0
24:	foreign(gll)    	7	1	0
25:	return          	0	0	0
26:	abort           	19	0	0
27:	lbl(g)          	42	29	0
28:	jmp             	67	0	0
29:	newframe        	0	0	0
30:	ldalloc_i(ll)   	1	4	2
31:	ladd(lgl)       	4	2	4
32:	stoalloc_i(ll)  	1	4	2
33:	ldalloc_i(ll)   	1	4	2
34:	lmore(lgl)      	4	2	4
35:	jmpcheck(l)     	4	53	0
36:	ldalloc_i(ll)   	1	4	1
37:	stoalloc_i(lg)  	4	12	1
38:	ldalloc_i(ll)   	1	4	1
39:	alloc_i(l)      	5	3	2
40:	configtypesig(l)	5	0	0
41:	stoalloc_i(ll)  	5	2	2
42:	stoalloc_i(lg)  	5	11	1
43:	conft_i(l)      	5	0	1
44:	conft_i(l)      	5	1	0
45:	dynconft_i(ll)  	5	2	3
46:	gctrace(l)      	5	0	0
47:	stoalloc_i(ll)  	4	5	0
48:	stoalloc_i(ll)  	1	5	1
49:	mov(ll)         	0	5	0
50:	gcclean         	0	0	0
51:	return          	0	0	0
52:	jmp             	66	0	0
53:	alloc_i(l)      	4	3	2
54:	configtypesig(l)	4	1	0
55:	stoalloc_i(ll)  	4	2	2
56:	stoalloc_i(lg)  	4	11	1
57:	conft_i(l)      	4	0	1
58:	conft_i(l)      	4	1	0
59:	dynconft_i(ll)  	4	2	3
60:	gctrace(l)      	4	0	0
61:	stoalloc_i(ll)  	1	4	1
62:	stoalloc_i(ll)  	1	4	0
63:	mov(ll)         	0	4	0
64:	gcclean         	0	0	0
65:	return          	0	0	0
66:	abort           	19	0	0
67:	lbl(g)          	43	69	0
68:	jmp             	82	0	0
69:	ldalloc_i(ll)   	1	4	0
70:	jmpcheck(g)     	12	80	0
71:	ldalloc_i(ll)   	4	6	2
72:	call(l)         	2	5	0
73:	deoffset        	5	0	0
74:	ldalloc_i(ll)   	4	5	1
75:	jmpcheck(l)     	5	78	0
76:	ldalloc_i(ll)   	4	4	0
77:	jmp             	79	0	0
78:	jmp             	80	0	0
79:	jmp             	70	0	0
80:	return          	0	0	0
81:	abort           	19	0	0
82:	relate type     	13	12	0
83:	lbl(g)          	44	85	0
84:	jmp             	164	0	0
85:	newframe        	0	0	0
86:	alloc_i(l)      	1	3	2
87:	configtypesig(l)	1	2	0
88:	stoalloc_i(lg)  	1	0	2
89:	conft_i(l)      	1	0	1
90:	conft_i(l)      	1	1	1
91:	conft_i(l)      	1	2	0
92:	mov(ll)         	3	1	0
93:	alloc_i(l)      	4	2	2
94:	configtypesig(l)	4	3	0
95:	alloc_i(l)      	5	7	0
96:	stoalloc_i(lg)  	5	13	0
97:	stoalloc_i(lg)  	5	14	1
98:	stoalloc_i(lg)  	5	15	2
99:	stoalloc_i(lg)  	5	16	3
100:	stoalloc_i(lg)  	5	17	4
101:	stoalloc_i(lg)  	5	18	5
102:	stoalloc_i(lg)  	5	19	6
103:	stoalloc_i(ll)  	4	5	0
104:	stoalloc_i(lg)  	4	20	1
105:	conft_i(l)      	4	0	1
106:	conft_i(l)      	4	1	0
107:	set(l)          	5	4	0
108:	call(g)         	42	2	0
109:	deoffset        	2	0	0
110:	mov(ll)         	3	1	0
111:	alloc_i(l)      	4	2	2
112:	configtypesig(l)	4	5	0
113:	alloc_i(l)      	5	3	0
114:	stoalloc_i(lg)  	5	26	0
115:	stoalloc_i(lg)  	5	14	1
116:	stoalloc_i(lg)  	5	27	2
117:	stoalloc_i(ll)  	4	5	0
118:	stoalloc_i(lg)  	4	28	1
119:	conft_i(l)      	4	0	1
120:	conft_i(l)      	4	1	0
121:	set(l)          	5	6	0
122:	call(g)         	42	2	0
123:	deoffset        	2	0	0
124:	mov(ll)         	3	1	0
125:	alloc_i(l)      	4	2	2
126:	configtypesig(l)	4	7	0
127:	alloc_i(l)      	5	4	0
128:	stoalloc_i(lg)  	5	29	0
129:	stoalloc_i(lg)  	5	14	1
130:	stoalloc_i(lg)  	5	15	2
131:	stoalloc_i(lg)  	5	30	3
132:	stoalloc_i(ll)  	4	5	0
133:	stoalloc_i(lg)  	4	31	1
134:	conft_i(l)      	4	0	1
135:	conft_i(l)      	4	1	0
136:	set(l)          	5	8	0
137:	call(g)         	42	2	0
138:	deoffset        	2	0	0
139:	mov(ll)         	3	1	0
140:	alloc_i(l)      	4	3	2
141:	configtypesig(l)	4	9	0
142:	alloc_i(l)      	5	7	0
143:	stoalloc_i(lg)  	5	21	0
144:	stoalloc_i(lg)  	5	22	1
145:	stoalloc_i(lg)  	5	17	2
146:	stoalloc_i(lg)  	5	23	3
147:	stoalloc_i(lg)  	5	19	4
148:	stoalloc_i(lg)  	5	18	5
149:	stoalloc_i(lg)  	5	24	6
150:	stoalloc_i(ll)  	4	5	0
151:	stoalloc_i(lg)  	4	25	2
152:	stoalloc_i(lg)  	4	20	1
153:	conft_i(l)      	4	2	0
154:	conft_i(l)      	4	0	1
155:	conft_i(l)      	4	1	0
156:	set(l)          	5	10	0
157:	call(g)         	42	2	0
158:	deoffset        	2	0	0
159:	gctrace(l)      	1	0	0
160:	mov(ll)         	0	1	0
161:	gcclean         	0	0	0
162:	return          	0	0	0
163:	abort           	19	0	0
164:	call(g)         	44	0	0
165:	mov(ll)         	2	0	0
166:	lbl(g)          	45	168	0
167:	jmp             	191	0	0
168:	newframe        	0	0	0
169:	ldalloc_i(ll)   	1	3	0
170:	gctrace(l)      	3	0	0
171:	call(g)         	39	2	0
172:	deoffset        	2	0	0
173:	alloc_i(l)      	3	6	0
174:	stoalloc_i(lg)  	3	32	0
175:	stoalloc_i(lg)  	3	33	1
176:	stoalloc_i(lg)  	3	34	2
177:	stoalloc_i(lg)  	3	18	3
178:	stoalloc_i(lg)  	3	35	4
179:	stoalloc_i(lg)  	3	36	5
180:	call(g)         	39	2	0
181:	deoffset        	2	0	0
182:	ldalloc_i(ll)   	1	4	1
183:	call(g)         	41	3	0
184:	deoffset        	3	0	0
185:	gctrace(l)      	3	1	0
186:	call(g)         	40	2	0
187:	deoffset        	2	0	0
188:	gcclean         	0	0	0
189:	return          	0	0	0
190:	abort           	19	0	0
191:	mov(lg)         	3	45	0
192:	set(l)          	4	11	0
193:	call(g)         	43	1	0
194:	deoffset        	1	0	0
195:	mov(ll)         	2	0	0
196:	lbl(g)          	46	198	0
197:	jmp             	210	0	0
198:	alloc_i(l)      	2	8	0
199:	stoalloc_i(lg)  	2	37	0
200:	stoalloc_i(lg)  	2	23	1
201:	stoalloc_i(lg)  	2	22	2
202:	stoalloc_i(lg)  	2	14	3
203:	stoalloc_i(lg)  	2	22	4
204:	stoalloc_i(lg)  	2	19	5
205:	stoalloc_i(lg)  	2	18	6
206:	stoalloc_i(lg)  	2	38	7
207:	stoalloc_i(ll)  	1	2	0
208:	return          	0	0	0
209:	abort           	19	0	0
210:	mov(lg)         	3	46	0
211:	set(l)          	4	12	0
212:	call(g)         	43	1	0
213:	deoffset        	1	0	0
214:	mov(ll)         	2	0	0
215:	lbl(g)          	47	217	0
216:	jmp             	240	0	0
217:	newframe        	0	0	0
218:	ldalloc_i(ll)   	1	3	0
219:	gctrace(l)      	3	0	0
220:	call(g)         	39	2	0
221:	deoffset        	2	0	0
222:	alloc_i(l)      	3	6	0
223:	stoalloc_i(lg)  	3	32	0
224:	stoalloc_i(lg)  	3	33	1
225:	stoalloc_i(lg)  	3	34	2
226:	stoalloc_i(lg)  	3	18	3
227:	stoalloc_i(lg)  	3	35	4
228:	stoalloc_i(lg)  	3	36	5
229:	call(g)         	39	2	0
230:	deoffset        	2	0	0
231:	ldalloc_i(ll)   	1	4	1
232:	call(g)         	41	3	0
233:	deoffset        	3	0	0
234:	gctrace(l)      	3	1	0
235:	call(g)         	40	2	0
236:	deoffset        	2	0	0
237:	gcclean         	0	0	0
238:	return          	0	0	0
239:	abort           	19	0	0
240:	mov(lg)         	3	47	0
241:	set(l)          	4	13	0
242:	call(g)         	43	1	0
243:	deoffset        	1	0	0
244:	gcclean         	0	0	0
245:	abort           	0	0	0

@TheRealMichaelWang
Copy link
Owner Author

TheRealMichaelWang commented May 2, 2022

I may have found the culprit - consider this this implementation of dynamic configure:

case MACHINE_OP_CODE_DYNAMIC_CONF_LL:
	machine->stack[ip->a + machine->global_offset].heap_alloc->trace_stat[ip->b] = machine->stack[ip->c + machine->global_offset].long_int >= TYPE_SUPER_ARRAY;
	break;

Instead of looking at

machine->defined_signatures[ip->c + machine->global_offset].long_int].super_signature >= TYPE_SUPER_ARRAY

Note: This occurs at every dynamic opcode, not just dynamic configure.

@TheRealMichaelWang
Copy link
Owner Author

This seems to have resolved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants