public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95221] New: g++.dg/ubsan/vptr-12.C fails with -fstrong-eval-order=all
@ 2020-05-19 20:06 mpolacek at gcc dot gnu.org
  2020-05-19 20:09 ` [Bug c++/95221] " mpolacek at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-19 20:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95221
           Summary: g++.dg/ubsan/vptr-12.C fails with
                    -fstrong-eval-order=all
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

It's this code:

struct MyClass
{
  virtual ~MyClass () {}
  virtual void Doit () {}
};

int
main ()
{
  MyClass *c = new MyClass;
  c->~MyClass ();
  c->Doit ();

  return 0;
}

$ g++ vptr-12.C -fsanitize=vptr -fno-sanitize-recover=vptr
-fstrong-eval-order=some; ./a.out
vptr-12.C:16:11: runtime error: member call on address 0x000000a25eb0 which
does not point to an object of type 'MyClass'
0x000000a25eb0: note: object has invalid vptr
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00  41 f1 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              invalid vptr

but

$ g++ vptr-12.C -fsanitize=vptr -fno-sanitize-recover=vptr
-fstrong-eval-order=all; ./a.out
Segmentation fault (core dumped)

This is important because C++17 implies -fstrong-eval-order=all.

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

end of thread, other threads:[~2020-06-01 20:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-19 20:06 [Bug c++/95221] New: g++.dg/ubsan/vptr-12.C fails with -fstrong-eval-order=all mpolacek at gcc dot gnu.org
2020-05-19 20:09 ` [Bug c++/95221] " mpolacek at gcc dot gnu.org
2020-05-19 20:22 ` mpolacek at gcc dot gnu.org
2020-05-19 20:30 ` mpolacek at gcc dot gnu.org
2020-05-19 21:57 ` pinskia at gcc dot gnu.org
2020-05-19 22:02 ` mpolacek at gcc dot gnu.org
2020-05-20  5:18 ` jason at gcc dot gnu.org
2020-05-22  3:32 ` jason at gcc dot gnu.org
2020-05-22 21:04 ` jason at gcc dot gnu.org
2020-05-29 16:21 ` cvs-commit at gcc dot gnu.org
2020-06-01 20:52 ` cvs-commit 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).