Bug 1093467 - gcc 4.9.0 crashes when building mysql on aarch64
Summary: gcc 4.9.0 crashes when building mysql on aarch64
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 22
Hardware: aarch64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-05-01 19:50 UTC by Terje Røsten
Modified: 2015-04-22 21:50 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-04-22 21:50:12 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Preprocessed source (388.53 KB, text/plain)
2014-06-16 22:03 UTC, Terje Røsten
no flags Details

Description Terje Røsten 2014-05-01 19:50:01 UTC
Description of problem:

When building mysql 5.6.17 in Fedora 20 aarch I get:

mysql-5.6.17/regex -o CMakeFiles/myisam.dir/mi_delete_all.c.o   -c /builddir/build/BUILD/mysql-5.6.17/storage/myisam/mi_delete_all.c
/builddir/build/BUILD/mysql-5.6.17/storage/perfschema/pfs_account.cc: In function 'void purge_account(PFS_thread*, PFS_account*, PFS_user*, PFS_host*)':
/builddir/build/BUILD/mysql-5.6.17/storage/perfschema/pfs_account.cc:530:18: warning: variable 'pfs' set but not used [-Wunused-but-set-variable]
     PFS_account *pfs;
                  ^
/builddir/build/BUILD/mysql-5.6.17/storage/perfschema/pfs_account.cc: In function 'PFS_account* find_or_create_account(PFS_thread*, const char*, uint, const char*, uint)':
/builddir/build/BUILD/mysql-5.6.17/storage/perfschema/pfs_account.cc:320:1: error: could not split insn
 }
 ^
(insn 474 1814 1392 (parallel [
            (set (reg:SI 0 x0 [orig:162 D.17087 ] [162])
                (mem/v:SI (reg/f:DI 1 x1 [orig:117 D.17094 ] [117]) [-1  S4 A32]))
            (set (mem/v:SI (reg/f:DI 1 x1 [orig:117 D.17094 ] [117]) [-1  S4 A32])
                (unspec_volatile:SI [
                        (ior:SI (mem/v:SI (reg/f:DI 1 x1 [orig:117 D.17094 ] [117]) [-1  S4 A32])
                            (const_int 0 [0]))
                        (const_int 5 [0x5])
                    ] UNSPECV_ATOMIC_OP))
            (clobber (reg:CC 66 cc))
            (clobber (reg:SI 2 x2 [335]))
            (clobber (reg:SI 4 x4 [336]))
        ]) /builddir/build/BUILD/mysql-5.6.17/include/my_atomic.h:217 2197 {atomic_fetch_orsi}
     (expr_list:REG_UNUSED (reg:CC 66 cc)
        (expr_list:REG_UNUSED (reg:SI 4 x4 [336])
            (expr_list:REG_UNUSED (reg:SI 2 x2 [335])
                (nil)))))
/builddir/build/BUILD/mysql-5.6.17/storage/perfschema/pfs_account.cc:320:1: internal compiler error: in final_scan_insn, at final.c:2952
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
{standard input}: Assembler messages:
{standard input}: Error: open CFI at the end of file; missing .cfi_endproc directive


Version-Release number of selected component (if applicable):

gcc 4.9.0-1

community-mysql-5.6.17-2

Logs: http://arm.koji.fedoraproject.org/koji/taskinfo?taskID=2292889

Comment 1 Terje Røsten 2014-05-22 09:50:12 UTC
Same thing with gcc 4.9.0-5:

 http://arm.koji.fedoraproject.org/koji/buildinfo?buildID=195103


[ 35%] Building CXX object sql/CMakeFiles/binlog.dir/log_event.cc.o
cd /builddir/build/BUILD/mysql-5.6.17/build/sql && /usr/bin/c++   -DHAVE_CONFIG_H -DHAVE_EVENT_SCHEDULER -DHAVE_OPENSSL -DMYSQL_SERVER -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fPIC -Wall -Wno-unused-parameter -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF -DMY_PTHREAD_FASTMUTEX=1 -I/builddir/build/BUILD/mysql-5.6.17/build/include -I/builddir/build/BUILD/mysql-5.6.17/include -I/builddir/build/BUILD/mysql-5.6.17/sql -I/builddir/build/BUILD/mysql-5.6.17/regex -I/builddir/build/BUILD/mysql-5.6.17/build/sql    -o CMakeFiles/binlog.dir/log_event.cc.o -c /builddir/build/BUILD/mysql-5.6.17/sql/log_event.cc
/builddir/build/BUILD/mysql-5.6.17/storage/perfschema/pfs_account.cc: In function 'PFS_account* find_or_create_account(PFS_thread*, const char*, uint, const char*, uint)':
/builddir/build/BUILD/mysql-5.6.17/storage/perfschema/pfs_account.cc:320:1: error: could not split insn
 }
 ^
