Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-118514

[Reg 6.5 -> 6.6] Miscompilation of arithmetic operators

    XMLWordPrintable

Details

    • c662ae7cb (dev), 1d428b22f (6.6), dadf8a78c (tqtc/lts-6.5)

    Description

      qmlcachegen miscompiles the following function if all of the involved number types are integers:

      function execute() {
              let ihn = input();
              if (!ihn)
                  return;
      
              let result = ihn.value;
              if (direction === Direction.BACKWARD) {
                  if (offset)
                      result -= offset.value;
                  if (scale)
                      result /= scale.value;
              } else {
                  if (scale)
                      result *= scale.value;
                  if (offset)
                      result += offset.value;
              }
      
              setOutput(result);
          }
      

      This is because it promotes some values to double, and some not and then chooses to read the double value on setOutput(), disregarding the result of the branches that produce integer values.

      Attachments

        For Gerrit Dashboard: QTBUG-118514
        # Subject Branch Project Status CR V

        Activity

          People

            ulherman Ulf Hermann
            ulherman Ulf Hermann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes