From 8ffab90233a07ddf64f1c52fd373e167b54d1eac Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 11 Feb 2005 22:12:48 +0100 Subject: [PATCH] re PR c++/19666 (Trouble with prt-to-members: rejects-valid/ICE in fold_convert) PR c++/19666 2004-06-08 Andrew Pinski * fold-const.c (fold_convert): Treat OFFSET_TYPE like POINTER_TYPE and INTEGER_TYPE. * gcc/testsuite/g++.dg/other/ptrmem6.C: New test. [[Split portion of a mixed commit.]] From-SVN: r94893.1 --- gcc/ChangeLog | 5 +++++ gcc/fold-const.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 730a39439daa..7339f09b8eed 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2005-02-11 Jakub Jelinek + PR c++/19666 + 2004-06-08 Andrew Pinski + * fold-const.c (fold_convert): Treat OFFSET_TYPE like + POINTER_TYPE and INTEGER_TYPE. + * config/rs6000/sysv4.h (ENDFILE_LINUX_SPEC): Use crtendS.o instead of crtend.o if -pie. Use %{x:a;:b} spec syntax. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e0889ce55cfd..b34422f15aaf 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1828,7 +1828,8 @@ fold_convert (tree type, tree arg) if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (orig)) return fold (build1 (NOP_EXPR, type, arg)); - if (INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type)) + if (INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type) + || TREE_CODE (type) == OFFSET_TYPE) { if (TREE_CODE (arg) == INTEGER_CST) { @@ -1836,7 +1837,8 @@ fold_convert (tree type, tree arg) if (tem != NULL_TREE) return tem; } - if (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig)) + if (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig) + || TREE_CODE (orig) == OFFSET_TYPE) return fold (build1 (NOP_EXPR, type, arg)); if (TREE_CODE (orig) == COMPLEX_TYPE) { -- 2.47.2