[Bug c++/110204] New: Suspicous warning when compiling ranges-v3 using GCC trunk (iteration 9223372036854775807 invokes undefined behavior)

2023-06-10 Thread jun at junz dot org via 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 
#include 
#include 

std::map m;

std::vector foo() {
  return ranges::to(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

[Bug c++/104765] Expression statement with a return in a lambda-parameter-default causes segfault when called in a different function

2022-03-09 Thread jun at junz dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104765

Jun Zhang  changed:

   What|Removed |Added

 CC||jun at junz dot org

--- Comment #5 from Jun Zhang  ---
Hi, I wonder how's the issue going on?

Do we plan to disable expression statements in all default arguments or only in
lambda and templates? (I'm working on this in clang so I want to know how GCC
deals with it)

Thanks!