(insn 474 1814 1392 (parallel [
            (set (reg:SI 0 x0 [orig:162 D.17087 ] [162])
                (mem/v:SI (reg/f:DI 1 x1 [orig:117 D.17094 ] [117]) [-1  S4 A32]))
            (set (mem/v:SI (reg/f:DI 1 x1 [orig:117 D.17094 ] [117]) [-1  S4 A32])
                (unspec_volatile:SI [
                        (ior:SI (mem/v:SI (reg/f:DI 1 x1 [orig:117 D.17094 ] [117]) [-1  S4 A32])
                            (const_int 0 [0]))
                        (const_int 5 [0x5])
                    ] UNSPECV_ATOMIC_OP))
            (clobber (reg:CC 66 cc))
            (clobber (reg:SI 2 x2 [335]))
            (clobber (reg:SI 4 x4 [336]))
        ]) /builddir/build/BUILD/mysql-5.6.17/include/my_atomic.h:217 2197 {atomic_fetch_orsi}
     (expr_list:REG_UNUSED (reg:CC 66 cc)
        (expr_list:REG_UNUSED (reg:SI 4 x4 [336])
            (expr_list:REG_UNUSED (reg:SI 2 x2 [335])
                (nil)))))
/builddir/build/BUILD/mysql-5.6.17/storage/perfschema/pfs_account.cc:320:1: internal compiler error: in final_scan_insn, at final.c:2952
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
{standard input}: Assembler messages:
{standard input}: Error: open CFI at the end of file; missing .cfi_endproc directive

Comment 2 Terje Røsten 2014-06-12 19:28:04 UTC
Anything I can do to help this forward?

Comment 3 Terje Røsten 2014-06-16 22:03:43 UTC
Created attachment 909284 [details]
Preprocessed source

Preprocessed source.

Comment 4 Terje Røsten 2014-06-16 22:23:10 UTC
Got a Foundation Model based system up and running. 

Did some digging.

Attachment in C#3 is preprocessed source as saved in /tmp.

When using -O1 (and lower) or adding __attribute__((optimize (1))) to
problematic function:

--- storage/perfschema/pfs_account.cc.orig
+++ storage/perfschema/pfs_account.cc
@@ -204,6 +204,11 @@
 PFS_account *
 find_or_create_account(PFS_thread *thread,
                          const char *username, uint username_length,
+                         const char *hostname, uint hostname_length) __attribute__((optimize (1)));
+
+PFS_account *
+find_or_create_account(PFS_thread *thread,
+                         const char *username, uint username_length,
                          const char *hostname, uint hostname_length)
 {
   if (account_max == 0)

things works.

To reproduce:

install build req:

 yum install gcc gcc-c++ cmake ncurses-devel openssl-devel libedit-devel libaio-devel

Download mysql tarball:

 wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.19.tar.gz

Unpack, create dir and run cmake:

 tar xzvf mysql-5.6.19.tar.gz
 cd mysql-5.6.19
 mkdir build && cd build
 cmake ..

To go storage/perfschema and try to compile pfs_account.cc file:

 cd storage/perfschema

Compile:

 /usr/bin/c++  \
 -DHAVE_CONFIG_H \
 -DMYSQL_SERVER \
 -fno-delete-null-pointer-checks \
 -fPIC -Wall -Wno-unused-parameter \
 -O2 -g -fabi-version=2  \
 -fno-omit-frame-pointer \
 -fno-strict-aliasing \
 -DDBUG_OFF -DMY_PTHREAD_FASTMUTEX=1 \
 -I../../../build/include \
 -I../../..   \
 -I../../../include \
 -I../../../sql  \
 -I../../../regex  \
 -I../../../extra/yassl/include \
 -o CMakeFiles/perfschema.dir/pfs_account.cc.o \
 -c ../../../storage/perfschema/pfs_account.cc

Anything more I can do?

Comment 5 Marek Polacek 2015-02-12 14:28:52 UTC
Sorry for not responding, is this still an issue?

Comment 6 Terje Røsten 2015-02-12 18:13:04 UTC
Good and bad news: 

 5.0.0-0.10.fc22 in coming Fedora 22 works 
 4.9.2-1.fc21 in Fedora 21 dont works

Logs (f22): http://arm.koji.fedoraproject.org/koji/taskinfo?taskID=2878458
Logs (f21): http://arm.koji.fedoraproject.org/koji/taskinfo?taskID=2878462

As we have a workaround for Fedora 21 that works:

 http://arm.koji.fedoraproject.org/koji/buildinfo?buildID=259526

its not very important to backport the fix to 4.9.

Comment 7 Terje Røsten 2015-02-12 19:20:55 UTC
Hmm, 5.0.0-0.10 seems to trigger some tests to fail, which passes with 4.9.2 and this patch

 http://pkgs.fedoraproject.org/cgit/community-mysql.git/tree/community-mysql-5.6.19-gcc49-aarch64-opt.patch

Will retry with 5.0.0-0.10 with patch to check.

Comment 8 Terje Røsten 2015-02-12 20:17:45 UTC
With 5.0.0-10 four tests (funcs_1.memory_func_view funcs_1.myisam_func_view main.bigint funcs_1.innodb_func_view) fails on all archs:

 http://arm.koji.fedoraproject.org/koji/taskinfo?taskID=2878633
 http://koji.fedoraproject.org/koji/taskinfo?taskID=8911833

while all tests passes with 4.9.2.

Seems like new bug introduced in gcc 5.0.0.

Comment 9 Jaroslav Reznik 2015-03-03 15:45:00 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 10 Terje Røsten 2015-04-22 21:50:12 UTC
By build gcc 5.0.1-0.1.fc23 issue has been resolved, no extra patches required to build, and %check passes. Thanks.


Note You need to log in before you can comment on or make changes to this bug.