Uploaded image for project: 'Qbs ("Cubes")'
  1. Qbs ("Cubes")
  2. QBS-1745

QuickJS has bad tags for floats on x86

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • 2.1.1
    • 2.1.0
    • None
    • Debian GNU/Linux sid i386
    • Linux/X11
    • d8c97a5f0 (2.1)

    Description

      Now QuickJS builds fine on x86 (32-bit), but there is a problem with floats. Consider the following test C program:

      #include <stdio.h>
      #include "quickjs.h"
      
      int main() {
          JSContext *ctx = NULL;  /* unused anyway */
          double d = 1.2;
          JSValue val = JS_NewFloat64Impl(ctx, d);
          double d2 = JS_VALUE_GET_FLOAT64(val);
          printf("d2 = %f\n", d2);
          printf("tag = %d\n", JS_VALUE_GET_TAG(val));
          printf("expected = %d\n", JS_TAG_FLOAT64);
          return 0;
      }
      

      I put it to src/shared/quickjs directory and compile using gcc test.c -o test.

      Output on x86_64:

      $ ./test 
      d2 = 1.200000
      tag = 7
      expected = 7
      

      Output on x86:

      $ ./test 
      d2 = 1.200000
      tag = -1074056409
      expected = 7
      

      As you can see, the tag is wrong, which makes some tests fail.

      Attachments

        For Gerrit Dashboard: QBS-1745
        # Subject Branch Project Status CR V

        Activity

          People

            kandeler Christian Kandeler
            mandriver Dmitry Shachnev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes