[LLVMbugs] [Bug 854] llvm-gcc4: crash compiling constant expr cast

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Jul 31 10:33:16 PDT 2006


http://llvm.org/bugs/show_bug.cgi?id=854

sabre at nondot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
           Keywords|                            |compile-fail
         OS/Version|Linux                       |All
           Platform|PC                          |All
         Resolution|                            |FIXED
            Summary|assertion "Unknown constant |llvm-gcc4: crash compiling
                   |to convert!"' failed        |constant expr cast
   Target Milestone|---                         |1.9
            Version|trunk                       |1.4



------- Additional Comments From sabre at nondot.org  2006-07-31 12:33 -------
Fixed.  Testcase here: Regression/CFrontend/2006-07-31-PR854.c

Patch here:

Index: llvm-convert.cpp
===============================================================
====
--- llvm-convert.cpp    (revision 116626)
+++ llvm-convert.cpp    (working copy)
@@ -3852,6 +3852,7 @@ Constant *TreeConstantToLLVM::Convert(tr
   case STRING_CST:    return ConvertSTRING_CST(exp);
   case COMPLEX_CST:   return ConvertCOMPLEX_CST(exp);
   case NOP_EXPR:      return ConvertNOP_EXPR(exp);
+  case CONVERT_EXPR:  return ConvertCONVERT_EXPR(exp);
   case PLUS_EXPR:
   case MINUS_EXPR:    return ConvertBinOp_CST(exp);
   case CONSTRUCTOR:   return ConvertCONSTRUCTOR(exp);
@@ -3986,6 +3987,11 @@ Constant *TreeConstantToLLVM::ConvertNOP
   return ConstantExpr::getCast(Elt, ConvertType(TREE_TYPE(exp)));
 }
 
+Constant *TreeConstantToLLVM::ConvertCONVERT_EXPR(tree exp) {
+  Constant *Elt = Convert(TREE_OPERAND(exp, 0));
+  return ConstantExpr::getCast(Elt, ConvertType(TREE_TYPE(exp)));
+}
+
 Constant *TreeConstantToLLVM::ConvertBinOp_CST(tree exp) {
   Constant *LHS = Convert(TREE_OPERAND(exp, 0));
   Constant *RHS = Convert(TREE_OPERAND(exp, 1));
Index: llvm-internal.h
===============================================================
====
--- llvm-internal.h     (revision 116625)
+++ llvm-internal.h     (working copy)
@@ -470,6 +470,7 @@ public:
   static Constant *ConvertSTRING_CST(tree_node *exp);
   static Constant *ConvertCOMPLEX_CST(tree_node *exp);
   static Constant *ConvertNOP_EXPR(tree_node *exp);
+  static Constant *ConvertCONVERT_EXPR(tree_node *exp);
   static Constant *ConvertBinOp_CST(tree_node *exp);
   static Constant *ConvertCONSTRUCTOR(tree_node *exp);
   static Constant *ConvertArrayCONSTRUCTOR(tree_node *exp);




------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list