VorpalBlade / cfunge

A fast Befunge93/98 interpreter in C
GNU General Public License v3.0
18 stars 5 forks source link

Possible bug with k and j #4

Open tjol opened 3 years ago

tjol commented 3 years ago

Hi! I've been working on my own little Funge-98 interpreter and I've been testing against other interpreters, including of course cfunge. In testing the k instruction, I ran into a fair amount of undefined behaviour with different interpreters doing different reasonable things, but there's one thing that I think is a bug in cfunge in which iterating (k) the jump (j) instruction jumps too far.

To illustrate, this program:

332kjvvvvvvvvv          @
     123456789
     >>>>>>>>>  v
,a.,k7"2 * 3 = "<    v
vvvvvvvvvvvvvvvjk3::4<@
fedcba9876543210
>>>>>>>>>>>>>>>> v
@,a.,k7"4 * 3 = "<

prints

2 * 3 = 7 
4 * 3 = 14 

in cfunge, but

2 * 3 = 6 
4 * 3 = 12 

in every other interpreter I've tried (rcfunge, fbbi, ccbi, pyfunge).

If you're interested, here's my larger “edge cases of k’ test: https://github.com/tjol/rfunge/blob/f8a55e38be491e550e69d871a435004e8d58a176/tests/manual_tests/k.b98

[again, no pressure for you to actually spend any time on this if you have better things to do]

VorpalBlade commented 3 years ago

I don't have time to look at this right now, but do you happen to know if this is something tested by the Mycology test suit?

tjol commented 3 years ago

I don't have time to look at this right now, but do you happen to know if this is something tested by the Mycology test suit?

It's not.