Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-19709

Bitmap<128>::merge etc may crash on older GCC versions

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.4(EOL)
    • 10.4.6
    • Compiling
    • None

    Description

      Older GCC incorrectly optimizes Bitmap<128> code by using SSE instructions on unaligned data.
      Analysis, by vlad.lesin

      The compiller error was found on Ubuntu 16.04, CentOS 6/7.
      To optimize the work with Bitmap<128>::buffer[] compiller uses sse instructions.
      For example, the following C++ code:

      -------------
      void intersect(Bitmap & map2)

      { for (uint i = 0; i < array_elements(buffer); i++) buffer[i] &= map2.buffer[i]; }

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

      is compilled into the following instructions:

      -------------
      movdqu xmm0,XMMWORD PTR [r12+0x28]
      pand xmm0,XMMWORD PTR [rbx+0x28]
      -------------

      The second operand of 'pand' instruction must be alligned to 16, otherwise
      exception occurs. But compiller generates the above instruction with
      non-alligned second argument:

      --------------
      p ($rbx+0x28)%16
      $20 = 8
      --------------

      There were also other instructions with non-alligned memory operand, for
      example, 'por'.

      Attachments

        Issue Links

          Activity

            People

              wlad Vladislav Vaintroub
              wlad Vladislav Vaintroub
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.