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

Negative numbers are shifted left or right by 0 digits. The calculation result is incorrect.

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 10.5.16, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
    • N/A
    • Data types

    Description

      We get the incorrect result when we let the negative numbers shift left or right by 0 digits.
       
      mysql> SELECT -1 >> 0;
      +----------------------+
      | -1 >> 0              |
      +----------------------+
      | 18446744073709551615 |
      +----------------------+
      1 row in set (0.00 sec)
       
      mysql> SELECT -1 << 0;
      +----------------------+
      | -1 << 0              |
      +----------------------+
      | 18446744073709551615 |
      +----------------------+
      1 row in set (0.00 sec)
      

      The result is incorrect. It should be -1.

      Attachments

        Activity

          People

            bar Alexander Barkov
            zzzzh Zeng
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.