public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111714] New: Strange behavior when casting std::size_t to bool, UB or compiler bug?
@ 2023-10-06 13:59 carlosgalvezp at gmail dot com
  2023-10-06 15:02 ` [Bug c++/111714] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: carlosgalvezp at gmail dot com @ 2023-10-06 13:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111714
           Summary: Strange behavior when casting std::size_t to bool, UB
                    or compiler bug?
           Product: gcc
           Version: 9.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: carlosgalvezp at gmail dot com
  Target Milestone: ---

Created attachment 56067
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56067&action=edit
Test case

Hi!

We are bumping from GCC 7.5 to 9.4 and one of our tests fail. The test works on
GCC 10 and above, as well as Clang trunk. Sanitizers (GCC and Clang) and
Valgrind don't report anything.

I have managed to create a minimal example here:
https://godbolt.org/z/3q7c4qYzE (attached to the bug as a file as well).

There's also comments about changes to the code that can make the test pass.

This smells a lot like UB, but I can't figure out what is wrong with the code.
Otherwise it could well be a compiler bug. Is there anything obvious you can
see that could explain the behavior?

Thanks!

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

end of thread, other threads:[~2023-10-06 16:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-06 13:59 [Bug c++/111714] New: Strange behavior when casting std::size_t to bool, UB or compiler bug? carlosgalvezp at gmail dot com
2023-10-06 15:02 ` [Bug c++/111714] " rguenth at gcc dot gnu.org
2023-10-06 15:19 ` pinskia at gcc dot gnu.org
2023-10-06 16:25 ` [Bug tree-optimization/111714] " carlosgalvezp at gmail dot com
2023-10-06 16:26 ` pinskia 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).