Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new instances of -Wunused-variable w/ clang-18 #1926

Closed
nickdesaulniers opened this issue Aug 31, 2023 · 3 comments
Closed

new instances of -Wunused-variable w/ clang-18 #1926

nickdesaulniers opened this issue Aug 31, 2023 · 3 comments
Labels
-Wunused-variable [BUG] llvm (main) A bug in an unreleased version of LLVM (this label is appropriate for regressions) [FIXED][LLVM] main This bug was only present and fixed in an unreleased version of LLVM [Regression] llvm This was previously working, but the toolchain has regressed.

Comments

@nickdesaulniers
Copy link
Member

nickdesaulniers commented Aug 31, 2023

@nathanchance reported that some CI jobs failed overnight with new instances of -Wunused-variable.
example: https://github.com/ClangBuiltLinux/continuous-integration2/actions/runs/6033685211/job/16371310061#step:6:101

He also tracked it down to
llvm/llvm-project@92023b1

There's discussion on
https://reviews.llvm.org/D152495
about splitting this out into it's own warning.
https://reviews.llvm.org/D152495#4628887

Here's a full trace from mainline (KCFLAGS=-fmacro-backtrace-limit=0):

In file included from arch/x86/kernel/asm-offsets.c:9:
In file included from ./include/linux/crypto.h:17:
In file included from ./include/linux/slab.h:16:
In file included from ./include/linux/gfp.h:7:
In file included from ./include/linux/mmzone.h:22:
In file included from ./include/linux/mm_types.h:11:
In file included from ./include/linux/rbtree.h:24:
./include/linux/rcupdate.h:864:2: error: unused variable '__UNIQUE_ID___addressable___SCK__preempt_schedule89' [-Werror,-Wunused-variable]
  864 |         preempt_enable();
      |         ^~~~~~~~~~~~~~~~
./include/linux/preempt.h:223:3: note: expanded from macro 'preempt_enable'
  223 |                 __preempt_schedule(); \
      |                 ^~~~~~~~~~~~~~~~~~~~
./arch/x86/include/asm/preempt.h:127:2: note: expanded from macro '__preempt_schedule'
  127 |         __STATIC_CALL_MOD_ADDRESSABLE(preempt_schedule); \
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/static_call_types.h:86:45: note: expanded from macro '__STATIC_CALL_MOD_ADDRESSABLE'
   86 | #define __STATIC_CALL_MOD_ADDRESSABLE(name) __STATIC_CALL_ADDRESSABLE(name)
      |                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/static_call_types.h:53:2: note: expanded from macro '__STATIC_CALL_ADDRESSABLE'
   53 |         __ADDRESSABLE(STATIC_CALL_KEY(name))
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/compiler.h:214:2: note: expanded from macro '__ADDRESSABLE'
  214 |         ___ADDRESSABLE(sym, __section(".discard.addressable"))
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/compiler.h:212:3: note: expanded from macro '___ADDRESSABLE'
  212 |                 __UNIQUE_ID(__PASTE(__addressable_,sym)) = (void *)&sym;
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/compiler.h:180:29: note: expanded from macro '__UNIQUE_ID'
  180 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
././include/linux/compiler_types.h:75:22: note: expanded from macro '__PASTE'
   75 | #define __PASTE(a,b) ___PASTE(a,b)
      |                      ^~~~~~~~~~~~~
././include/linux/compiler_types.h:74:23: note: expanded from macro '___PASTE'
   74 | #define ___PASTE(a,b) a##b
      |                       ^~~~
<scratch space>:115:1: note: expanded from here
  115 | __UNIQUE_ID___addressable___SCK__preempt_schedule89
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@nickdesaulniers
Copy link
Member Author

clang bug: https://reviews.llvm.org/D152495#4631829

@nickdesaulniers nickdesaulniers added [Regression] llvm This was previously working, but the toolchain has regressed. and removed [BUG] Untriaged Something isn't working labels Aug 31, 2023
nickdesaulniers added a commit to llvm/llvm-project that referenced this issue Aug 31, 2023
…lared in condition expressions""

This reverts commit 92023b1.

Further issues were uncovered:
- False positive -Wunused-variable on function-static variables with the
  used attribute. ClangBuiltLinux/linux#1926
  A test case needs to be added for this.
- Request for a new flag for these.
  https://reviews.llvm.org/D152495#4628877
  https://reviews.llvm.org/D152495#4628887
@nickdesaulniers
Copy link
Member Author

reverted: llvm/llvm-project@f0f395e

@nickdesaulniers nickdesaulniers added the [FIXED][LLVM] 18 This bug was fixed in LLVM 18 label Aug 31, 2023
@nickdesaulniers
Copy link
Member Author

Adding some tests so this doesn't regress again: https://reviews.llvm.org/D159307.

@nickdesaulniers nickdesaulniers added [BUG] llvm (main) A bug in an unreleased version of LLVM (this label is appropriate for regressions) [FIXED][LLVM] main This bug was only present and fixed in an unreleased version of LLVM and removed [FIXED][LLVM] 18 This bug was fixed in LLVM 18 labels Aug 31, 2023
nickdesaulniers added a commit to llvm/llvm-project that referenced this issue Aug 31, 2023
Ensure these don't regress the next time we reland D152495.

Link: ClangBuiltLinux/linux#1926

Reviewed By: cor3ntin, MaskRay

Differential Revision: https://reviews.llvm.org/D159307
smeenai pushed a commit to smeenai/llvm-project that referenced this issue Sep 1, 2023
Ensure these don't regress the next time we reland D152495.

Link: ClangBuiltLinux/linux#1926

Reviewed By: cor3ntin, MaskRay

Differential Revision: https://reviews.llvm.org/D159307

commit-id:21e75626
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Wunused-variable [BUG] llvm (main) A bug in an unreleased version of LLVM (this label is appropriate for regressions) [FIXED][LLVM] main This bug was only present and fixed in an unreleased version of LLVM [Regression] llvm This was previously working, but the toolchain has regressed.
Projects
None yet
Development

No branches or pull requests

1 participant