Euphoria Ticket #944: Wrong case getting jumped to

Previously found while writing an installer. To reproduce the bug, you only need to use eutest. If you have 4.1 binaries in /41 you can run:

eutest -eui /41/eui t_abadcase.e 

The code will write into the directories under /tmp/test-install. Briefly, at the end of the test file there is a case statement like this:

switch 1 do 
   case 0 then 
   case 1 then 
       puts(1, "apple") 
   case else 
       puts(1, "apples") 
end switch 

But the program outputs the plural form!

Also this bug is expressed in the following code: []


Type: Bug Report Severity: Major Category: Interpreter
Assigned To: unknown Status: Fixed Reported Release: 4.1 changeset 57179171dbed
Fixed in SVN #: View VCS: none Milestone: 4.1.0

1. Comment by SDPringle May 02, 2016

doing a eudis on the code I come out with these different looking excepts In 4.0:

5192: 192 17481 -1 17488 5204 23       # SWITCH_SPI: value [l3:17481] case offset -1 jump [LIT {5,7}:17488] 

In 4.1:

4199: 192 17474 15792 17481 4211 23    # SWITCH_SPI: value [l3:17474] case offset 15792 jump [LIT {5,7}:17481]  

I think the "offset" part is wrong.

2. Comment by ne1uno May 02, 2016

is a switch like this used anywhere in the stdlib? are there enough tests using those routines?

3. Comment by SDPringle May 03, 2016

The bug here disappears from view by changing lines of code that precede the switch. Attempts to reproduce this with very short examples have so far failed.

4. Comment by SDPringle May 03, 2016

See: hg:euphoria/rev/5c894c5b17ac

changeset: 6442:5c894c5b17ac user: Shawn David Pringle B.Sc. <> date: Mon May 02 14:36:27 2016 -0300 files: source/Makefile.gnu description:

  • added dependencies for interpreter
  • ticket 944

5. Comment by SDPringle May 03, 2016

See: hg:euphoria/rev/77461ca5af3a

changeset: 6443:77461ca5af3a parent: 6435:efc61da1b18f user: Shawn David Pringle B.Sc. <> date: Mon May 02 21:36:47 2016 -0300 files: source/parser.e description:

  • fix for ticket 944


Quick Links

User menu

Not signed in.

Misc Menu