This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/77886] -Wimplicit-fallthrough: breaks duff's device
- From: "marc.mutz at kdab dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 07 Oct 2016 21:51:36 +0000
- Subject: [Bug c/77886] -Wimplicit-fallthrough: breaks duff's device
- Auto-submitted: auto-generated
- References: <bug-77886-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77886
--- Comment #6 from Marc Mutz <marc.mutz at kdab dot com> ---
Created attachment 39770
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39770&action=edit
Test case
Result:
$ g++ -Wextra -std=c++1z -O2 bug.cpp
bug.cpp: In function ‘void qt_memfill(T*, T, int) [with T = int]’:
bug.cpp:10:20: warning: this statement may fall through
[-Wimplicit-fallthrough]
case 0: do { *dest++ = value;
^
bug.cpp:12:7: note: here
case 7: *dest++ = value;
^~~~
bug.cpp:12:20: warning: this statement may fall through
[-Wimplicit-fallthrough]
case 7: *dest++ = value;
^
bug.cpp:14:7: note: here
case 6: *dest++ = value;
^~~~
bug.cpp:14:20: warning: this statement may fall through
[-Wimplicit-fallthrough]
case 6: *dest++ = value;
^
bug.cpp:16:7: note: here
case 5: *dest++ = value;
^~~~
bug.cpp:16:20: warning: this statement may fall through
[-Wimplicit-fallthrough]
case 5: *dest++ = value;
^
bug.cpp:18:7: note: here
case 4: *dest++ = value;
^~~~
bug.cpp:18:20: warning: this statement may fall through
[-Wimplicit-fallthrough]
case 4: *dest++ = value;
^
bug.cpp:20:7: note: here
case 3: *dest++ = value;
^~~~
bug.cpp:20:20: warning: this statement may fall through
[-Wimplicit-fallthrough]
case 3: *dest++ = value;
^
bug.cpp:22:7: note: here
case 2: *dest++ = value;
^~~~
iow: only the attribute helps.