[MDEV-19386] Broken strict-aliasing rules in /storage/maria/ma_recovery.c prevents from bulding Created: 2019-05-03  Updated: 2022-02-21

Status: Open
Project: MariaDB Server
Component/s: Compiling, Storage Engine - Aria
Affects Version/s: 10.1.40, 10.4.5
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Valerii Kravchuk Assignee: Michael Widenius
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Ubuntu 14.04 LTS 64-bit, Ubuntu 16.04.6 LTS 64-bit


Issue Links:
Relates
relates to MDEV-20277 Disable -fno-strict-aliasing Open

 Description   

Today's 10.4 (and 10.1, of what tested so far) code from GitHub can not be build successfully on up to date Ubuntu 14.04:

openxs@ao756:~/git/server$ git branch
  10.0
  10.1
  10.2
  10.3
* 10.4
  bb-10.2-compatibility
  bb-10.2-marko
openxs@ao756:~/git/server$ uname -a
Linux ao756 3.13.0-168-generic #218-Ubuntu SMP Thu Mar 14 16:56:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
openxs@ao756:~/git/server$
openxs@ao756:~/git/server$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
openxs@ao756:~/git/server$ git log -1
commit d18ef804bb5d9d473055a2fdc04f74e175a8e9cd
Author: seppo <seppo.jaakola@iki.fi>
Date:   Fri May 3 10:13:32 2019 +0300
 
    MDEV-18552 MDEV-18699 allowing SR only in galera 4 cluster (#1293)
 
    Streaming replication must be allowed only in a cluster, where all nodes
    have  Galera 4 capability

cmake command line is usual (for me):

openxs@ao756:~/git/server$ cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SSL=system -DWITH_ZLIB=bundled -DMYSQL_MAINTAINER_MODE=0 -DENABLED_LOCAL_INFILE=1 -DWITH_JEMALLOC=system -DWITH_INNODB_DISALLOW_WRITES=ON -DCMAKE_INSTALL_PREFIX=/home/openxs/dbs/maria10.4
...
-- Looking for event.h - not found
-- Found BISON: /usr/bin/bison (found suitable version "3.0.2", minimum required is "2.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/openxs/git/server

When I try to make it always fails like this:

openxs@ao756:~/git/server$ make
...
[ 18%] Built target innobase
[ 21%] Built target myisam
[ 21%] Building C object storage/maria/CMakeFiles/aria.dir/ma_recovery.c.o
/home/openxs/git/server/storage/maria/ma_recovery.c: In function ‘exec_REDO_LOGREC_REDO_REPAIR_TABLE’:
/home/openxs/git/server/storage/maria/ma_recovery.c:1178:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   param.testflag= uint8korr(rec->header + FILEID_STORE_SIZE);
   ^
/home/openxs/git/server/storage/maria/ma_recovery.c:1183:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   info->s->state.key_map= uint8korr(rec->header + FILEID_STORE_SIZE + 8);
   ^
/home/openxs/git/server/storage/maria/ma_recovery.c: In function ‘exec_REDO_LOGREC_UNDO_ROW_INSERT’:
/home/openxs/git/server/storage/maria/ma_recovery.c:1910:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       share->state.state.checksum+= ha_checksum_korr(buff);
       ^
/home/openxs/git/server/storage/maria/ma_recovery.c: In function ‘exec_REDO_LOGREC_UNDO_ROW_DELETE’:
/home/openxs/git/server/storage/maria/ma_recovery.c:1947:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       share->state.state.checksum+= ha_checksum_korr(buff);
       ^
/home/openxs/git/server/storage/maria/ma_recovery.c: In function ‘exec_REDO_LOGREC_UNDO_ROW_UPDATE’:
/home/openxs/git/server/storage/maria/ma_recovery.c:1981:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
       share->state.state.checksum+= ha_checksum_korr(buff);
       ^
/home/openxs/git/server/storage/maria/ma_recovery.c: In function ‘exec_REDO_LOGREC_CLR_END’:
/home/openxs/git/server/storage/maria/ma_recovery.c:2150:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   previous_undo_lsn= lsn_korr(rec->header);
   ^
/home/openxs/git/server/storage/maria/ma_recovery.c: In function ‘exec_UNDO_LOGREC_UNDO_ROW_INSERT’:
/home/openxs/git/server/storage/maria/ma_recovery.c:2272:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   LSN previous_undo_lsn= lsn_korr(rec->header);
   ^
/home/openxs/git/server/storage/maria/ma_recovery.c: In function ‘exec_UNDO_LOGREC_UNDO_ROW_DELETE’:
/home/openxs/git/server/storage/maria/ma_recovery.c:2329:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   LSN previous_undo_lsn= lsn_korr(rec->header);
   ^
/home/openxs/git/server/storage/maria/ma_recovery.c: In function ‘exec_UNDO_LOGREC_UNDO_ROW_UPDATE’:
/home/openxs/git/server/storage/maria/ma_recovery.c:2368:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   LSN previous_undo_lsn= lsn_korr(rec->header);
   ^
/home/openxs/git/server/storage/maria/ma_recovery.c: In function ‘exec_UNDO_LOGREC_UNDO_KEY_INSERT’:
/home/openxs/git/server/storage/maria/ma_recovery.c:2407:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   LSN previous_undo_lsn= lsn_korr(rec->header);
   ^
/home/openxs/git/server/storage/maria/ma_recovery.c: In function ‘exec_UNDO_LOGREC_UNDO_KEY_DELETE’:
/home/openxs/git/server/storage/maria/ma_recovery.c:2448:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   LSN previous_undo_lsn= lsn_korr(rec->header);
   ^
/home/openxs/git/server/storage/maria/ma_recovery.c: In function ‘exec_UNDO_LOGREC_UNDO_KEY_DELETE_WITH_ROOT’:
/home/openxs/git/server/storage/maria/ma_recovery.c:2489:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   LSN previous_undo_lsn= lsn_korr(rec->header);
   ^
/home/openxs/git/server/storage/maria/ma_recovery.c: In function ‘exec_UNDO_LOGREC_UNDO_BULK_INSERT’:
/home/openxs/git/server/storage/maria/ma_recovery.c:2530:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   LSN previous_undo_lsn= lsn_korr(rec->header);
   ^
/home/openxs/git/server/storage/maria/ma_recovery.c: In function ‘get_MARIA_HA_from_REDO_record’:
/home/openxs/git/server/storage/maria/ma_recovery.c:3074:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   sid= fileid_korr(rec->header);
   ^
/home/openxs/git/server/storage/maria/ma_recovery.c: In function ‘get_MARIA_HA_from_UNDO_record’:
/home/openxs/git/server/storage/maria/ma_recovery.c:3175:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   sid= fileid_korr(rec->header + LSN_STORE_SIZE);
   ^
cc1: all warnings being treated as errors
make[2]: *** [storage/maria/CMakeFiles/aria.dir/ma_recovery.c.o] Error 1
make[1]: *** [storage/maria/CMakeFiles/aria.dir/all] Error 2
make: *** [all] Error 2
openxs@ao756:~/git/server$

It was not the case last time I tried on this same box:

openxs@ao756:~/git/server$ ~/dbs/maria10.4/bin/mysqld --version
/home/openxs/dbs/maria10.4/bin/mysqld  Ver 10.4.4-MariaDB-log for Linux on x86_64 (Source distribution)
openxs@ao756:~/git/server$ ~/dbs/maria10.1/bin/mysqld --version
/home/openxs/dbs/maria10.1/bin/mysqld  Ver 10.1.39-MariaDB for Linux on x86_64 (Source distribution)

so i suspect some regression.



 Comments   
Comment by Shahriyar Rzayev (Inactive) [ 2019-05-27 ]

+ same thing for Ubuntu 16.04.
It prevents building test environment for me.

Comment by Valerii Kravchuk [ 2019-06-25 ]

Workaround suggested by serg that worked on 16.04:

s/MYSQL_MAINTAINER_MODE=0/MYSQL_MAINTAINER_MODE=OFF/

I've built from current source without problems using the following cmake command line:

 cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_SSL=system -DWITH_ZLIB=bundled -DMYSQL_MAINTAINER_MODE=OFF -DENABLED_LOCAL_INFILE=1 -DWITH_JEMALLOC=system -DWITH_INNODB_DISALLOW_WRITES=ON -DCMAKE_INSTALL_PREFIX=/home/openxs/dbs/maria10.1

and it works:

openxs@ao756:~/dbs/maria10.1$ bin/mysql -uroot --socket=/tmp/mariadb.sock test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.41-MariaDB Source distribution
 
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [test]> show variables like '%version%';
+-------------------------+----------------------------+
| Variable_name           | Value                      |
+-------------------------+----------------------------+
| innodb_version          | 5.6.43-84.3                |
| protocol_version        | 10                         |
| slave_type_conversions  |                            |
| version                 | 10.1.41-MariaDB            |
| version_comment         | Source distribution        |
| version_compile_machine | x86_64                     |
| version_compile_os      | Linux                      |
| version_malloc_library  | system jemalloc            |
| version_ssl_library     | OpenSSL 1.0.2g  1 Mar 2016 |
| wsrep_patch_version     | wsrep_25.24                |
+-------------------------+----------------------------+
10 rows in set (0,00 sec)
 
MariaDB [test]> \! uname -a
Linux ao756 4.4.0-151-generic #178-Ubuntu SMP Tue Jun 11 08:30:22 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Generated at Thu Feb 08 08:51:17 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.