From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 882923858C54; Fri, 14 Apr 2023 19:40:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 882923858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681501255; bh=cUcqdTQmwX/PwgMp7v9Lpe0yqC+exmKiTEdsScbeY3s=; h=From:To:Subject:Date:From; b=timyqPyWgCYgrNGssp1EEZpJfOGZ6BCo+K41Z3S70zW5oMxDwSWwiNuljfYR31p9t 6JaRIDdaH8rnf2bK9w5nexEGbqAXY4trSYryRc1DTmsE9PsVRslESyZiz/AIdE+nk7 V1MhE3y5+Rc6zTdU5h1T8/80B9Vpne+1ghRD3nY4= From: "terra at gnome dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109517] New: Failure to compile constexpr std::copy with -D_GLIBCXX_DEBUG Date: Fri, 14 Apr 2023 19:40:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: terra at gnome dot 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 target_milestone attachments.created 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=3D109517 Bug ID: 109517 Summary: Failure to compile constexpr std::copy with -D_GLIBCXX_DEBUG Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: terra at gnome dot org Target Milestone: --- Created attachment 54861 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D54861&action=3Dedit Preprocessed source code The following program fails to compile with -std=3Dgnu++20 -D_GLIBCXX_DEBUG due to something in the library not being constexpr. It compiles just fine without -D_GLIBCXX_DEBUG. FWIW, clang 15 sees no pro= blem (without -D...) other than "farm" being unused. ------------------------------------------------------------------ #include #include #include class wrapper : public std::array { public: constexpr wrapper(std::initializer_list list) { std::copy(list.begin(), list.end(), this->begin()); } }; constexpr wrapper farm =3D { "moo", "oink", "baa" }; ------------------------------------------------------------------ /usr/local/products/gcc/12.1.0/bin/g++ -v -std=3Dgnu++20 -D_GLIBCXX_DEBUG = -c uuu.C Using built-in specs. COLLECT_GCC=3D/usr/local/products/gcc/12.1.0/bin/g++ COLLECT_LTO_WRAPPER=3D/usr/local/products/gcc/12.1.0/lib/gcc/x86_64-suse-li= nux/12.1.0/lto-wrapper Target: x86_64-suse-linux Configured with: ../../gcc-12.1.0/configure --enable-languages=3Dc,c++,fort= ran --enable-targets=3Dx86_64-suse-linux,i686-suse-linux --prefix=3D/usr/local/products/gcc/12.1.0 --with-gnu-as --with-as=3D/usr/local/products/gcc/binutils-2.38/bin/as --with-ld=3D/usr/local/products/gcc/binutils-2.38/bin/ld.gold --enable-link= -mutex --enable-gnu-indirect-functions --enable-linux-futex --enable-threads=3Dpos= ix --enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=3Dnew x86_64-suse-linux Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.1.0 (GCC)=20 COLLECT_GCC_OPTIONS=3D'-v' '-std=3Dgnu++20' '-D' '_GLIBCXX_DEBUG' '-shared-= libgcc' '-mtune=3Dgeneric' '-march=3Dx86-64' '-dumpdir' 'a-' /usr/local/products/gcc/12.1.0/lib/gcc/x86_64-suse-linux/12.1.0/cc1plus -q= uiet -v -D_GNU_SOURCE -D _GLIBCXX_DEBUG uuu.C -quiet -dumpdir a- -dumpbase uuu.C -dumpbase-ext .C -mtune=3Dgeneric -march=3Dx86-64 -std=3Dgnu++20 -version -o /tmp/cc5WkAgd.s GNU C++20 (GCC) version 12.1.0 (x86_64-suse-linux) compiled by GNU C version 12.1.0, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP GGC heuristics: --param ggc-min-expand=3D100 --param ggc-min-heapsize=3D131= 072 ignoring nonexistent directory "/usr/local/products/gcc/12.1.0/lib64/gcc/x86_64-suse-linux/12.1.0/../../..= /../x86_64-suse-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/local/products/gcc/12.1.0/lib64/gcc/x86_64-suse-linux/12.1.0/../../../= ../include/c++/12.1.0 /usr/local/products/gcc/12.1.0/lib64/gcc/x86_64-suse-linux/12.1.0/../../../= ../include/c++/12.1.0/x86_64-suse-linux /usr/local/products/gcc/12.1.0/lib64/gcc/x86_64-suse-linux/12.1.0/../../../= ../include/c++/12.1.0/backward /usr/local/products/gcc/12.1.0/lib64/gcc/x86_64-suse-linux/12.1.0/include /usr/local/include /usr/local/products/gcc/12.1.0/include /usr/local/products/gcc/12.1.0/lib64/gcc/x86_64-suse-linux/12.1.0/include-f= ixed /usr/include End of search list. GNU C++20 (GCC) version 12.1.0 (x86_64-suse-linux) compiled by GNU C version 12.1.0, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP GGC heuristics: --param ggc-min-expand=3D100 --param ggc-min-heapsize=3D131= 072 Compiler executable checksum: 9e0c9110c7d4f6deb64439dc23f707eb In file included from /usr/local/products/gcc/12.1.0/include/c++/12.1.0/debug/stl_iterator.h:32, from /usr/local/products/gcc/12.1.0/include/c++/12.1.0/bits/stl_iterator.h:2559, from /usr/local/products/gcc/12.1.0/include/c++/12.1.0/bits/stl_algobase.h:67, from /usr/local/products/gcc/12.1.0/include/c++/12.1.0/array:43, from uuu.C:1: uuu.C:12:49: in =E2=80=98constexpr=E2=80=99 expansion of =E2=80=98wrapper= (std::initializer_list{((const char* const*)(& const char* const [3]{((const char*)"moo"), ((const char*)"oink"), ((const char*)"baa")})), 3})=E2=80=99 uuu.C:8:14: in =E2=80=98constexpr=E2=80=99 expansion of =E2=80=98std::cop= y(list.std::initializer_list::begin(), list.std::initializer_list::end(), ((wrapper*)this)->wrapper::.std::array::begin())= =E2=80=99 /usr/local/products/gcc/12.1.0/include/c++/12.1.0/bits/stl_algobase.h:617:7= :=20=20 in =E2=80=98constexpr=E2=80=99 expansion of =E2=80=98__gnu_debug::__valid_r= ange(__first, __last, __dist)=E2=80=99 /usr/local/products/gcc/12.1.0/include/c++/12.1.0/debug/helper_functions.h:= 234:31: in =E2=80=98constexpr=E2=80=99 expansion of =E2=80=98__gnu_debug::__valid= _range_aux(__first, __last, (* & __dist), (_Integral(), _Integral()))=E2=80=99 /usr/local/products/gcc/12.1.0/include/c++/12.1.0/debug/helper_functions.h:= 200:29: in =E2=80=98constexpr=E2=80=99 expansion of =E2=80=98__gnu_debug::__valid= _range_aux(__first, __last, (std::input_iterator_tag(), std::input_iterator_tag()))=E2=80=99 /usr/local/products/gcc/12.1.0/include/c++/12.1.0/debug/helper_functions.h:= 136:20: error: =E2=80=98(((const char* const*)(&)) =3D=3D 0)=E2=80=99 is= not a constant expression 136 | { return __ptr =3D=3D 0; } | ~~~~~~^~~~=