+2016-10-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/66343
+ * ubsan.c (ubsan_ids): New GTY(()) array.
+ (ubsan_type_descriptor, ubsan_create_data): Use ubsan_ids
+ instead of static local counters.
+
2016-10-05 Martin Sebor <msebor@redhat.com>
PR bootstrap/77819
+2016-10-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/66343
+ * gcc.dg/pch/pr66343-1.c: New test.
+ * gcc.dg/pch/pr66343-1.hs: New file.
+ * gcc.dg/pch/pr66343-2.c: New test.
+ * gcc.dg/pch/pr66343-2.hs: New file.
+
2016-10-05 Bernd Edlinger <bernd.edlinger@hotmail.de>
* c-c++-common/Wint-in-bool-context.c: Update test.
--- /dev/null
+/* PR sanitizer/66343 */
+/* { dg-do assemble } */
+/* { dg-options "-fsanitize=undefined" } */
+
+#include "pr66343-1.h"
+
+void
+bar (int a, int b)
+{
+ a / b;
+}
+
+/* Hack to turn off PCH assembly comparison, as it is incompatible
+ with dg-do assemble. The target condition will be always false. */
+/* { dg-error "" "" { target { lp64 && { ! lp64 } } } } */
return 0;
}
+/* Counters for internal labels. ubsan_ids[0] for Lubsan_type,
+ ubsan_ids[1] for Lubsan_data labels. */
+static GTY(()) unsigned int ubsan_ids[2];
+
/* Helper routine that returns ADDR_EXPR of a VAR_DECL of a type
descriptor. It first looks into the hash table; if not found,
create the VAR_DECL, put it into the hash table and return the
TREE_STATIC (str) = 1;
char tmp_name[32];
- static unsigned int type_var_id_num;
- ASM_GENERATE_INTERNAL_LABEL (tmp_name, "Lubsan_type", type_var_id_num++);
+ ASM_GENERATE_INTERNAL_LABEL (tmp_name, "Lubsan_type", ubsan_ids[0]++);
decl = build_decl (UNKNOWN_LOCATION, VAR_DECL, get_identifier (tmp_name),
- dtype);
+ dtype);
TREE_STATIC (decl) = 1;
TREE_PUBLIC (decl) = 0;
DECL_ARTIFICIAL (decl) = 1;
/* Now, fill in the type. */
char tmp_name[32];
- static unsigned int ubsan_var_id_num;
- ASM_GENERATE_INTERNAL_LABEL (tmp_name, "Lubsan_data", ubsan_var_id_num++);
+ ASM_GENERATE_INTERNAL_LABEL (tmp_name, "Lubsan_data", ubsan_ids[1]++);
tree var = build_decl (UNKNOWN_LOCATION, VAR_DECL, get_identifier (tmp_name),
ret);
TREE_STATIC (var) = 1;