On Tue, May 17, 2016 at 10:58:16PM -0400, Dan Collins wrote: > Hello porters, > > While building a bleadperl under GCC 6.1, I noticed a few compiler > warnings. Not sure if they're new or not. > > In the miniperl stage, in util.c > > ccache gcc-6.1 -c -DPERL_CORE -fwrapv -DDEBUGGING -fno-strict-aliasing > -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE > -D_FILE_OFFSET_BITS=64 -g -Wall -Werror=declaration-after-statement -Wextra > -Wc++-compat -Wwrite-strings -Wno-format util.c > util.c: In function ‘Perl_my_vsnprintf’: > util.c:5299:18: warning: ‘sizeof’ on array function parameter ‘ap’ will > return size of ‘__va_list_tag *’ [-Wsizeof-array-argument] > PERL_UNUSED_ARG(ap); > ^ > util.c:5293:79: note: declared here > Perl_my_vsnprintf(char *buffer, const Size_t len, const char *format, > va_list ap) > > ^~ > This appears to be an attempt to suppress a -Wunused-parameter that is no > longer working because GCC got clever. Now silenced with v5.25.2-10-gbf49eae > In pp_ctl.c > > ccache gcc-6.1 -c -DPERL_CORE -fwrapv -DDEBUGGING -fno-strict-aliasing > -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE > -D_FILE_OFFSET_BITS=64 -g -Wall -Werror=declaration-after-statement -Wextra > -Wc++-compat -Wwrite-strings -Wno-format pp_ctl.c > pp_ctl.c: In function ‘Perl_pp_goto’: > pp_ctl.c:2782:104: warning: self-comparison always evaluates to false > [-Wtautological-compare] > EXTEND(SP, items+1); /* @_ could have been extended. */ > > ^ I think gcc is wrong here, although I don't have gcc 6 on hand to play with. I think its falling foul of this from pp.h: /* _EXTEND_SAFE_N(n): private helper macro for EXTEND(). * Tests whether the value of n would be truncated when implicitly cast to * SSize_t as an arg to stack_grow(). If so, sets it to -1 instead to * trigger a panic. It will be constant folded on platforms where this * can't happen. */ #define _EXTEND_SAFE_N(n) \ (sizeof(n) > sizeof(SSize_t) && ((SSize_t)(n) != (n)) ? -1 : (n)) In particular the (SSize_t)(n) != (n) bit, which should only be executed if sizeof(n) > sizeof(SSize_t), in which case the cast version if n is *not* necessarily the same as n, and so the test isn't tautological. > After miniperl has been built, in inflate.c inflate.c is part of cpan/Compress-Raw-Zlib, so needs reporting / fixing upstream (but in fact that file is from the zlib library, so is actually upstream of Compress-Raw-Zlib). > > ccache gcc-6.1 -c -I./zlib-src -fwrapv -DDEBUGGING -fno-strict-aliasing > -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE > -D_FILE_OFFSET_BITS=64 -Wall -Werror=declaration-after-statement -Wextra > -Wc++-compat -Wwrite-strings -Wno-format -g -DVERSION=\"2.069\" > -DXS_VERSION=\"2.069\" -fPIC "-I../.." -DNO_VIZ -DZ_SOLO > -DGZIP_OS_CODE=3 inflate.c > inflate.c: In function ‘inflateUndermine’: > inflate.c:1487:9: warning: unused parameter ‘subvert’ [-Wunused-parameter] > int subvert) > ^~~~~~~ Already reported as https://rt.cpan.org/Public/Bug/Display.html?id=107642 > inflate.c: In function ‘inflateMark’: > inflate.c:1507:51: warning: left shift of negative value > [-Wshift-negative-value] > if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16; I haven't seen that one before. -- "There's something wrong with our bloody ships today, Chatfield." -- Admiral Beatty at the Battle of Jutland, 31st May 1916.Thread Next