[Bug runtime/25267] New: kernel 5.3: error: this statement may fall through [-Werror=implicit-fallthrough=]

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug runtime/25267] New: kernel 5.3: error: this statement may fall through [-Werror=implicit-fallthrough=]

glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=25267

            Bug ID: 25267
           Summary: kernel 5.3: error: this statement may fall through
                    [-Werror=implicit-fallthrough=]
           Product: systemtap
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: runtime
          Assignee: systemtap at sourceware dot org
          Reporter: craig.ringer at 2ndquadrant dot com
  Target Milestone: ---

When building on kernel 5.3.14 with stap 4.2/0.177 (git describe =
release-4.2-6-g0c5c0f434) stap modules fail to build due to a runtime configure
bug detailed in #25265 . When this is worked around locally the build then
fails due to -Werror complaints from gcc 9.2.1 :

~~~
In file included from /usr/local/share/systemtap/runtime/unwind.c:16,
                 from /usr/local/share/systemtap/runtime/linux/runtime.h:255,
                 from /usr/local/share/systemtap/runtime/runtime.h:26,
                 from /tmp/stapsiNon3/stap_767845_src.c:27:
/usr/local/share/systemtap/runtime/unwind/unwind.h: In function
‘read_ptr_sect’:
/usr/local/share/systemtap/runtime/unwind/unwind.h:146:20: error: this
statement may fall through [-Werror=implicit-fallthrough=]
  146 |   if (!compat_task || (compat_task && (tableSize == 4 || tableSize ==
0)))
      |      
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/share/systemtap/runtime/unwind/unwind.h:157:2: note: here
  157 |  case DW_EH_PE_data8:
      |  ^~~~
In file included from ./include/asm-generic/bug.h:5,
                 from ./arch/x86/include/asm/bug.h:83,
                 from ./include/linux/bug.h:5,
                 from ./include/linux/mmdebug.h:5,
                 from ./include/linux/gfp.h:5,
                 from
/usr/local/share/systemtap/runtime/linux/runtime_defines.h:20,
                 from /usr/local/share/systemtap/runtime/runtime_defines.h:8,
                 from /tmp/stapsiNon3/stap_767845_src.c:11:
./include/linux/compiler.h:328:5: error: this statement may fall through
[-Werror=implicit-fallthrough=]
  328 |  do {        \
      |     ^
./include/linux/compiler.h:338:2: note: in expansion of macro
‘__compiletime_assert’
  338 |  __compiletime_assert(condition, msg, prefix, suffix)
      |  ^~~~~~~~~~~~~~~~~~~~
./include/linux/compiler.h:350:2: note: in expansion of macro
‘_compiletime_assert’
  350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
      |  ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro
‘compiletime_assert’
   39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
      |                                     ^~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:50:2: note: in expansion of macro
‘BUILD_BUG_ON_MSG’
   50 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
      |  ^~~~~~~~~~~~~~~~
/usr/local/share/systemtap/runtime/unwind/unwind.h:158:3: note: in expansion of
macro ‘BUILD_BUG_ON’
  158 |   BUILD_BUG_ON(sizeof(u64) != sizeof(value));
      |   ^~~~~~~~~~~~
In file included from /usr/local/share/systemtap/runtime/unwind.c:16,
                 from /usr/local/share/systemtap/runtime/linux/runtime.h:255,
                 from /usr/local/share/systemtap/runtime/runtime.h:26,
                 from /tmp/stapsiNon3/stap_767845_src.c:27:
/usr/local/share/systemtap/runtime/unwind/unwind.h:163:2: note: here
  163 |  case DW_EH_PE_absptr:
      |  ^~~~
In file included from /usr/local/share/systemtap/runtime/linux/runtime.h:255,
                 from /usr/local/share/systemtap/runtime/runtime.h:26,
                 from /tmp/stapsiNon3/stap_767845_src.c:27:
/usr/local/share/systemtap/runtime/unwind.c: In function ‘processCFI’:
/usr/local/share/systemtap/runtime/unwind.c:519:8: error: this statement may
fall through [-Werror=implicit-fallthrough=]
  519 |     if (compat_task) {
      |        ^
/usr/local/share/systemtap/runtime/unwind.c:531:4: note: here
  531 |    case DW_CFA_def_cfa_offset:
      |    ^~~~
/usr/local/share/systemtap/runtime/unwind.c:543:8: error: this statement may
fall through [-Werror=implicit-fallthrough=]
  543 |     if (compat_task) {
      |        ^
/usr/local/share/systemtap/runtime/unwind.c:553:4: note: here
  553 |    case DW_CFA_def_cfa_offset_sf:
      |    ^~~~
cc1: all warnings being treated as errors
~~~

Editing the generated Makefile to remove -Werror i.e.


- EXTRA_CFLAGS += -Wno-unused $(call cc-option,-Wno-tautological-compare)
-Werror
+ EXTRA_CFLAGS += -Wno-unused $(call cc-option,-Wno-tautological-compare)


permits the trace module to compile. However, buildrun.cxx says

~~~
  // A bit of obfuscation for Gentoo's sake.
  // We *need* -Werror for stapconf to work correctly.
  // https://bugs.gentoo.org/show_bug.cgi?id=522908
  #define WERROR ("-W" "error")
~~~

... so I presume some of the runtime configure tests are relying on things like
implicit function declaration warnings, and anyway it's not desirable to just
ignore warnings.

It's unfortunate that staprun offers no way to disable -Werror or selectively
suppress some -Werror sub-categories though, as it makes stap very fragile in
the face of compiler and kernel changes.

--
You are receiving this mail because:
You are the assignee for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug runtime/25267] kernel 5.3: error: this statement may fall through [-Werror=implicit-fallthrough=]

glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=25267

Craig Ringer <craig.ringer at 2ndquadrant dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://sourceware.org/bugz
                   |                            |illa/show_bug.cgi?id=25265

--
You are receiving this mail because:
You are the assignee for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug runtime/25267] kernel 5.3: error: this statement may fall through [-Werror=implicit-fallthrough=]

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=25267

Craig Ringer <craig.ringer at 2ndquadrant dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://sourceware.org/bugz
                   |                            |illa/show_bug.cgi?id=25266

--
You are receiving this mail because:
You are the assignee for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug runtime/25267] kernel 5.3: error: this statement may fall through [-Werror=implicit-fallthrough=]

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=25267

