On Mon, Nov 25, 2013 at 10:49:56AM +0100, Jakub Jelinek wrote:
> On Mon, Nov 25, 2013 at 10:44:57AM +0100, Marek Polacek wrote:
> > The PR was fixed by Jakub in r205283, this patch merely adds a
> > testcase for it.  Passed ubsan testsuite for -m32/-m64.
> > 
> > Ok for trunk?
> 
> Can't you reduce it at least a little bit more?
> Like I doubt __attribute__ ((__visibility__ ("default")))
> is needed to reproduce, I'd also think you could get rid of the namespaces,
> perhaps also const _Alloc& __a = _Alloc() argument?

Ok, I've played a little bit with it and reduced it down to the
following.  Ok now?

2013-11-25  Marek Polacek  <pola...@redhat.com>

testsuite/
        * g++.dg/ubsan/pr59250.C: New test.

--- gcc/testsuite/g++.dg/ubsan/pr59250.C.mp3    2013-11-25 10:43:24.797315678 
+0100
+++ gcc/testsuite/g++.dg/ubsan/pr59250.C        2013-11-25 11:33:56.817539980 
+0100
@@ -0,0 +1,18 @@
+// PR sanitizer/59250
+// { dg-do compile }
+// { dg-options "-fsanitize=undefined" }
+// { dg-skip-if "" { *-*-* } { "-flto" } { "" } }
+
+struct S {
+  const char *s;
+  S (const char *);
+};
+
+struct E {
+ int i;
+};
+
+S::S (const char *) : s (0)
+{
+  new E ();
+}

        Marek

Reply via email to