public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/89800] -Waggressive-loop-optimization warning doesn't have useful location
       [not found] <bug-89800-4@http.gcc.gnu.org/bugzilla/>
@ 2021-09-01 18:19 ` msebor at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: msebor at gcc dot gnu.org @ 2021-09-01 18:19 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |12.0
      Known to fail|                            |10.2.0, 11.2.0, 8.3.0,
                   |                            |9.2.0
          Component|tree-optimization           |middle-end
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org
         Resolution|---                         |FIXED

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
GCC 12 prints the full inlining stack for the test case in comment #0 (thanks
to r12-1992 and related):

In function ‘T foo(T, int) [with T = int]’,
    inlined from ‘int bar(int)’ at pr89800.C:10:28,
    inlined from ‘int main()’ at pr89800.C:14:13:
pr89800.C:5:3: warning: iteration 2147483647 invokes undefined behavior
[-Waggressive-loop-optimizations]
    5 |   while (n--)
      |   ^~~~~
pr89800.C:5:3: note: within this loop


Similarly, for the bigger test case GCC prints the following output
(-Wno-system-headers is no longer necessary):

In file included from
/build/gcc-master/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:66,
                 from
/build/gcc-master/x86_64-pc-linux-gnu/libstdc++-v3/include/array:43,
                 from pr89800-2.C:1:
In function ‘constexpr void std::__advance(_InputIterator&, _Distance,
std::input_iterator_tag) [with _InputIterator =
std::_Fwd_list_const_iterator<int>; _Distance = long int]’,
    inlined from ‘constexpr void std::advance(_InputIterator&, _Distance) [with
_InputIterator = std::_Fwd_list_const_iterator<int>; _Distance = long int]’ at
/build/gcc-master/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_iterator_base_funcs.h:207:21,
    inlined from ‘constexpr _BidirectionalIterator
std::prev(_BidirectionalIterator, typename
std::iterator_traits<_Iter>::difference_type) [with _BidirectionalIterator =
std::_Fwd_list_const_iterator<int>]’ at
/build/gcc-master/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_iterator_base_funcs.h:233:19,
    inlined from ‘typename T::value_type back(const T&) [with T =
std::forward_list<int>]’ at pr89800-2.C:9:20:
/build/gcc-master/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_iterator_base_funcs.h:153:7:
warning: iteration 9223372036854775807 invokes undefined behavior
[-Waggressive-loop-optimizations]
  153 |       while (__n--)
      |       ^~~~~
/build/gcc-master/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_iterator_base_funcs.h:153:7:
note: within this loop

With that I think we can resolve this as fixed.  (The poor phrasing should be
handled separately.  Please open a new bug for it.)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-01 18:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-89800-4@http.gcc.gnu.org/bugzilla/>
2021-09-01 18:19 ` [Bug middle-end/89800] -Waggressive-loop-optimization warning doesn't have useful location msebor 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).