[Bug c/61271] 10 * possible coding error with logical not (!)

ubizjak at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat May 24 08:11:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61271

--- Comment #7 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to David Binderman from comment #0)

> ../../src/trunk/gcc/config/i386/i386.c:37905:10: warning: logical not is
> only applied to the left hand side of this comparison
> [-Wlogical-not-parentheses]
> 
> Source code is
> 
>            || (!GET_CODE (x) != LABEL_REF
> 
> Confusing with the double negative. Maybe
> 
>            || (GET_CODE (x) == LABEL_REF
> 
> was intended.

Actually, this is a bypass for %rip relative addresses.

--cut here--
Index: i386.c
===================================================================
--- i386.c      (revision 210889)
+++ i386.c      (working copy)
@@ -37904,7 +37904,7 @@
        *total = 2;
       else if (flag_pic && SYMBOLIC_CONST (x)
               && (!TARGET_64BIT
-                  || (!GET_CODE (x) != LABEL_REF
+                  || (GET_CODE (x) != LABEL_REF
                       && (GET_CODE (x) != SYMBOL_REF
                           || !SYMBOL_REF_LOCAL_P (x)))))
        *total = 1;
--cut here--

or in a more human-readable form:

      else if (flag_pic && SYMBOLIC_CONST (x)
           && !(TARGET_64BIT
            && (GET_CODE (x) == LABEL_REF
            || (GET_CODE (x) == SYMBOL_REF
                && SYMBOL_REF_LOCAL_P (x)))))
    *total = 1;


More information about the Gcc-bugs mailing list