OSDN Git Service

2010-05-09 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 9 May 2010 18:17:33 +0000 (18:17 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 05:04:05 +0000 (14:04 +0900)
PR middle-end/44024
* fold-const.c (tree_single_nonzero_warnv_p): Properly
handle &FUNCTION_DECL.

* gcc.dg/pr44024.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159205 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog

index 8879737..6551ac0 100644 (file)
@@ -1,3 +1,9 @@
+2010-05-09  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/44024
+       * fold-const.c (tree_single_nonzero_warnv_p): Properly
+       handle &FUNCTION_DECL.
+
 2010-05-09  Joseph Myers  <joseph@codesourcery.com>
 
        PR c/4784
index ffd9d30..17a7536 100644 (file)
@@ -14917,7 +14917,9 @@ tree_single_nonzero_warnv_p (tree t, bool *strict_overflow_p)
 
     case ADDR_EXPR:
       {
-       tree base = get_base_address (TREE_OPERAND (t, 0));
+       tree base = TREE_OPERAND (t, 0);
+       if (!DECL_P (base))
+         base = get_base_address (base);
 
        if (!base)
          return false;
@@ -14927,7 +14929,9 @@ tree_single_nonzero_warnv_p (tree t, bool *strict_overflow_p)
           allocated on the stack.  */
        if (DECL_P (base)
            && (flag_delete_null_pointer_checks
-               || (TREE_CODE (base) == VAR_DECL && !TREE_STATIC (base))))
+               || (DECL_CONTEXT (base)
+                   && TREE_CODE (DECL_CONTEXT (base)) == FUNCTION_DECL
+                   && auto_var_in_fn_p (base, DECL_CONTEXT (base)))))
          return !VAR_OR_FUNCTION_DECL_P (base) || !DECL_WEAK (base);
 
        /* Constants are never weak.  */
index cf4140d..f0a10bb 100644 (file)
@@ -1,3 +1,8 @@
+2010-05-09  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/44024
+       * gcc.dg/pr44024.c: New testcase.
+
 2010-05-09  Joseph Myers  <joseph@codesourcery.com>
 
        PR c/4784