template <class T1, typename T2, typename T3> struct A { typedef T2 (T1::*m) (T3); A (m) {} }; struct B; struct C { void foo (B *); }; typedef A <C, void, B *> D; typedef void (C::*E) (B *); struct F; typedef void (C::*G) (F); D d ((E) (G) & C::foo); ICEs with -m32: rh511229.ii: In function 'void __static_initialization_and_destruction_0(int, int)': rh511229.ii:16:22: internal compiler error: tree check: expected class 'expression', have 'constant' (ptrmem_cst) in gimplify_conversion, at gimplify.c:1831 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. The ICE started between r140129 and r140150.
r140145 in particular.
Richard, could you please have a look at this one ? Thanks in advance :-)
I believe we should do: --- gimplify.c.jj72009-07-08 11:28:03.000000000 +0200 +++ gimplify.c2009-07-17 10:40:56.000000000 +0200 @@ -1826,7 +1826,7 @@ gimplify_conversion (tree *expr_p) /* If we have a conversion to a non-register type force the use of a VIEW_CONVERT_EXPR instead. */ - if (!is_gimple_reg_type (TREE_TYPE (*expr_p))) + if (CONVERT_EXPR_P (*expr_p) && !is_gimple_reg_type (TREE_TYPE (*expr_p))) *expr_p = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (*expr_p), TREE_OPERAND (*expr_p, 0)); which fixes the testcase (see earlier ifs in gimplify_conversion which also test CONVERT_EXPR_P (*expr_p), as each step might turn the conversion into something different and blindly using TREE_OPERAND (*expr_p, 0) on something that doesn't have operands is wrong.
Yes, looks obvious. Thus, the patch is ok if it bootstraps/tests.
Subject: Bug 40780 Author: jakub Date: Fri Jul 17 10:40:09 2009 New Revision: 149740 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149740 Log: PR c++/40780 * gimplify.c (gimplify_conversion): Don't change non-conversions into VIEW_CONVERT_EXPR. * g++.dg/template/ptrmem19.C: New test. Added: trunk/gcc/testsuite/g++.dg/template/ptrmem19.C Modified: trunk/gcc/ChangeLog trunk/gcc/gimplify.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 40780 Author: jakub Date: Fri Jul 17 10:45:40 2009 New Revision: 149741 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149741 Log: PR c++/40780 * gimplify.c (gimplify_conversion): Don't change non-conversions into VIEW_CONVERT_EXPR. * g++.dg/template/ptrmem19.C: New test. Added: branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/ptrmem19.C Modified: branches/gcc-4_4-branch/gcc/ChangeLog branches/gcc-4_4-branch/gcc/gimplify.c branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
Fixed.