Announcement

Collapse
No announcement yet.

Another strange REGISTER bug

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Another strange REGISTER bug

    I found another problem which seems to be related to REGISTER.
    Unlike the previous bug I reported, this one happens in PB 6.0,
    but not 5.0. Also unlike the other bug, it does not give a
    wrong result. Instead it just crashes (the Windows messages
    box pops up which says: "This program has performed an illegal
    operation and will be shut down..."). I am using Windows 98 on
    a Pentium III.

    I have simplified and modified the problematic code to the
    following. Hopefully someone else can try to duplicate the
    error on their system. I noticed that removing the
    "$Register All" line seems to solve the problem.

    Code:
    $Compile Exe "test.exe"
    $Register All
    DefLng A-Z
    
    Function DoSomething(MyString$)
        ' Any code goes here
    End Function
    
    Function WinMain (ByVal hCurInstance  As Long, _
                      ByVal hPrevInstance As Long, _
                      lpszCmdLine         As Asciiz Ptr, _
                      ByVal nCmdShow      As Long) Export As Long
    
        MsgBox "Check point #1"
    
        i = DoSomething(MyString$)
    
        MsgBox "Check point #2: Doesn't reach this far"
    
        OtherString$ = Str$(AnyNumber##)
    End Function
    ------------------
    Daniel Corbier
    UCalc Fast Math Parser
    http://www.ucalc.com
    Daniel Corbier
    uCalc Fast Math Parser
    uCalc Language Builder
    sigpic

  • #2
    Dan...

    I tested your code snippet on 3 different PCs (PIII 800, PII 400 & Celeron 400) and get the same results. With
    regard to the REGISTER statement, the PowerBASIC documentation states "Extended precision float variables will
    be automatically assigned only in functions that contain no external function calls." However, it appears that
    maybe it IS trying to assign it.

    In your example code, you use an extended-precision floating-point variable (AnyNumber##) in your WinMain
    FUNCTION, and there is also an external function call to FUNCTION DoSomething(MyString$). Clearly in this
    case the compiler should not be classifying AnyNumber## as a register variable.

    You're right... it definitely looks like a bug, but easy enough to get around. You can use any other variable
    type instead of the EXT type for AnyNumber -or- change your DoSomething(MyString$) FUNCTION to a SUB and
    CALL it instead. Either of these will eliminate the error.

    Timm

    [This message has been edited by Timm Motl (edited October 12, 2000).]
    mailto:[email protected]
    Tsunami Record Manager

    Comment


    • #3
      Daniel,

      I can duplicate the problem with the following code, it seems to only happen
      with EXT data type and I am guessing that it has some to do with 80 bit
      floating point variables not fitting into a 64 bit MMX or FP register. DOUBLE
      downwards are no problems.

      Regards,

      [email protected]

      Code:
        ' #########################################################################
        
        #Compile Exe "test.exe"
        #Register All
        
        DefLng A-Z
        
        DECLARE Function DoSomething(MyString$)
        
        ' #########################################################################
        
        Function WinMain (ByVal hCurInstance  As Long, _
                          ByVal hPrevInstance As Long, _
                          lpszCmdLine         As Asciiz Ptr, _
                          ByVal nCmdShow      As Long) Export As Long
        
            LOCAL AnyNumber as EXT
        
            AnyNumber = 12345678.90123456
        
            MsgBox "Check point #1"
            i = DoSomething(MyString$)
            MsgBox "Check point #2: Does reach this far"
        
            ' OtherString$ = Str$(12345678)       ' <<<<< no GP fault here
        
            OtherString$ = Str$(AnyNumber)
        
            MsgBox OtherString$
        
        End Function
        
        ' #########################################################################
        
        Function DoSomething(MyString$)
        
            FUNCTION = 0
        
        End Function
        
        ' #########################################################################
      ------------------
      hutch at movsd dot com
      The MASM Forum

      www.masm32.com

      Comment


      • #4
        Thanks folks, however this seems to be only a slight variation of an earlier report.

        R&D tell me that this will definitely be corrected in the next update to the compiler.



        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment


        • #5
          Is there any updates available before the next major releses

          If so, are they downloadable

          ------------------
          Niraj Bhatt

          Comment


          • #6
            The "current version" table is listed on the SUPPORT web page at http://www.powerbasic.com/support/

            Version info is based on the time/date stamp the compiler itself. For example, the current version of PBDLL.EXE is dated 07/02/99. If you have 07/01/99, then you are entitled to an update. To request the update, send your request along with your serial number to mailto:[email protected][email protected]</A> .

            It is company policy not to preannounce or discuss unreleased products, however I can tell you that there will be a further update to the compiler. I just cannot tell you when it will be available.


            ------------------
            Lance
            PowerBASIC Support
            mailto:[email protected][email protected]</A>
            Lance
            mailto:[email protected]

            Comment


            • #7
              Implying that the date has been tentatively set and you know what it is !!!!

              If we held you over hot coals...

              ------------------

              Paul Dwyer
              Network Engineer
              Aussie in Tokyo
              (Paul282 at VB-World)

              Comment

              Working...
              X