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

            Bug ID: 90377
           Summary: [10 Regression] New -Wstringop-overflow with -O3 since
                    r270852
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
  Target Milestone: ---

Isolated from webkit2gtk3 package:

$ cat webkit.ii
# 1 "" 3
typedef int a;
namespace b {
template <typename c> void d(c);
}
enum e { f };
void *operator new(a, e, void *g) { return g; }
template <typename, a, typename = int, a = 6> class h;
template <typename i> struct j {
  static void k(i *l, i *m, i *aa) {
    while (l != m) {
      new (f, aa) i;
      ++aa;
      ++l;
    }
  }
};
template <typename i> struct n {
  static void k(i *l, i *m, i *aa) { j<i>::k(l, m, aa); }
};
class C {
public:
  ac();
  unsigned o;
  unsigned ad;
};
template <typename i> class p : C {
public:
  d(p af, a, a) {
    af.ac();
    i *q = af.r(), *a = q;
    n<i>::k(0, s, a);
    b::d(o);
  }
  C::ad;
  a s;
  i *r() { return reinterpret_cast<i *>(ah); }
  int ah[];
};
class t;
template <typename, int, typename, int> class h : p<t> {
  typedef p ae;

public:
  h();
  h &operator=(h &&);
  d(h &af) { ae::d(af, ad, ad); }
};
template <typename i, a v, typename w, a u>
h<i, v, w, u> &h<i, v, w, u>::operator=(h &&af) {
  d(af);
}
class t {
public:
  t() : x(){} * x;
};
class D {
  void aj();
  h<int, 1> ak;
};
void D::aj() { ak = {}; }

$ g++ webkit.ii -O3 -Werror -Wall -std=c++14 -c  -Wstringop-overflow
-fpermissive
In member function ‘void D::aj()’:
cc1plus: error: ‘void* __builtin_memset(void*, int, long unsigned int)’ writing
8 or more bytes into a region of size 0 overflows the destination
[-Werror=stringop-overflow=]
cc1plus: all warnings being treated as errors

Reply via email to