From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark H Weaver Subject: bug#31708: 'gcc-strmov-store-file-names.patch' causes GCC segfaults Date: Mon, 04 Jun 2018 21:00:37 -0400 Message-ID: <87sh623v4a.fsf@netris.org> References: <87k1reuc4r.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQ0MR-00008K-LO for bug-guix@gnu.org; Mon, 04 Jun 2018 21:02:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fQ0MM-0006ES-No for bug-guix@gnu.org; Mon, 04 Jun 2018 21:02:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:54106) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fQ0MM-0006E7-K3 for bug-guix@gnu.org; Mon, 04 Jun 2018 21:02:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fQ0MM-0007vK-5m for bug-guix@gnu.org; Mon, 04 Jun 2018 21:02:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87k1reuc4r.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 04 Jun 2018 11:36:20 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 31708@debbugs.gnu.org ludo@gnu.org (Ludovic Court=C3=A8s) writes: > On current =E2=80=98core-updates=E2=80=99, we have: > > $ readlink -f $(type -P gcc) > /gnu/store/zrhwhlqqk51qslbddk4cip2z2p3fpvxd-gcc-5.5.0/bin/gcc > ludo@ribbon /home/ludo/src/guix/+core-updates$ cat strmov-ice.c > #define _GNU_SOURCE > #include > > void foo (char *x) > { > static const char buf[12]; > memcpy (x, buf, 12); > } > $ gcc -dH -O2 -Wall -c strmov-ice.c > strmov-ice.c: In function =E2=80=98foo=E2=80=99: > strmov-ice.c:7:3: internal compiler error: Segmentation fault > memcpy (x, buf, 12); > ^ > gcc: internal compiler error: Aborted (program cc1) [...] > This is because DECL_INITIAL returns NULL_TREE for =E2=80=98buf=E2=80=99,= but > =E2=80=98store_reference_p=E2=80=99 doesn=E2=80=99t check whether we got = NULL_TREE. > > The fix is very simple (adding a NULL_TREE check), but in the meantime > we need to work around it. > > A simple workaround is to pass an initializer to the static const array: > > $ cat strmov-ice.c > #define _GNU_SOURCE > #include > > void foo (char *x) > { > static const char buf[12] =3D { 0, }; > memcpy (x, buf, 12); > } > $ gcc -dH -O2 -Wall -c strmov-ice.c > $ echo $? > 0 > > The meaning of the program is unchanged but the bug is not triggered. Thanks for tracking this down. This explains why I've been seeing an unusually large number of internal compiler errors in this core-updates cycle. It was a bit surprising since we used the same compiler in the previous cycle, so I was wondering what might be causing it. At the moment, the most pressing failure caused by this bug is 'doxygen' on armhf, which causes GCC to crash deterministically in the same place every time, with many important dependency failures. https://hydra.gnu.org/build/2669344 However, it's not obvious to me how best to work around the issue in this case. Here's the error message: --8<---------------cut here---------------start------------->8--- [ 36%] Building CXX object qtools/CMakeFiles/qtools.dir/qutfcodec.cpp.o cd /tmp/guix-build-doxygen-1.8.13.drv-0/build/qtools && /gnu/store/cd5q2pni= 1d95fs3cdabbclyh9hqhw2nq-gcc-5.5.0/bin/c++ -I/gnu/store/zjgd0wcbwxz8469sk= x5s83kibycf1n5p-glibc-2.27/include -I/tmp/guix-build-doxygen-1.8.13.drv-0/d= oxygen-1.8.13/qtools/. -O2 -g -DNDEBUG -o CMakeFiles/qtools.dir/qutfcode= c.cpp.o -c /tmp/guix-build-doxygen-1.8.13.drv-0/doxygen-1.8.13/qtools/qutfc= odec.cpp /tmp/guix-build-doxygen-1.8.13.drv-0/doxygen-1.8.13/qtools/qutfcodec.cpp: I= n member function =C3=A2=E2=82=AC=CB=9Cvirtual QCString QUtf16Encoder::from= Unicode(const QString&, int&)=C3=A2=E2=82=AC=E2=84=A2: /tmp/guix-build-doxygen-1.8.13.drv-0/doxygen-1.8.13/qtools/qutfcodec.cpp:21= 2:61: internal compiler error: Segmentation fault memcpy(d.rawData(),&QChar::byteOrderMark,sizeof(QChar)); ^ Please submit a full bug report, with preprocessed source if appropriate. See for instructions. make[2]: *** [qtools/CMakeFiles/qtools.dir/build.make:391: qtools/CMakeFile= s/qtools.dir/qutfcodec.cpp.o] Error 1 --8<---------------cut here---------------end--------------->8--- Here's the declaration of QChar::byteOrderMark from qtools/qstring.h, included in the doxygen tarball: --8<---------------cut here---------------start------------->8--- class Q_EXPORT Q_PACKED QChar { public: QChar(); QChar( char c ); QChar( uchar c ); QChar( uchar c, uchar r ); QChar( const QChar& c ); QChar( ushort rc ); QChar( short rc ); QChar( uint rc ); QChar( int rc ); QT_STATIC_CONST QChar null; // 0000 QT_STATIC_CONST QChar replacement; // FFFD QT_STATIC_CONST QChar byteOrderMark; // FEFF QT_STATIC_CONST QChar byteOrderSwapped; // FFFE QT_STATIC_CONST QChar nbsp; // 00A0 --8<---------------cut here---------------end--------------->8--- and here's its definition, from qtools/qstring.cpp line 12179: QT_STATIC_CONST_IMPL QChar QChar::byteOrderMark((ushort)0xfeff); Any suggestions? I've managed to avoid working with C++ so far in this millenium, so I'm a bit rusty. Mark