This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/61271] 10 * possible coding error with logical not (!)
- From: "ubizjak at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 24 May 2014 08:11:00 +0000
- Subject: [Bug c/61271] 10 * possible coding error with logical not (!)
- Auto-submitted: auto-generated
- References: <bug-61271-4 at http dot gcc dot gnu dot org/bugzilla/>
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;