This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/33295] ICE in fold_const.c (fold_convert) when reordering USE statements

------- Comment #4 from ubizjak at gmail dot com  2007-09-04 19:03 -------
(In reply to comment #3)

> Uros, do you think we could, in the fold_convert() switch on TREE_CODE(type),
> add a case for RECORD_TYPE similar to VECTOR_TYPE: assert that both
> RECORD_TYPEs have the same size, and that their fields correspond one-to-one,
> and then create a VIEW_CONVERT_EXPR? Do you think it would be worth having or
> would that hurt the middle-end in any way?

This is not exactly the part of gcc I'm familiar with (and c never generates
RECORD_TYPEs), but I think that this problem should be fixed in
fortran/trans-expr.c. At least according to the comment above fold_convert(),
this conversion should be handled in front-end convert function.

The "patch" below (similar to your proposal, with minimal checking) "works" in
the sense that the compilation doesn't break, and generated code doesn't create
a black hole at runtime, but I have no idea if it is correct (fortran)
transformation. Also, we will break here if sizes are not equal.

Index: fold-const.c
--- fold-const.c        (revision 128092)
+++ fold-const.c        (working copy)
@@ -2616,6 +2616,10 @@
                  || TREE_CODE (orig) == VECTOR_TYPE);
       return fold_build1 (VIEW_CONVERT_EXPR, type, arg);

+    case RECORD_TYPE:
+      gcc_assert (tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig)));
+      return fold_build1 (VIEW_CONVERT_EXPR, type, arg);
     case VOID_TYPE:
       tem = fold_ignored_result (arg);
       if (TREE_CODE (tem) == GIMPLE_MODIFY_STMT)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]