Forum Index
Possible compiler bug: select case mid()

 
Author Message
stevech



Joined: 23 Feb 2006

Posted: 12 March 2006, 21:00 PM    Post subject: Possible compiler bug: select case mid()

I suspect this code demonstrates a compiler bug
Code:

option base 1

sub main()
   dim sMid as string, s1 as string

   do
      s1 = console.readline()
      debug.print "Readline returned:";s1
      
      sMid = mid(s1, 1, 2)      
      'select case sMid           ' this works correctly
      select case mid(s1, 1, 2) ' this does not work
         case "AB"
            debug.print "case AB"
         case "XX"
            debug.print "case XX"
      case else
         debug.print "case else:";mid(s1, 1, 2)
      end select
   loop
end sub
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Location: Portland, OR

Posted: 13 March 2006, 3:38 AM    Post subject:

By inspection, I see that the generated code is incorrect. It should be creating a temporary variable to hold the string value returned by the Mid() function. I don't know yet how difficult it will be to resolve. In the interim, the solution is to introduce a temporary variable manually as you suggested.
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Location: Portland, OR

Posted: 19 March 2006, 19:31 PM    Post subject:

The initial assessment of the problem was incorrect. The solution required a change to the firmware. A
Firmware Update has been posted.
Back to top
stevech



Joined: 23 Feb 2006

Posted: 19 March 2006, 19:50 PM    Post subject:

Confirmed OK here.

Great support, thanks!
Back to top
Display posts from previous:   
Page 1 of 1

 



ZBasic Microcontrollers Home
All content Copyright © 2005, 2006, 2007, 2008, 2009, 2010 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group