public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95103] New: Unexpected -Wclobbered in bits/vector.tcc with -O2
@ 2020-05-13 12:10 sbergman at redhat dot com
  2020-05-14  6:14 ` [Bug c++/95103] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: sbergman at redhat dot com @ 2020-05-13 12:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95103
           Summary: Unexpected -Wclobbered in bits/vector.tcc with -O2
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sbergman at redhat dot com
  Target Milestone: ---

I have seen this with at least some GCC 7, and still see it with GCC 10 and
with recent trunk:

> $ cat test.cc
> #include <csetjmp>
> #include <vector>
> struct S {
>     S(int);
>     ~S();
> };
> void f1();
> bool f2(char const (& s)[3]) {
>     for (int i = 0; i != 2; ++i) {
>         if (s[i] != 'x') {
>             return false;
>         }
>     }
>     return true;
> }
> void f3() {
>     std::vector<S> v;
>     for (int i = 0; i != 2; ++i) {
>         if (!f2("xx")) f1();
>         v.push_back(0);
>     }
>     std::jmp_buf b;
>     setjmp(b);
> }

> $ g++ -Wclobbered -O2 -c test.cc
> In file included from /usr/include/c++/10/vector:72,
>                  from test.cc:2:
> /usr/include/c++/10/bits/vector.tcc: In function ‘void f3()’:
> /usr/include/c++/10/bits/vector.tcc:441:15: warning: variable ‘__new_finish’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
>   441 |       pointer __new_finish(__new_start);
>       |               ^~~~~~~~~~~~

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

end of thread, other threads:[~2021-07-22 22:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-13 12:10 [Bug c++/95103] New: Unexpected -Wclobbered in bits/vector.tcc with -O2 sbergman at redhat dot com
2020-05-14  6:14 ` [Bug c++/95103] " rguenth at gcc dot gnu.org
2020-05-14  6:36 ` sbergman at redhat dot com
2020-05-14  9:33 ` amonakov at gcc dot gnu.org
2020-05-14 10:22 ` redi at gcc dot gnu.org
2020-05-14 10:35 ` amonakov at gcc dot gnu.org
2021-07-22 22:25 ` [Bug middle-end/95103] " 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).