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

main.func_math fails in builbot on Debian unstable with wrong error code

Details

    Description

      http://buildbot.askmonty.org/buildbot/builders/kvm-deb-sid-x86/builds/9229

      10.4 903f5fea30cb236c5980a07b7fa63450

      main.func_math                           w4 [ fail ]
              Test ended at 2019-11-02 15:51:08
       
      CURRENT_TEST: main.func_math
      mysqltest: At line 329: query 'SELECT -9223372036854775808 DIV -1' succeeded - should have failed with errno 1690...
       
      The result from queries just before the failure was:
      < snip >
      CREATE OR REPLACE VIEW v1 AS SELECT NULL AS a;
      SELECT RAND(a) FROM v1;
      RAND(a)
      0.15522042769493574
      DROP VIEW v1;
      SELECT RAND(a) FROM (SELECT NULL AS a) b;
      RAND(a)
      0.15522042769493574
      CREATE TABLE t1 (i INT);
      INSERT INTO t1 VALUES (NULL);
      SELECT RAND(i) FROM t1;
      RAND(i)
      0.15522042769493574
      DROP TABLE t1;
      #
      # Bug#57477 SIGFPE when dividing a huge number a negative number
      #
      SELECT -9999999999999999991 DIV -1;
      ERROR 22003: BIGINT value is out of range in '-9999999999999999991 DIV -1'
      SELECT -9223372036854775808 DIV -1;
       
      More results from queries before failure can be found in /dev/shm/var/4/log/func_math.log
       
      Warnings from just before the error:
      Warning 1916 Got overflow when converting '9999999999999999991' to INT. Value truncated
      

      Attachments

        Issue Links

          Activity

            danblack Daniel Black added a comment - func_math passing on this recent build http://buildbot.askmonty.org/buildbot/builders/kvm-deb-sid-x86/builds/12362/steps/mtr/logs/stdio ( 10.5) http://buildbot.askmonty.org/buildbot/builders/kvm-deb-sid-x86/builds/12360/steps/mtr/logs/stdio (10.6) Can't find recent 10.4 test on deb-sid-x86

            The test main.func_math fails due to undefined behaviour on 10.2, 10.3, 10.4 when built with gcc-12 -O2 for AMD64, or even some older GCC on non-AMD64 instruction set architectures, such as POWER or IBM Z Series (s390x).

            For 10.5 and later, MDEV-26645 fixed this by removing an ‘optimization’. Here is a recent example:

            CURRENT_TEST: main.func_math
            mysqltest: At line 425: query 'SELECT 9223372036854775807 + 9223372036854775807' succeeded - should have failed with errno 1690...
            

            The reason for this failure is that the compiler is allowed to assume that no undefined behaviour exists. Specifically, if the compiler was asked to evaluate a+b, and the code subsequently checks for overflow, the compiler is allowed to assume that no overflow occurred in the first place, and to optimize away the overflow check.

            marko Marko Mäkelä added a comment - The test main.func_math fails due to undefined behaviour on 10.2, 10.3, 10.4 when built with gcc-12 -O2 for AMD64, or even some older GCC on non-AMD64 instruction set architectures, such as POWER or IBM Z Series (s390x). For 10.5 and later, MDEV-26645 fixed this by removing an ‘optimization’ . Here is a recent example: CURRENT_TEST: main.func_math mysqltest: At line 425: query 'SELECT 9223372036854775807 + 9223372036854775807' succeeded - should have failed with errno 1690... The reason for this failure is that the compiler is allowed to assume that no undefined behaviour exists. Specifically, if the compiler was asked to evaluate a+b , and the code subsequently checks for overflow, the compiler is allowed to assume that no overflow occurred in the first place, and to optimize away the overflow check.

            This affects the Fedora 36 builder on new buildbot for 10.3 & 10.4.

            TheLinuxJedi Andrew Hutchings (Inactive) added a comment - This affects the Fedora 36 builder on new buildbot for 10.3 & 10.4.
            danblack Daniel Black added a comment -

            Attempted to backport the UB fixed and failed https://github.com/MariaDB/server/pull/2458.

            As Fedora 36 comes with 10.5 and and with luck and a lot of hard work, Debian 12 will come with 10.11 I think the set distros with new compilers needing this fixed for 10.3/10.4 has been reduce to an empty set..

            danblack Daniel Black added a comment - Attempted to backport the UB fixed and failed https://github.com/MariaDB/server/pull/2458 . As Fedora 36 comes with 10.5 and and with luck and a lot of hard work, Debian 12 will come with 10.11 I think the set distros with new compilers needing this fixed for 10.3/10.4 has been reduce to an empty set..
            danblack Daniel Black added a comment -

            MDEV-26645 fixes this test for 10.5+

            danblack Daniel Black added a comment - MDEV-26645 fixes this test for 10.5+

            People

              sanja Oleksandr Byelkin
              elenst Elena Stepanova
              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.