PR c++/46001
* decl.c (record_builtin_java_type): Call build_distinct_type_copy
on build_nonstandard_integer_type result for __java_* types.
* g++.dg/diagnostic/bitfld1.C: New test.
From-SVN: r167698
+2010-12-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/46001
+ * decl.c (record_builtin_java_type): Call build_distinct_type_copy
+ on build_nonstandard_integer_type result for __java_* types.
+
2010-12-10 Nathan Froyd <froydnj@codesourcery.com>
* decl.c (grokmethod): Test DECL_CLASS_SCOPE_P.
2010-12-10 Nathan Froyd <froydnj@codesourcery.com>
* decl.c (grokmethod): Test DECL_CLASS_SCOPE_P.
{
tree type, decl;
if (size > 0)
{
tree type, decl;
if (size > 0)
- type = build_nonstandard_integer_type (size, 0);
+ {
+ type = build_nonstandard_integer_type (size, 0);
+ type = build_distinct_type_copy (type);
+ }
else if (size > -32)
{
tree stype;
/* "__java_char" or ""__java_boolean". */
type = build_nonstandard_integer_type (-size, 1);
else if (size > -32)
{
tree stype;
/* "__java_char" or ""__java_boolean". */
type = build_nonstandard_integer_type (-size, 1);
+ type = build_distinct_type_copy (type);
/* Get the signed type cached and attached to the unsigned type,
so it doesn't get garbage-collected at "random" times,
causing potential codegen differences out of different UIDs
and different alias set numbers. */
stype = build_nonstandard_integer_type (-size, 0);
/* Get the signed type cached and attached to the unsigned type,
so it doesn't get garbage-collected at "random" times,
causing potential codegen differences out of different UIDs
and different alias set numbers. */
stype = build_nonstandard_integer_type (-size, 0);
+ stype = build_distinct_type_copy (stype);
TREE_CHAIN (type) = stype;
/*if (size == -1) TREE_SET_CODE (type, BOOLEAN_TYPE);*/
}
TREE_CHAIN (type) = stype;
/*if (size == -1) TREE_SET_CODE (type, BOOLEAN_TYPE);*/
}
+2010-12-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/46001
+ * g++.dg/diagnostic/bitfld1.C: New test.
+
2010-12-10 Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/43023
2010-12-10 Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/43023
--- /dev/null
+// PR c++/46001
+// { dg-do compile }
+
+struct S
+{
+ char *p;
+ unsigned char f : 1;
+};
+
+struct S s;
+void *a = s.p | s.f; // { dg-error "unsigned char:1" }
+
+// { dg-bogus "__java_boolean" "" { target *-*-* } 11 }