This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]