+2009-07-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/40502
+ * error.c (cp_print_error_function): Check for NULL block.
+
2008-07-09 Simon Martin <simartin@users.sourceforge.net>
- Jason Merrill <jason@redhat.com>
+ Jason Merrill <jason@redhat.com>
* pt.c (perform_typedefs_access_check, get_types_needing_access_check,
append_type_to_template_for_access_check_1): Use CLASS_TYPE_P.
while (block && TREE_CODE (block) == BLOCK)
block = BLOCK_SUPERCONTEXT (block);
- if (TREE_CODE (block) == FUNCTION_DECL)
+ if (block && TREE_CODE (block) == FUNCTION_DECL)
fndecl = block;
abstract_origin = NULL;
}
+2009-07-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/40502
+ * g++.dg/ext/strncpy-chk1.C: New test.
+
2009-07-10 Richard Guenther <rguenther@suse.de>
PR tree-optimization/40496
--- /dev/null
+// PR c++/40502
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct A { char x[12], y[35]; };
+struct B { char z[50]; };
+
+inline void
+foo (char *dest, const char *__restrict src, __SIZE_TYPE__ n)
+{
+ __builtin___strncpy_chk (dest, src, n, __builtin_object_size (dest, 0)); // { dg-warning "will always overflow" }
+}
+
+void bar (const char *, int);
+
+inline void
+baz (int i)
+{
+ char s[128], t[32];
+ bar (s, 0);
+ bar (t, i);
+ A a;
+ B b;
+ foo (a.y, b.z, 36);
+}
+
+void
+test ()
+{
+ baz (0);
+}