[Bug middle-end/15988] [3.5 regression] ICE in fold_convert with pointer-to-member-function

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Jun 15 03:14:00 GMT 2004


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-15 03:14 -------
I think this patch should do it (but no testing except on the testcase as I do not have a bootstrappable 
compiler as bootstrap is broken on powerpc-apple-darwin right now):
Index: fold-const.c
===============================================================
====
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.395
diff -u -p -r1.395 fold-const.c
--- fold-const.c        13 Jun 2004 22:15:51 -0000      1.395
+++ fold-const.c        15 Jun 2004 03:03:54 -0000
@@ -1909,7 +1909,8 @@ fold_convert (tree type, tree arg)
       || TREE_CODE (orig) == ERROR_MARK)
     return error_mark_node;
 
-  if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (orig))
+  if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (orig)
+      || lang_hooks.types_compatible_p (type, orig))
     return fold (build1 (NOP_EXPR, type, arg));
 
   if (INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type)



I think this patch also fixes the error which comes when passing structs by value and doing IMA (if it 
worked) in C.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15988



More information about the Gcc-bugs mailing list