This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/77886] -Wimplicit-fallthrough: breaks duff's device


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]