[llvm-commits] [llvm-gcc-4.0] r43358 - in /llvm-gcc-4.0/trunk/gcc: c-common.c llvm-convert.cpp

Dale Johannesen dalej at apple.com
Thu Oct 25 11:47:23 PDT 2007


Author: johannes
Date: Thu Oct 25 13:47:23 2007
New Revision: 43358

URL: http://llvm.org/viewvc/llvm-project?rev=43358&view=rev
Log:
Fix a couple of warnings to enable bootstrap with --enable-checking.


Modified:
    llvm-gcc-4.0/trunk/gcc/c-common.c
    llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.0/trunk/gcc/c-common.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/c-common.c?rev=43358&r1=43357&r2=43358&view=diff

==============================================================================
--- llvm-gcc-4.0/trunk/gcc/c-common.c (original)
+++ llvm-gcc-4.0/trunk/gcc/c-common.c Thu Oct 25 13:47:23 2007
@@ -7094,9 +7094,12 @@
   if (once == 0)
     {
       size_t i;
+      /* Extract this into a variable to prevent compiler warning. */
+      unsigned limit = sizeof(db) / sizeof(db[0]) - 1;
       once = 1;
-      for (i=0; i < sizeof (db) / sizeof(db[0]) - 1; ++i)
-	gcc_assert (iasm_op_clobber_comp (&db[i+1], &db[i]) >= 0);
+      
+        for (i=0; i < limit; ++i)
+          gcc_assert (iasm_op_clobber_comp (&db[i+1], &db[i]) >= 0);
     }
 #endif
 

Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=43358&r1=43357&r2=43358&view=diff

==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Thu Oct 25 13:47:23 2007
@@ -6304,7 +6304,13 @@
     // The lvalue is just the address.
     return Convert(TREE_OPERAND(exp, 0));
   case COMPOUND_LITERAL_EXPR: // FIXME: not gimple - defined by C front-end
-    return EmitLV(COMPOUND_LITERAL_EXPR_DECL(exp));
+    /* This used to read 
+       return EmitLV(COMPOUND_LITERAL_EXPR_DECL(exp));
+       but gcc warns about that and there doesn't seem to be any way to stop it 
+       with casts or the like.  The following is equivalent with no checking
+       (since we know TREE_CODE(exp) is COMPOUND_LITERAL_EXPR the checking 
+       doesn't accomplish anything anyway). */
+    return EmitLV(DECL_EXPR_DECL (TREE_OPERAND (exp, 0)));
   }
 }
 





More information about the llvm-commits mailing list