From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F1428385829C; Tue, 13 Feb 2024 12:49:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F1428385829C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707828543; bh=P1+kir0+bM7LWtRqN8nQs6pgqlo43OPm+e68V/eLT/g=; h=From:To:Subject:Date:From; b=VMOZPMG5wlcwKw8AJyiN+7JWMzD2XeyECBlKCZrk8DAhZO0yl1bvr7hGzLJ5D/MKt eEgD84lPaEm5PcplmjfEbuu7IGCIX04emHhtcBisi5WpwH8ZILOLFeGdlJj0GfZxd+ HhTsN7mePiXLx/OM3bHi6QX5xliqjSXc4vnqwgn8= From: "sjames at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/113907] New: [14 regression] ICU miscompiled since on x86 since r14-5109-ga291237b628f41 Date: Tue, 13 Feb 2024 12:49:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: sjames at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113907 Bug ID: 113907 Summary: [14 regression] ICU miscompiled since on x86 since r14-5109-ga291237b628f41 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: sjames at gcc dot gnu.org CC: amacleod at redhat dot com, arsen at gcc dot gnu.org Target Milestone: --- Originally reported downstream in Gentoo at https://bugs.gentoo.org/924153. ICU seems miscompiled on x86 (-m32) since r14-5109-ga291237b628f41. My C++ = is ~non-existent so I can't reduce it. I appreciate this isn't a great level of detail. It crashes during the build when running a just-built executable: ``` i686-pc-linux-gnu-g++ -D_REENTRANT -DU_DEBUG=3D1 -DU_HAVE_ELF_H=3D1 -DU_HAVE_STRTOD_L=3D1 -DU_HAVE_XLOCALE_H=3D0 -DU_DISABLE_RENAMING=3D1 -I/var/tmp/portage/dev-libs/icu-74.2/work/icu/source/common -I/var/tmp/portage/dev-libs/icu-74.2/work/icu/source/tools/icupkg/../toolut= il -DU_ATTRIBUTE_DEPRECATED=3D -O2 -march=3Di686 -pipe -pipe -frecord-gcc-swit= ches -fno-diagnostics-color -fmessage-length=3D0 -std=3Dc++14 -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long -c -o icupkg.o /var/tmp/portage/dev-libs/icu-74.2/work/icu/source/tools/icupkg/icupkg.cpp [..] i686-pc-linux-gnu-g++ -O2 -march=3Di686 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=3D0 -std=3Dc++14 -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long -Wl,-O1 -Wl,--as-needed -Wl,--defsym=3D__gentoo_check_ldflags__=3D0 -o ../../bin/icupkg icupkg.o -L../../lib -licutu -L../../lib -licui18n -L../../lib -licuuc -L../../stubd= ata -licudata -lpthread -lm=20=20 [...] Unpacking /var/tmp/portage/dev-libs/icu-74.2/work/icu/source/data/in/icudt74l.dat and generating out/tmp/icudata.lst (list of data files) LD_LIBRARY_PATH=3D../lib:../stubdata:../tools/ctestfw:$LD_LIBRARY_PATH=20 ../bin/icupkg -d ./out/build/icudt74l --list -x \* /var/tmp/portage/dev-libs/icu-74.2/work/icu/source/data/in/icudt74l.dat -o out/tmp/icudata.lst make[1]: *** [Makefile:272: out/tmp/icudata.lst] Segmentation fault make[1]: *** Waiting for unfinished jobs.... make[2]: Leaving directory '/var/tmp/portage/dev-libs/icu-74.2/work/icu/source-abi_x86_32.x86/data' make[1]: Leaving directory '/var/tmp/portage/dev-libs/icu-74.2/work/icu/source-abi_x86_32.x86/data' make: *** [Makefile:153: all-recursive] Error 2 * ERROR: dev-libs/icu-74.2::gentoo failed (compile phase): * emake failed ``` Valgrind says: ``` =3D=3D26485=3D=3D Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward = et al. =3D=3D26485=3D=3D Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyr= ight info =3D=3D26485=3D=3D Command: ../bin/icupkg -d ./out/build/icudt74l --list -x * /var/tmp/portage/dev-libs/icu-74.1/work/icu/source/data/in/icudt74l.dat -o out/tmp/icudata.lst =3D=3D26485=3D=3D =3D=3D26485=3D=3D Invalid write of size 1 =3D=3D26485=3D=3D at 0x52A0110: memcpy (string_fortified.h:29) =3D=3D26485=3D=3D by 0x52A0110: uprv_copyArray64 (udataswp.cpp:172) =3D=3D26485=3D=3D by 0x52A0110: uprv_copyArray16(UDataSwapper const*, vo= id const*, int, void*, UErrorCode*) (udataswp.cpp:160) =3D=3D26485=3D=3D by 0x52A0630: udata_swapDataHeader (udataswp.cpp:342) =3D=3D26485=3D=3D by 0x48694F1: icu::Package::readPackage(char const*) (package.cpp:483) =3D=3D26485=3D=3D by 0x10987F: main (icupkg.cpp:335) =3D=3D26485=3D=3D Address 0x54f2458 is 0 bytes after a block of size 201,2= 16 alloc'd =3D=3D26485=3D=3D at 0x4842E4D: operator new(unsigned int) (vg_replace_m= alloc.c:476) =3D=3D26485=3D=3D by 0x10936B: main (icupkg.cpp:285) ``` Manual reproduction steps: ``` ./configure CC=3D"gcc -m32" CXX=3D"g++ -m32" CFLAGS=3D"-O2 -ggdb3 -march=3D= i686" CXXFLAGS=3D"-O2 -ggdb3 -march=3Di686" --disable-renaming --disable-layoutex --disable-samples make -j$(nproc) ``` There's some suspicious code there wrt reinterpret_cast but -fno-strict-aliasing doesn't help. It's fine with -O1, but not -O2.=