Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: For anyone who cares: gcc compile oddity





Am 25.10.2017 um 15:24 schrieb Matt Sporleder:

On Oct 25, 2017, at 3:30 AM, Robert Elz <kre%munnari.OZ.AU@localhost> wrote:

I was watching a build of netbsd-7 scroll past (it cam be amusing
watching gcc printing warnings about code in gcc...) when I saw this
one fly past.

To me this looks like it might indicate a real error, rather than
just typical gcc noise.

If anyone cares, here is the warning (the build continued happily).
(All of this is from a netbsd-7 checkout that is, I believe, up to date.)

kre


/local/netbsd/src-7/tools/gcc/../../external/gpl3/gcc/dist/gcc/config/i386/i386.c: In function 'bool ix86_rtx_costs(rtx, int, int, int, int*, bool)':
/local/netbsd/src-7/tools/gcc/../../external/gpl3/gcc/dist/gcc/config/i386/i386.c:34183:24: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
      || (!GET_CODE (x) != LABEL_REF
                        ^
/local/netbsd/src-7/tools/gcc/../../external/gpl3/gcc/dist/gcc/config/i386/i386.c:34183:24: warning: comparison of constant '45' with boolean expression is always true [-Wbool-compare]


Or Not Does Not Equal would confuse me to say the least.

Maybe the left-hand ! also covers the case where GET_CODE(x) is an error/null?
I think it is this patch from gcc.

--- trunk/gcc/config/i386/i386.c    2014/05/24 22:00:14    210901
+++ trunk/gcc/config/i386/i386.c    2014/05/26 17:33:09    210937
@@ -37903,10 +37903,10 @@
       else if (TARGET_64BIT && !x86_64_zext_immediate_operand (x, VOIDmode))
     *total = 2;
       else if (flag_pic && SYMBOLIC_CONST (x)
-           && (!TARGET_64BIT
-           || (!GET_CODE (x) != LABEL_REF
-               && (GET_CODE (x) != SYMBOL_REF
-                   || !SYMBOL_REF_LOCAL_P (x)))))
+           && !(TARGET_64BIT
+            && (GET_CODE (x) == LABEL_REF
+            || (GET_CODE (x) == SYMBOL_REF
+                && SYMBOL_REF_LOCAL_P (x)))))
     *total = 1;
       else
     *total = 0;




Home | Main Index | Thread Index | Old Index