public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/109517] New: Failure to compile constexpr std::copy with -D_GLIBCXX_DEBUG
@ 2023-04-14 19:40 terra at gnome dot org
  2023-04-18  9:52 ` [Bug libstdc++/109517] " redi at gcc dot gnu.org
  2023-04-18  9:55 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: terra at gnome dot org @ 2023-04-14 19:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109517

            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=54861&action=edit
Preprocessed source code

The following program fails to compile with -std=gnu++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 problem
(without -D...) other than "farm" being unused.


------------------------------------------------------------------

#include <array>
#include <algorithm>
#include <initializer_list>

class wrapper : public std::array<const char *, 3> {
public:
  constexpr wrapper(std::initializer_list<const char *> list) {
    std::copy(list.begin(), list.end(), this->begin());
  }
};

constexpr wrapper farm = { "moo", "oink", "baa" };

------------------------------------------------------------------


/usr/local/products/gcc/12.1.0/bin/g++ -v  -std=gnu++20 -D_GLIBCXX_DEBUG -c
uuu.C
Using built-in specs.
COLLECT_GCC=/usr/local/products/gcc/12.1.0/bin/g++
COLLECT_LTO_WRAPPER=/usr/local/products/gcc/12.1.0/lib/gcc/x86_64-suse-linux/12.1.0/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../../gcc-12.1.0/configure --enable-languages=c,c++,fortran
--enable-targets=x86_64-suse-linux,i686-suse-linux
--prefix=/usr/local/products/gcc/12.1.0 --with-gnu-as
--with-as=/usr/local/products/gcc/binutils-2.38/bin/as
--with-ld=/usr/local/products/gcc/binutils-2.38/bin/ld.gold --enable-link-mutex
--enable-gnu-indirect-functions --enable-linux-futex --enable-threads=posix
--enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new
x86_64-suse-linux
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.1.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-std=gnu++20' '-D' '_GLIBCXX_DEBUG' '-shared-libgcc'
'-mtune=generic' '-march=x86-64' '-dumpdir' 'a-'
 /usr/local/products/gcc/12.1.0/lib/gcc/x86_64-suse-linux/12.1.0/cc1plus -quiet
-v -D_GNU_SOURCE -D _GLIBCXX_DEBUG uuu.C -quiet -dumpdir a- -dumpbase uuu.C
-dumpbase-ext .C -mtune=generic -march=x86-64 -std=gnu++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=100 --param ggc-min-heapsize=131072
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-fixed
 /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=100 --param ggc-min-heapsize=131072
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 ‘constexpr’ expansion of ‘wrapper(std::initializer_list<const
char*>{((const char* const*)(& const char* const [3]{((const char*)"moo"),
((const char*)"oink"), ((const char*)"baa")})), 3})’
uuu.C:8:14:   in ‘constexpr’ expansion of ‘std::copy<const char* const*, const
char**>(list.std::initializer_list<const char*>::begin(),
list.std::initializer_list<const char*>::end(),
((wrapper*)this)->wrapper::<anonymous>.std::array<const char*, 3>::begin())’
/usr/local/products/gcc/12.1.0/include/c++/12.1.0/bits/stl_algobase.h:617:7:  
in ‘constexpr’ expansion of ‘__gnu_debug::__valid_range<const char*
const*>(__first, __last, __dist)’
/usr/local/products/gcc/12.1.0/include/c++/12.1.0/debug/helper_functions.h:234:31:
  in ‘constexpr’ expansion of ‘__gnu_debug::__valid_range_aux<const char*
const*>(__first, __last, (* & __dist), (_Integral(), _Integral()))’
/usr/local/products/gcc/12.1.0/include/c++/12.1.0/debug/helper_functions.h:200:29:
  in ‘constexpr’ expansion of ‘__gnu_debug::__valid_range_aux<const char*
const*>(__first, __last, (std::input_iterator_tag(),
std::input_iterator_tag()))’
/usr/local/products/gcc/12.1.0/include/c++/12.1.0/debug/helper_functions.h:136:20:
error: ‘(((const char* const*)(&<anonymous>)) == 0)’ is not a constant
expression
  136 |     { return __ptr == 0; }
      |              ~~~~~~^~~~

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libstdc++/109517] Failure to compile constexpr std::copy with -D_GLIBCXX_DEBUG
  2023-04-14 19:40 [Bug libstdc++/109517] New: Failure to compile constexpr std::copy with -D_GLIBCXX_DEBUG terra at gnome dot org
@ 2023-04-18  9:52 ` redi at gcc dot gnu.org
  2023-04-18  9:55 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2023-04-18  9:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109517

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=108617

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think this is a front end bug, not a library bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libstdc++/109517] Failure to compile constexpr std::copy with -D_GLIBCXX_DEBUG
  2023-04-14 19:40 [Bug libstdc++/109517] New: Failure to compile constexpr std::copy with -D_GLIBCXX_DEBUG terra at gnome dot org
  2023-04-18  9:52 ` [Bug libstdc++/109517] " redi at gcc dot gnu.org
@ 2023-04-18  9:55 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2023-04-18  9:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109517

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Ah yes, this is a dup of bug 106212 which is caused by bug 85944

*** This bug has been marked as a duplicate of bug 85944 ***

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-18  9:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-14 19:40 [Bug libstdc++/109517] New: Failure to compile constexpr std::copy with -D_GLIBCXX_DEBUG terra at gnome dot org
2023-04-18  9:52 ` [Bug libstdc++/109517] " redi at gcc dot gnu.org
2023-04-18  9:55 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).