--- Comment #1 from Craig Ringer <craig.ringer at 2ndquadrant dot com> ---
I wrote this up earlier as
https://stackoverflow.com/questions/58443706/systemtap-stap-probes-fail-with-this-statement-may-fall-through-werror-impl 

Cross linked there.

Workaround:

```
diff --git a/buildrun.cxx b/buildrun.cxx
index 505902bc5..b29eeb797 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -235,6 +235,7 @@ compile_dyninst (systemtap_session& s)
       "gcc", "--std=gnu99", s.translated_source, "-o", module,
       "-fvisibility=hidden", "-O2", "-I" + s.runtime_path, "-D__DYNINST__",
       "-Wall", WERROR, "-Wno-unused", "-Wno-strict-aliasing",
+      "-Wno-error=implicit-fallthrough", "-Wno-error=strict-prototypes",
       "-pthread", "-lrt", "-fPIC", "-shared",
     };

```

--
You are receiving this mail because:
You are the assignee for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug runtime/25267] kernel 5.3: error: this statement may fall through [-Werror=implicit-fallthrough=]

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=25267

--- Comment #2 from Craig Ringer <craig.ringer at 2ndquadrant dot com> ---
Correction, workaround is

```
commit 495ed9143004e62284f959f0a7630bdf229c6e62 (HEAD -> master)
Author: Craig Ringer <[hidden email]>
Date:   Tue Dec 10 15:24:15 2019 +0800

    Work around bug #25267 on Linux 5.3

diff --git a/buildrun.cxx b/buildrun.cxx
index 505902bc5..5f9a7208a 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -235,6 +235,7 @@ compile_dyninst (systemtap_session& s)
       "gcc", "--std=gnu99", s.translated_source, "-o", module,
       "-fvisibility=hidden", "-O2", "-I" + s.runtime_path, "-D__DYNINST__",
       "-Wall", WERROR, "-Wno-unused", "-Wno-strict-aliasing",
+      "-Wno-error=implicit-fallthrough",
       "-pthread", "-lrt", "-fPIC", "-shared",
     };

@@ -539,6 +540,7 @@ compile_pass (systemtap_session& s)

   // Assumes linux 2.6 kbuild
   o << "EXTRA_CFLAGS += -Wno-unused $(call
cc-option,-Wno-tautological-compare) " << WERROR
+    << "-Wno-error=implicit-fallthrough "
     << endl;
   #if CHECK_POINTER_ARITH_PR5947
   o << "EXTRA_CFLAGS += -Wpointer-arith" << endl;
```

--
You are receiving this mail because:
You are the assignee for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug runtime/25267] kernel 5.3: error: this statement may fall through [-Werror=implicit-fallthrough=]

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=25267

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fche at redhat dot com

--- Comment #3 from Frank Ch. Eigler <fche at redhat dot com> ---
Craig, we have handled several such diagnostics in the past by adding in
explicit /* fallthru */ type comments between the cases.  Any reason to think
that won't do here in the case of these unwind.[ch]?

--
You are receiving this mail because:
You are the assignee for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug runtime/25267] kernel 5.3: error: this statement may fall through [-Werror=implicit-fallthrough=]

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=25267

--- Comment #4 from Craig Ringer <craig.ringer at 2ndquadrant dot com> ---
Sounds fine to me. I wasn't aware that the gcc's -Wimplicit-fallthrough saw and
respected such comments.

--
You are receiving this mail because:
You are the assignee for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug runtime/25267] kernel 5.3: error: this statement may fall through [-Werror=implicit-fallthrough=]

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=25267

--- Comment #5 from Craig Ringer <craig.ringer at 2ndquadrant dot com> ---
BTW there's a simple patch on #25265 to fix the other issue reported

--
You are receiving this mail because:
You are the assignee for the bug.