From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 798A23858418; Sat, 30 Dec 2023 18:03:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 798A23858418 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703959388; bh=BAj2BE3ULiPESwaq8DhMlg3zGOsHt4N25Jln/hlVTa8=; h=From:To:Subject:Date:From; b=SYzMG3U5A66O/yB8spqva3iooZuurwq5FJrfntc4uceteDjeUbOL1/tz/sXTWXqkM xQtnHzH0rLyFd/4x3eturHITSC8cmenvG9C/YArnC1wUpWdg3uTIbnBzdt5jdFWa+x 6lCU9smKIPpBeB8YR8sQADQ7LRL99eorQ6NHmMuw= From: "danglin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/113182] New: [14 Regression] FAIL: g++.dg/cpp0x/udlit-namespace.C -std=c++14 execution test Date: Sat, 30 Dec 2023 18:03:06 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: other X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: danglin 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 cf_gcchost cf_gcctarget cf_gccbuild 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=3D113182 Bug ID: 113182 Summary: [14 Regression] FAIL: g++.dg/cpp0x/udlit-namespace.C -std=3Dc++14 execution test Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: danglin at gcc dot gnu.org CC: jemarch at gcc dot gnu.org Target Milestone: --- Host: hppa64-hp-hpux11.11 Target: hppa64-hp-hpux11.11 Build: hppa64-hp-hpux11.11 Executing on host: /home/dave/gnu/gcc/objdir64/gcc/testsuite/g++/../../xg++ -B/h ome/dave/gnu/gcc/objdir64/gcc/testsuite/g++/../../ exceptions_enabled19821= .cc -fdiagnostics-plain-output -nostdinc++ -I/home/dave/gnu/gcc/objdir64/hppa64-h p-hpux11.11/libstdc++-v3/include/hppa64-hp-hpux11.11 -I/home/dave/gnu/gcc/objdir 64/hppa64-hp-hpux11.11/libstdc++-v3/include -I/home/dave/gnu/gcc/gcc/libstdc++-v 3/libsupc++ -I/home/dave/gnu/gcc/gcc/libstdc++-v3/include/backward -I/home/dave/ gnu/gcc/gcc/libstdc++-v3/testsuite/util -fmessage-length=3D0 -Wno-complain-wrong-l ang -S -o exceptions_enabled19821.s (timeout =3D 300) spawn -ignore SIGHUP /home/dave/gnu/gcc/objdir64/gcc/testsuite/g++/../../xg= ++ -B /home/dave/gnu/gcc/objdir64/gcc/testsuite/g++/../../ exceptions_enabled1982= 1.cc -fdiagnostics-plain-output -nostdinc++ -I/home/dave/gnu/gcc/objdir64/hppa64-hp-h pux11.11/libstdc++-v3/include/hppa64-hp-hpux11.11 -I/home/dave/gnu/gcc/objdir64/ hppa64-hp-hpux11.11/libstdc++-v3/include -I/home/dave/gnu/gcc/gcc/libstdc++-v3/l ibsupc++ -I/home/dave/gnu/gcc/gcc/libstdc++-v3/include/backward -I/home/dave/gnu /gcc/gcc/libstdc++-v3/testsuite/util -fmessage-length=3D0 -Wno-complain-wrong-lang -S -o exceptions_enabled19821.s PASS: g++.dg/cpp0x/udlit-namespace.C -std=3Dc++14 (test for excess errors) Setting LD_LIBRARY_PATH to .:/home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/./libstdc++-v3/src/.libs:= /home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/./libstdc++-v3/src/.libs:/h= ome/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/./libstdc++-v3/src/experiment= al/.libs:/home/dave/gnu/gcc/objdir64/gcc/testsuite/g++/../..:.:/home/dave/g= nu/gcc/objdir64/hppa64-hp-hpux11.11/./libstdc++-v3/src/.libs:/home/dave/gnu= /gcc/objdir64/hppa64-hp-hpux11.11/./libstdc++-v3/src/.libs:/home/dave/gnu/g= cc/objdir64/hppa64-hp-hpux11.11/./libstdc++-v3/src/experimental/.libs:/home= /dave/gnu/gcc/objdir64/gcc/testsuite/g++/../.. Execution timeout is: 300 spawn [open ...] FAIL: g++.dg/cpp0x/udlit-namespace.C -std=3Dc++14 execution test Similar fails: FAIL: g++.dg/cpp0x/udlit-namespace.C -std=3Dc++17 execution test FAIL: g++.dg/cpp0x/udlit-namespace.C -std=3Dc++20 execution test (gdb) r Starting program: /home/dave/gnu/gcc/objdir64/gcc/testsuite/g++/udlit-namespace.exe Program received signal SIGSEGV, Segmentation fault. 0x800003ffbfcd3000 in ?? () from /home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/./libstdc++-v3/src/.libs/li= bstdc++.sl.6 (gdb) bt #0 0x800003ffbfcd3000 in ?? () from /home/dave/gnu/gcc/objdir64/hppa64-hp-hpux11.11/./libstdc++-v3/src/.libs/li= bstdc++.sl.6 #1 0x800003ffbfe5f3f4 in fmodl (x=3D, y=3D) at ../../../../../gcc/libstdc++-v3/src/c++98/math_stubs_long_double.cc:= 117 Backtrace stopped: Cannot access memory at address 0x3333333333333323 This problem was introduced by the following commit: bash-5.1$ git bisect bad f31a019d1161ec78846473da743aedf49cca8c27 is the first bad commit commit f31a019d1161ec78846473da743aedf49cca8c27 Author: Jose E. Marchesi Date: Fri Nov 24 06:30:28 2023 +0100 Emit funcall external declarations only if actually used. There are many places in GCC where alternative local sequences are tried in order to determine what is the cheapest or best alternative to use in the current target. When any of these sequences involve a libcall, the current implementation of emit_library_call_value_1 introduce a side-effect consisting on emitting an external declaration for the funcall (such as __divdi3) which is thus emitted even if the sequence that does the libcall is not retained. This is problematic in targets such as BPF, because the kernel loader chokes on the spurious symbol __divdi3 and makes the resulting BPF object unloadable. Note that BPF objects are not linked before being loaded. This patch changes asssemble_external_libcall to defer emitting declarations of external libcall symbols, by saving the call tree nodes in a temporary list pending_libcall_symbols and letting process_pending_assembly_externals to emit them only if they have been referenced. Solution suggested and sketched by Richard Sandiford. Regtested in x86_64-linux-gnu. Tested with host x86_64-linux-gnu with target bpf-unknown-none. gcc/ChangeLog PR target/109253 * varasm.cc (pending_libcall_symbols): New variable. (process_pending_assemble_externals): Process pending_libcall_symbols. (assemble_external_libcall): Defer emitting external libcall symbols to process_pending_assemble_externals. gcc/testsuite/ChangeLog PR target/109253 * gcc.target/bpf/divmod-libcall-1.c: New test. * gcc.target/bpf/divmod-libcall-2.c: Likewise. * gcc.c-torture/compile/libcall-2.c: Likewise. gcc/testsuite/gcc.c-torture/compile/libcall-2.c | 8 ++++++++ gcc/testsuite/gcc.target/bpf/divmod-libcall-1.c | 19 +++++++++++++++++++ gcc/testsuite/gcc.target/bpf/divmod-libcall-2.c | 16 ++++++++++++++++ gcc/varasm.cc | 22 +++++++++++++++++++++- 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/libcall-2.c create mode 100644 gcc/testsuite/gcc.target/bpf/divmod-libcall-1.c create mode 100644 gcc/testsuite/gcc.target/bpf/divmod-libcall-2.c The problem is we have lost the types for libcall symbols. bash-5.1$ /usr/bin/nm ./hppa64-hp-hpux11.11/libstdc++-v3/src/c++98/math_stubs_long_double.o|less [Index] Value Size Type Bind O Shndx Name [0] | 0| 0|NOTYP|LOCAL|0| UNDEF| ... [69] | 0| 0|NOTYP|GLOB |0| UNDEF|_U_Qfadd [43] | 0| 0|NOTYP|GLOB |0|=20=20 UNDEF|_U_Qfcnvff_dbl_to_quad [42] | 0| 0|NOTYP|GLOB |0|=20=20 UNDEF|_U_Qfcnvff_quad_to_dbl [71] | 0| 0|NOTYP|GLOB |0| UNDEF|_U_Qfdiv [70] | 0| 0|NOTYP|GLOB |0| UNDEF|_U_Qfeq [72] | 0| 0|NOTYP|GLOB |0| UNDEF|_U_Qfmpy [45] | 0| 0|FUNC |GLOB |0| UNDEF|acos [44] | 0| 64|FUNC |GLOB |0|.text.acosl|acosl _U_Qfcnvff_dbl_to_quad, etc, need to have type FUNC. The HP linker does not correctly handle calls to symbols that have type NOTYP. As a result, the call to _U_Qfcnvff_dbl_to_quad branches to a data address. This generates a segmentation fault. See pa_init_libfuncs() in pa.cc.=