public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/96003] New: Maybe a false positive for -Werror=nonnull
@ 2020-06-30 11:38 marxin at gcc dot gnu.org
  2020-06-30 11:45 ` [Bug tree-optimization/96003] " jakub at gcc dot gnu.org
                   ` (28 more replies)
  0 siblings, 29 replies; 30+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-06-30 11:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96003
           Summary: Maybe a false positive for -Werror=nonnull
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: msebor at gcc dot gnu.org
  Target Milestone: ---

It's reduced from inkscape project. Happens since r11-1697-g75ff24e1920ea6b1:

$ cat /tmp/folis.ii
class Managed {};
class Anchored {
public:
  void release();
  Managed _anchor;
};
template <typename R> void release(R r) {
  static_cast<Anchored *>(r)->release();
}
class Selection : Managed, public Anchored {};
class AppSelectionModel {
  AppSelectionModel() { release(new Selection); }
};

$ g++ /tmp/folis.ii -Werror=nonnull
/tmp/folis.ii: In instantiation of ‘void release(R) [with R = Selection*]’:
/tmp/folis.ii:12:46:   required from here
/tmp/folis.ii:8:38: error: ‘this’ pointer null [-Werror=nonnull]
    8 |   static_cast<Anchored *>(r)->release();
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/tmp/folis.ii:4:8: note: in a call to non-static member function ‘void
Anchored::release()’
    4 |   void release();
      |        ^~~~~~~
cc1plus: some warnings being treated as errors

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

end of thread, other threads:[~2021-06-15 21:26 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-30 11:38 [Bug tree-optimization/96003] New: Maybe a false positive for -Werror=nonnull marxin at gcc dot gnu.org
2020-06-30 11:45 ` [Bug tree-optimization/96003] " jakub at gcc dot gnu.org
2020-06-30 11:54 ` marxin at gcc dot gnu.org
2020-07-09  7:04 ` slyfox at inbox dot ru
2020-07-09 15:22 ` [Bug tree-optimization/96003] [11 Regression] " msebor at gcc dot gnu.org
2020-07-09 15:28 ` [Bug c++/96003] " msebor at gcc dot gnu.org
2020-07-09 17:40 ` slyfox at inbox dot ru
2020-07-15  6:59 ` rguenth at gcc dot gnu.org
2020-07-16  7:37 ` slyfox at inbox dot ru
2020-07-17  6:48 ` slyfox at inbox dot ru
2020-07-17 11:20 ` romain.geissler at amadeus dot com
2020-07-17 15:13 ` msebor at gcc dot gnu.org
2020-07-17 19:01 ` [Bug c++/96003] [11 Regression] spurious -Wnonnull calling a member on the result of static_cast msebor at gcc dot gnu.org
2020-07-21 19:27 ` sbergman at redhat dot com
2020-07-21 20:39 ` msebor at gcc dot gnu.org
2020-07-22 11:35 ` sbergman at redhat dot com
2020-07-30  7:36 ` marxin at gcc dot gnu.org
2020-07-30 14:30 ` msebor at gcc dot gnu.org
2020-07-31 16:29 ` cvs-commit at gcc dot gnu.org
2020-07-31 16:36 ` msebor at gcc dot gnu.org
2020-07-31 16:39 ` msebor at gcc dot gnu.org
2021-02-08  9:40 ` marxin at gcc dot gnu.org
2021-02-16 17:39 ` msebor at gcc dot gnu.org
2021-02-16 17:44 ` msebor at gcc dot gnu.org
2021-02-16 18:47 ` marxin at gcc dot gnu.org
2021-02-16 18:52 ` marxin at gcc dot gnu.org
2021-02-16 20:14 ` msebor at gcc dot gnu.org
2021-02-18  9:08 ` marxin at gcc dot gnu.org
2021-02-18  9:15 ` marxin at gcc dot gnu.org
2021-06-15 21:26 ` nyh at math dot technion.ac.il

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).