------- Comment #2 from pinskia at gcc dot gnu dot org  2006-04-24 00:38 -------
Here is the fix:
Index: c-typeck.c
===================================================================
--- c-typeck.c  (revision 113199)
+++ c-typeck.c  (working copy)
@@ -7978,7 +7978,8 @@ build_binary_op (enum tree_code code, tr
        {
          if (TREE_CODE (op0) == ADDR_EXPR
              && DECL_P (TREE_OPERAND (op0, 0)) 
-             && !DECL_WEAK (TREE_OPERAND (op0, 0)))
+             && (TREE_CODE (TREE_OPERAND(op0, 0)) == PARM_DECL
+                 || !DECL_WEAK (TREE_OPERAND (op0, 0))))
            warning (OPT_Walways_true, "the address of %qD will never be NULL",
                     TREE_OPERAND (op0, 0));
          result_type = type0;
@@ -7987,7 +7988,8 @@ build_binary_op (enum tree_code code, tr
        {
          if (TREE_CODE (op1) == ADDR_EXPR 
              && DECL_P (TREE_OPERAND (op1, 0))
-             && !DECL_WEAK (TREE_OPERAND (op1, 0)))
+             && (TREE_CODE (TREE_OPERAND(op1, 0)) == PARM_DECL
+                 || !DECL_WEAK (TREE_OPERAND (op1, 0))))
            warning (OPT_Walways_true, "the address of %qD will never be NULL",
                     TREE_OPERAND (op1, 0));
          result_type = type1;


-- 


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

Reply via email to