aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2007-07-06 09:24:18 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2007-07-06 09:24:18 +0000
commitb5119fa1391d75ecd9c7e041151acb04bd6c7234 (patch)
tree55c0bb411246985213c916764c6073969a4f0d07 /gcc
parent106b3d40e77897e85c6e041b88b74b8a3222417e (diff)
downloadgcc-b5119fa1391d75ecd9c7e041151acb04bd6c7234.zip
gcc-b5119fa1391d75ecd9c7e041151acb04bd6c7234.tar.gz
gcc-b5119fa1391d75ecd9c7e041151acb04bd6c7234.tar.bz2
c-common.c (boolean_increment): Use correctly typed constant.
2007-07-06 Richard Guenther <rguenther@suse.de> * c-common.c (boolean_increment): Use correctly typed constant. cp/ * init.c (build_new_1): Use the correct pointer type. * typeck2.c (build_m_component_ref): Likewise. From-SVN: r126405
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/c-common.c2
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/init.c6
-rw-r--r--gcc/cp/typeck2.c8
5 files changed, 21 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 240d5e7..6d5d1c1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2007-07-06 Richard Guenther <rguenther@suse.de>
+
+ * c-common.c (boolean_increment): Use correctly typed
+ constant.
+
2007-07-06 Richard Sandiford <richard@codesourcery.com>
* config/mips/mips.c (mips16e_save_restore_pattern_p): Check that
diff --git a/gcc/c-common.c b/gcc/c-common.c
index b1c20a6..0682a48 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -4348,7 +4348,7 @@ tree
boolean_increment (enum tree_code code, tree arg)
{
tree val;
- tree true_res = boolean_true_node;
+ tree true_res = build_int_cst (TREE_TYPE (arg), 1);
arg = stabilize_reference (arg);
switch (code)
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3aac996..f22d5b7 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2007-07-06 Richard Guenther <rguenther@suse.de>
+
+ * init.c (build_new_1): Use the correct pointer type.
+ * typeck2.c (build_m_component_ref): Likewise.
+
2007-07-05 Mark Mitchell <mark@codesourcery.com>
PR c++/32245
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 288d0fa..b65de81 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1915,6 +1915,7 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
{
tree cookie;
tree cookie_ptr;
+ tree size_ptr_type;
/* Adjust so we're pointing to the start of the object. */
data_addr = get_target_expr (build2 (POINTER_PLUS_EXPR, full_pointer_type,
@@ -1924,8 +1925,9 @@ build_new_1 (tree placement, tree type, tree nelts, tree init,
many elements to destroy later. We use the last sizeof
(size_t) bytes to store the number of elements. */
cookie_ptr = fold_build1 (NEGATE_EXPR, sizetype, size_in_bytes (sizetype));
- cookie_ptr = build2 (POINTER_PLUS_EXPR, build_pointer_type (sizetype),
- data_addr, cookie_ptr);
+ size_ptr_type = build_pointer_type (sizetype);
+ cookie_ptr = build2 (POINTER_PLUS_EXPR, size_ptr_type,
+ fold_convert (size_ptr_type, data_addr), cookie_ptr);
cookie = build_indirect_ref (cookie_ptr, NULL);
cookie_expr = build2 (MODIFY_EXPR, sizetype, cookie, nelts);
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 4ef082d..14d9963 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1261,6 +1261,8 @@ build_m_component_ref (tree datum, tree component)
if (TYPE_PTRMEM_P (ptrmem_type))
{
+ tree ptype;
+
/* Compute the type of the field, as described in [expr.ref].
There's no such thing as a mutable pointer-to-member, so
things are not as complex as they are for references to
@@ -1277,8 +1279,10 @@ build_m_component_ref (tree datum, tree component)
/* Build an expression for "object + offset" where offset is the
value stored in the pointer-to-data-member. */
- datum = build2 (POINTER_PLUS_EXPR, build_pointer_type (type),
- datum, build_nop (sizetype, component));
+ ptype = build_pointer_type (type);
+ datum = build2 (POINTER_PLUS_EXPR, ptype,
+ fold_convert (ptype, datum),
+ build_nop (sizetype, component));
return build_indirect_ref (datum, 0);
}
else