if (!addr && POINTER_TYPE_P (TREE_TYPE (ptr)))
        {
          /* Set the maximum size if the reference is to the pointer
-            itself (as opposed to what it points to).  */
+            itself (as opposed to what it points to), and clear
+            BASE0 since the offset isn't necessarily zero-based.  */
          pref->set_max_size_range ();
+         pref->base0 = false;
          return true;
        }
 
 
--- /dev/null
+/* PR middle-end/100307 - spurious -Wplacement-new with negative pointer
+   offset
+   { dg-do compile }
+   { dg-options "-O0 -Wall" } */
+
+void* operator new (__SIZE_TYPE__, void *p) { return p; }
+void* operator new[] (__SIZE_TYPE__, void *p) { return p; }
+
+static char a[2];
+
+void* nowarn_scalar ()
+{
+  char* p = a + 1;
+  char *q = new (p - 1) char ();    // { dg-bogus "-Wplacement-new" }
+  return q;
+}
+
+
+void* nowarn_array ()
+{
+  char* p = a + 1;
+  char *q = new (p - 1) char[2];    // { dg-bogus "-Wplacement-new" }
+  return q;
+}
+
+void* warn_scalar ()
+{
+  char* p = a + 1;
+  char *q = new (p - 2) char ();    // { dg-warning "-Wplacement-new" "pr100325" { xfail *-*-* } }
+  return q;
+}
+
+
+void* warn_array ()
+{
+  char* p = a + 1;
+  char *q = new (p - 1) char[2];    // { dg-warning "-Wplacement-new" "pr100325" { xfail *-*-* } }
+  return q;
+}
 
--- /dev/null
+/* PR middle-end/100307 - spurious -Wplacement-new with negative pointer
+   offset
+   { dg-do compile }
+   { dg-options "-O0 -Wall" } */
+
+extern int sprintf (char*, const char*, ...);
+
+char a[4];
+
+void nowarn_1m1 ()
+{
+  char *p = a + 1;
+  sprintf (p - 1, "%i", 123);   // { dg-bogus "-Wformat-overflow" }
+}
+
+void nowarn_4m3 ()
+{
+  char *p = a + 4;
+  sprintf (p - 3, "%i", 12);    // { dg-bogus "-Wformat-overflow" }
+}
+
+void warn_2m1 ()
+{
+  char *p = a + 2;
+  sprintf (p - 1, "%i", 123);   // { dg-warning "-Wformat-overflow" "pr100325" { xfail *-*-* } }
+}
+
+void warn_3m1 ()
+{
+  char *p = a + 3;
+  sprintf (p - 1, "%i", 12);    // { dg-warning "-Wformat-overflow" "pr100325" { xfail *-*-* } }
+}
+
+void warn_4m1 ()
+{
+  char *p = a + 4;
+  sprintf (p - 1, "%i", 1);     // { dg-warning "-Wformat-overflow" "pr100325" { xfail *-*-* } }
+}