public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110204] New: Suspicous warning when compiling ranges-v3 using GCC trunk (iteration 9223372036854775807 invokes undefined behavior)
@ 2023-06-10 14:41 jun at junz dot org
  2023-06-10 15:54 ` [Bug tree-optimization/110204] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jun at junz dot org @ 2023-06-10 14:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110204
           Summary: Suspicous warning when compiling ranges-v3 using GCC
                    trunk (iteration 9223372036854775807 invokes undefined
                    behavior)
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jun at junz dot org
  Target Milestone: ---

Given code:

#include <vector>
#include <map>
#include <range/v3/all.hpp>

std::map<int, int> m;

std::vector<int> foo() {
  return ranges::to<std::vector>(m | ranges::views::keys);
}

GCC trunk reports:

/opt/compiler-explorer/gcc-trunk-20230610/include/c++/14.0.0/bits/stl_iterator_base_funcs.h:175:9:
warning: iteration 9223372036854775807 invokes undefined behavior
[-Waggressive-loop-optimizations]
  175 |         while (__n--)
      |         ^~~~~
/opt/compiler-explorer/gcc-trunk-20230610/include/c++/14.0.0/bits/stl_iterator_base_funcs.h:175:9:
note: within this loop

while Clang and GCC 13 both say OK. I think this is a regression.
goldbolt link: https://godbolt.org/z/W33aMqr5c

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

end of thread, other threads:[~2023-07-20 12:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-10 14:41 [Bug c++/110204] New: Suspicous warning when compiling ranges-v3 using GCC trunk (iteration 9223372036854775807 invokes undefined behavior) jun at junz dot org
2023-06-10 15:54 ` [Bug tree-optimization/110204] " pinskia at gcc dot gnu.org
2023-06-10 15:54 ` [Bug tree-optimization/110204] [14 Regression] " pinskia at gcc dot gnu.org
2023-07-15  3:34 ` pinskia at gcc dot gnu.org
2023-07-15  3:48 ` pinskia at gcc dot gnu.org
2023-07-15  3:56 ` pinskia at gcc dot gnu.org
2023-07-17  9:55 ` rguenth at gcc dot gnu.org
2023-07-19 13:12 ` rguenth at gcc dot gnu.org
2023-07-20 12:46 ` cvs-commit at gcc dot gnu.org
2023-07-20 12:55 ` rguenth 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).