public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96414] New: Second char relation test incorrect with constexpr dynamic allocation
@ 2020-08-02  0:13 pkeir at outlook dot com
  2020-08-02  0:15 ` [Bug c++/96414] " pkeir at outlook dot com
  2021-04-19  1:53 ` ppalka at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: pkeir at outlook dot com @ 2020-08-02  0:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96414
           Summary: Second char relation test incorrect with constexpr
                    dynamic allocation
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pkeir at outlook dot com
  Target Milestone: ---

Created attachment 48981
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48981&action=edit
The file containing the code described.

The attached C++20 code behaves differently at compile-time than at runtime,
but shouldn't. As with `__gnu_cxx::char_traits<char>::lt`, the function
`lt_fun` applies built-in `operator<` to two character references, and returns
the result as an `int`. However, with the character pointer `pc` pointing to
memory allocated dynamically, the second call returns true (1) indicating that
'a' < 'a' is true. This is demonstrated by a failing static assert. Commenting
out the static assert produces an executable which correctly reports that 'a' <
'a' is false; by returning a 0.

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

end of thread, other threads:[~2021-04-19  1:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-02  0:13 [Bug c++/96414] New: Second char relation test incorrect with constexpr dynamic allocation pkeir at outlook dot com
2020-08-02  0:15 ` [Bug c++/96414] " pkeir at outlook dot com
2021-04-19  1:53 ` ppalka 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).