aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-11-17 16:49:23 -0500
committerJason Merrill <jason@gcc.gnu.org>2015-11-17 16:49:23 -0500
commit0465369f413dde52e82eb8ecebca9522703d27da (patch)
treefc4c9cb660ddc73f9d25f271c30567628d607517 /gcc/cp
parentf26a415e758433b7054154f8b4e960a2e4235065 (diff)
downloadgcc-0465369f413dde52e82eb8ecebca9522703d27da.zip
gcc-0465369f413dde52e82eb8ecebca9522703d27da.tar.gz
gcc-0465369f413dde52e82eb8ecebca9522703d27da.tar.bz2
re PR bootstrap/68346 (Bootstrap failure on i686-linux)
PR bootstrap/68346 * typeck.c (build_static_cast_1): Force a NOP when converting to the same type. From-SVN: r230508
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/typeck.c8
2 files changed, 11 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b46362d..267bd19 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2015-11-17 Jason Merrill <jason@redhat.com>
+ PR bootstrap/68346
+ * typeck.c (build_static_cast_1): Force a NOP when converting to
+ the same type.
+
* cp-tree.h (LITERAL_ZERO_P): Remove.
* parser.c (cp_parser_postfix_expression, literal_zeros)
(cp_parser_parenthesized_expression_list): Don't mess with it.
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index b7395cf..5f7d4bb 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -6668,7 +6668,13 @@ build_static_cast_1 (tree type, tree expr, bool c_cast_p,
If T is a reference type, the result is an lvalue; otherwise,
the result is an rvalue. */
if (TREE_CODE (type) != REFERENCE_TYPE)
- result = rvalue (result);
+ {
+ result = rvalue (result);
+
+ if (result == expr && SCALAR_TYPE_P (type))
+ /* Leave some record of the cast. */
+ result = build_nop (type, expr);
+ }
return result;
}