diff options
author | Richard Guenther <rguenther@suse.de> | 2008-01-25 21:20:00 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-01-25 21:20:00 +0000 |
commit | 291de7fcab844bdf60b88c4a7da34d21ad1d99a1 (patch) | |
tree | 6c9c32c8b536350e4f75a616d13be07a3bd41e61 /gcc/cp | |
parent | 0288980fc42c88cc56587b68d51e00b8c1f77fda (diff) | |
download | gcc-291de7fcab844bdf60b88c4a7da34d21ad1d99a1.zip gcc-291de7fcab844bdf60b88c4a7da34d21ad1d99a1.tar.gz gcc-291de7fcab844bdf60b88c4a7da34d21ad1d99a1.tar.bz2 |
re PR c++/33887 (Reference to bitfield gets wrong value when optimizing)
2008-01-25 Richard Guenther <rguenther@suse.de>
PR c++/33887
* decl.c (record_builtin_java_type): Make __java_boolean
a variant of bool.
* typeck.c (structural_comptypes): Move TYPE_FOR_JAVA check
after TYPE_MAIN_VARIANT check.
From-SVN: r131840
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/decl.c | 7 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 5 |
3 files changed, 16 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 22afe19..e8d8adf 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2008-01-25 Richard Guenther <rguenther@suse.de> + + PR c++/33887 + * decl.c (record_builtin_java_type): Make __java_boolean + a variant of bool. + * typeck.c (structural_comptypes): Move TYPE_FOR_JAVA check + after TYPE_MAIN_VARIANT check. + 2008-01-25 Jason Merrill <jason@redhat.com> * decl2.c (is_late_template_attribute): Don't defer attribute diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 4640adf..8fa0825 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3159,10 +3159,13 @@ record_builtin_java_type (const char* name, int size) tree type, decl; if (size > 0) type = make_signed_type (size); + else if (size == -1) + { /* "__java_boolean". */ + type = build_variant_type_copy (boolean_type_node); + } else if (size > -32) - { /* "__java_char" or ""__java_boolean". */ + { /* "__java_char". */ type = make_unsigned_type (-size); - /*if (size == -1) TREE_SET_CODE (type, BOOLEAN_TYPE);*/ } else { /* "__java_float" or ""__java_double". */ diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 6557637..d75f4e4 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -962,8 +962,6 @@ structural_comptypes (tree t1, tree t2, int strict) if (TREE_CODE (t1) != ARRAY_TYPE && TYPE_QUALS (t1) != TYPE_QUALS (t2)) return false; - if (TYPE_FOR_JAVA (t1) != TYPE_FOR_JAVA (t2)) - return false; /* Allow for two different type nodes which have essentially the same definition. Note that we already checked for equality of the type @@ -973,6 +971,9 @@ structural_comptypes (tree t1, tree t2, int strict) && TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2)) return true; + if (TYPE_FOR_JAVA (t1) != TYPE_FOR_JAVA (t2)) + return false; + /* Compare the types. Break out if they could be the same. */ switch (TREE_CODE (t1)) { |