Skip Menu |
Report information
Id: 132342
Status: resolved
Priority: 0/
Queue: perl5

Owner: jkeenan <jkeenan [at] cpan.org>
Requestors: jkeenan [at] pobox.com
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: low
Type: unknown
Perl Version: (no value)
Fixed In: (no value)



To: perlbug [...] perl.org
Subject: stadtx_hash.h: Silence -Wimplicit-fallthrough compilation warnings
From: James E Keenan <jkeenan [...] pobox.com>
Date: Sat, 21 Oct 2017 22:25:06 -0400
Download (untitled) / with headers
text/plain 1.2k
When building perl with gcc-7.2, many new compiler warnings are thrown. During and after the 2017 Perl 5 Core Hackathon, Lukas Mai and Yves Orton committed code to silence most of these warnings. Today I built with gcc-7.2 on Ubuntu Linux 16.04 LTS for the first time. The warnings I got are displayed in this smoke test report: http://perl5.test-smoke.org/report/58805 Those warnings come from these files: ##### stadtx_hash.h op.c cpan/Compress-Raw-Bzip2/bzip2-src/decompress.c cpan/Compress-Raw-Zlib/zlib-src/infback.c cpan/Compress-Raw-Zlib/zlib-src/inflate.c cpan/Encode/Unicode/Unicode.xs cpan/Scalar-List-Utils/ListUtil.xs ##### The patch attached silences the 'warning: this statement may fall through [-Wimplicit-fallthrough=]' warnings in stadtx_hash.h. Those warnings appear in most of the other files, but those are maintained upstream (for which I will later supply patches). The following warning remains during a gcc-7.2 build: ##### op.c: In function ‘S_fold_constants’: op.c:4448:34: warning: argument ‘o’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered] S_fold_constants(pTHX_ OP *const o) ^ ##### I don't yet know how to address that one. Please review the patch. Thank you very much. Jim Keenan

Message body is not shown because sender requested not to inline it.

Download perl_V.gcc-7.2.txt
text/plain 3.1k

Message body is not shown because sender requested not to inline it.

RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.5k
On Sun, 22 Oct 2017 02:25:29 GMT, jkeenan@pobox.com wrote: Show quoted text
> When building perl with gcc-7.2, many new compiler warnings are thrown. > During and after the 2017 Perl 5 Core Hackathon, Lukas Mai and Yves > Orton committed code to silence most of these warnings. Today I built > with gcc-7.2 on Ubuntu Linux 16.04 LTS for the first time. The warnings > I got are displayed in this smoke test report: > > http://perl5.test-smoke.org/report/58805 > > Those warnings come from these files: > > ##### > stadtx_hash.h > op.c > cpan/Compress-Raw-Bzip2/bzip2-src/decompress.c > cpan/Compress-Raw-Zlib/zlib-src/infback.c > cpan/Compress-Raw-Zlib/zlib-src/inflate.c > cpan/Encode/Unicode/Unicode.xs > cpan/Scalar-List-Utils/ListUtil.xs > ##### > > The patch attached silences the 'warning: this statement may fall > through [-Wimplicit-fallthrough=]' warnings in stadtx_hash.h. Those > warnings appear in most of the other files, but those are maintained > upstream (for which I will later supply patches). > > The following warning remains during a gcc-7.2 build: > > ##### > op.c: In function ‘S_fold_constants’: > op.c:4448:34: warning: argument ‘o’ might be clobbered by ‘longjmp’ or > ‘vfork’ [-Wclobbered] > S_fold_constants(pTHX_ OP *const o) > ^ > ##### > > I don't yet know how to address that one. > > Please review the patch. > > Thank you very much. > Jim Keenan >
Code review by mauke++ on #p5p indicated that some of my FALLTHROUGH guards were superfluous. Providing supplementary patch. Please review. Thank you very much.
Subject: 0002-Remove-superfluous-FALLTHROUGH-guards.patch
From 4fd1c57d681355f0e0bb51ead65c9552fbaf325a Mon Sep 17 00:00:00 2001 From: James E Keenan <jkeenan@cpan.org> Date: Sun, 22 Oct 2017 07:48:43 -0400 Subject: [PATCH 2/2] Remove superfluous FALLTHROUGH guards. Per code review by mauke++ on #p5p. --- stadtx_hash.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/stadtx_hash.h b/stadtx_hash.h index 3b5dfb6..c755018 100644 --- a/stadtx_hash.h +++ b/stadtx_hash.h @@ -223,12 +223,10 @@ STADTX_STATIC_INLINE U64 stadtx_hash_with_state( /* FALLTHROUGH */ case 4: v1 += (U64)U8TO32_LE(key); break; - /* FALLTHROUGH */ case 3: v0 += (U64)key[2] << 48; /* FALLTHROUGH */ case 2: v1 += (U64)U8TO16_LE(key); break; - /* FALLTHROUGH */ case 1: v0 += (U64)key[0]; /* FALLTHROUGH */ case 0: v1 = ROTL64(v1, 32) ^ 0xFF; @@ -278,22 +276,18 @@ STADTX_STATIC_INLINE U64 stadtx_hash_with_state( case 6: v2 += (U64)U8TO16_LE(key+4); v3 += (U64)U8TO32_LE(key); break; - /* FALLTHROUGH */ case 5: v1 += (U64)key[4]; /* FALLTHROUGH */ case 4: v2 += (U64)U8TO32_LE(key); break; - /* FALLTHROUGH */ case 3: v3 += (U64)key[2]; /* FALLTHROUGH */ case 2: v1 += (U64)U8TO16_LE(key); break; - /* FALLTHROUGH */ case 1: v2 += (U64)key[0]; /* FALLTHROUGH */ case 0: v3 = ROTL64(v3, 32) ^ 0xFF; break; - /* FALLTHROUGH */ } v1 -= v2; -- 2.7.4
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 2.7k
On Sun, 22 Oct 2017 12:08:01 GMT, jkeenan wrote: Show quoted text
> On Sun, 22 Oct 2017 02:25:29 GMT, jkeenan@pobox.com wrote:
> > When building perl with gcc-7.2, many new compiler warnings are > > thrown. > > During and after the 2017 Perl 5 Core Hackathon, Lukas Mai and Yves > > Orton committed code to silence most of these warnings. Today I > > built > > with gcc-7.2 on Ubuntu Linux 16.04 LTS for the first time. The > > warnings > > I got are displayed in this smoke test report: > > > > http://perl5.test-smoke.org/report/58805 > > > > Those warnings come from these files: > > > > ##### > > stadtx_hash.h > > op.c > > cpan/Compress-Raw-Bzip2/bzip2-src/decompress.c > > cpan/Compress-Raw-Zlib/zlib-src/infback.c > > cpan/Compress-Raw-Zlib/zlib-src/inflate.c > > cpan/Encode/Unicode/Unicode.xs > > cpan/Scalar-List-Utils/ListUtil.xs > > ##### > > > > The patch attached silences the 'warning: this statement may fall > > through [-Wimplicit-fallthrough=]' warnings in stadtx_hash.h. Those > > warnings appear in most of the other files, but those are maintained > > upstream (for which I will later supply patches). > > > > The following warning remains during a gcc-7.2 build: > > > > ##### > > op.c: In function ‘S_fold_constants’: > > op.c:4448:34: warning: argument ‘o’ might be clobbered by ‘longjmp’ > > or > > ‘vfork’ [-Wclobbered] > > S_fold_constants(pTHX_ OP *const o) > > ^ > > ##### > > > > I don't yet know how to address that one. > > > > Please review the patch. > > > > Thank you very much. > > Jim Keenan > >
> > Code review by mauke++ on #p5p indicated that some of my FALLTHROUGH > guards were superfluous. Providing supplementary patch. Please > review. > > Thank you very much.
Patches were applied to blead in commit b2733f8fd5234aa49bd611d261687384342103e7 and 6437ba61910f3853c77f9237646973ac2b6d12fa. Most of the implicit-fallthrough warnings are gone. However, when I subsequently built with gcc-7 on a *threaded build*, there were still some of those warnings: ##### $ grep -nE '^op\.c' make.6.gcc-7.output.txt 3:op.c: In function ‘S_finalize_op’: 4:op.c:2586:5: warning: this statement may fall through [-Wimplicit-fallthrough=] 7:op.c:2590:5: note: here 10:op.c: In function ‘S_fold_constants’: 11:op.c:4448:34: warning: argument ‘o’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered] 456:op.c: In function ‘S_finalize_op’: 457:op.c:2586:5: warning: this statement may fall through [-Wimplicit-fallthrough=] 460:op.c:2590:5: note: here 463:op.c: In function ‘S_fold_constants’: 464:op.c:4448:34: warning: argument ‘o’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered] ##### Needs further investigation. Thank you very much. -- James E Keenan (jkeenan@cpan.org)
RT-Send-CC: perl5-porters [...] perl.org
On Sun, 22 Oct 2017 06:32:38 -0700, jkeenan wrote: Show quoted text
> > Most of the implicit-fallthrough warnings are gone. However, when I > subsequently built with gcc-7 on a *threaded build*, there were still > some of those warnings: > > ##### > $ grep -nE '^op\.c' make.6.gcc-7.output.txt > 3:op.c: In function ‘S_finalize_op’: > 4:op.c:2586:5: warning: this statement may fall through [-Wimplicit- > fallthrough=] > 7:op.c:2590:5: note: here > 10:op.c: In function ‘S_fold_constants’: > 11:op.c:4448:34: warning: argument ‘o’ might be clobbered by ‘longjmp’ > or ‘vfork’ [-Wclobbered] > 456:op.c: In function ‘S_finalize_op’: > 457:op.c:2586:5: warning: this statement may fall through [-Wimplicit- > fallthrough=] > 460:op.c:2590:5: note: here > 463:op.c: In function ‘S_fold_constants’: > 464:op.c:4448:34: warning: argument ‘o’ might be clobbered by > ‘longjmp’ or ‘vfork’ [-Wclobbered] > ##### > > Needs further investigation.
I believe the fallthrough warning is fixed in commit 146930d15520053173c2db1a398e390877382e52.
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 2.1k
On Sun, 22 Oct 2017 14:21:58 GMT, mauke- wrote: Show quoted text
> On Sun, 22 Oct 2017 06:32:38 -0700, jkeenan wrote:
> > > > Most of the implicit-fallthrough warnings are gone. However, when I > > subsequently built with gcc-7 on a *threaded build*, there were still > > some of those warnings: > > > > ##### > > $ grep -nE '^op\.c' make.6.gcc-7.output.txt > > 3:op.c: In function ‘S_finalize_op’: > > 4:op.c:2586:5: warning: this statement may fall through [-Wimplicit- > > fallthrough=] > > 7:op.c:2590:5: note: here > > 10:op.c: In function ‘S_fold_constants’: > > 11:op.c:4448:34: warning: argument ‘o’ might be clobbered by > > ‘longjmp’ > > or ‘vfork’ [-Wclobbered] > > 456:op.c: In function ‘S_finalize_op’: > > 457:op.c:2586:5: warning: this statement may fall through [- > > Wimplicit- > > fallthrough=] > > 460:op.c:2590:5: note: here > > 463:op.c: In function ‘S_fold_constants’: > > 464:op.c:4448:34: warning: argument ‘o’ might be clobbered by > > ‘longjmp’ or ‘vfork’ [-Wclobbered] > > ##### > > > > Needs further investigation.
> > I believe the fallthrough warning is fixed in commit > 146930d15520053173c2db1a398e390877382e52.
Yes -- but unfortunately I just spotted this: ##### gcc-7 -c -DPERL_CORE -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c89 -O2 -Wall -Werror=declaration-after-statement -Werror=pointer-arith -Wextra -Wc++-compat -Wwrite-strings sv.c In file included from perl.h:3473:0, from sv.c:32: sv.c: In function ‘S_sv_dup_common’: sv.h:2155:6: warning: this statement may fall through [-Wimplicit-fallthrough=] (SvTYPE(sv) == SVt_REGEXP \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ || (SvFLAGS(sv) & (SVTYPEMASK|SVpgv_GP|SVf_FAKE)) \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ == (SVt_PVLV|SVf_FAKE)) ~~~~~~~~~~~~~~~~~~~~~~~ sv.c:14296:7: note: in expansion of macro ‘isREGEXP’ if (isREGEXP(sstr)) goto duprex; ^~~~~~~~ sv.c:14297:6: note: here case SVt_PVGV: ^~~~ ##### -- James E Keenan (jkeenan@cpan.org)
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 2.8k
On Sun, 22 Oct 2017 14:57:00 GMT, jkeenan wrote: Show quoted text
> On Sun, 22 Oct 2017 14:21:58 GMT, mauke- wrote:
> > On Sun, 22 Oct 2017 06:32:38 -0700, jkeenan wrote:
> > > > > > Most of the implicit-fallthrough warnings are gone. However, when > > > I > > > subsequently built with gcc-7 on a *threaded build*, there were > > > still > > > some of those warnings: > > > > > > ##### > > > $ grep -nE '^op\.c' make.6.gcc-7.output.txt > > > 3:op.c: In function ‘S_finalize_op’: > > > 4:op.c:2586:5: warning: this statement may fall through [- > > > Wimplicit- > > > fallthrough=] > > > 7:op.c:2590:5: note: here > > > 10:op.c: In function ‘S_fold_constants’: > > > 11:op.c:4448:34: warning: argument ‘o’ might be clobbered by > > > ‘longjmp’ > > > or ‘vfork’ [-Wclobbered] > > > 456:op.c: In function ‘S_finalize_op’: > > > 457:op.c:2586:5: warning: this statement may fall through [- > > > Wimplicit- > > > fallthrough=] > > > 460:op.c:2590:5: note: here > > > 463:op.c: In function ‘S_fold_constants’: > > > 464:op.c:4448:34: warning: argument ‘o’ might be clobbered by > > > ‘longjmp’ or ‘vfork’ [-Wclobbered] > > > ##### > > > > > > Needs further investigation.
> > > > I believe the fallthrough warning is fixed in commit > > 146930d15520053173c2db1a398e390877382e52.
> > Yes -- but unfortunately I just spotted this: > > ##### > gcc-7 -c -DPERL_CORE -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict- > aliasing -pipe -fstack-protector-strong -I/usr/local/include > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c89 -O2 -Wall > -Werror=declaration-after-statement -Werror=pointer-arith -Wextra > -Wc++-compat -Wwrite-strings sv.c > In file included from perl.h:3473:0, > from sv.c:32: > sv.c: In function ‘S_sv_dup_common’: > sv.h:2155:6: warning: this statement may fall through [-Wimplicit- > fallthrough=] > (SvTYPE(sv) == SVt_REGEXP \ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > || (SvFLAGS(sv) & (SVTYPEMASK|SVpgv_GP|SVf_FAKE)) \ > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > == (SVt_PVLV|SVf_FAKE)) > ~~~~~~~~~~~~~~~~~~~~~~~ > sv.c:14296:7: note: in expansion of macro ‘isREGEXP’ > if (isREGEXP(sstr)) goto duprex; > ^~~~~~~~ > sv.c:14297:6: note: here > case SVt_PVGV: > ^~~~ > #####
And mauke++ has taken care of this one as well: ##### commit d1589979b3edf55f4440d041d4566c478a3860f6 Author: Lukas Mai <l.mai@web.de> Date: Sun Oct 22 17:03:55 2017 +0200 get rid of "implicit fallthrough" warnings with gcc 7 ##### I think we've now eliminated this warning from non-threaded and threaded builds on Linux with gcc-7 -- at least from those files that are p5p-maintained. I will prepare patches for files that are cpan-upstream, but we don't need to keep this ticket open for that. Marking ticket Resolved. Thank you very much. -- James E Keenan (jkeenan@cpan.org)


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org