Skip to content

[Clang-21-git] New Wdefault-const-init-var-unsafe warnings with Kernel 6.14.4 #2088

Closed
@ms178

Description

@ms178

Using clang version 21.0.0git (https://github.com/llvm/llvm-project.git 3015edf96e4faad0d367d0879269c1c905a4eec7), I see a lot of these new warnings when compiling Kernel 6.14.4. Is this a known issue?

In file included from drivers/target/target_core_tpg.c:21:
In file included from ./include/net/tcp.h:32:
In file included from ./include/net/inet_hashtables.h:26:
./include/net/ip.h:484:14: warning: default initialization of an object of type 'typeof (rt->dst.expires)' (aka 'const unsigned long') leaves the object uninitialized and is incompatible with C++ [-Wdefault-const-init-var-unsafe]
  484 |                 if (mtu && time_before(jiffies, rt->dst.expires))
      |                            ^
./include/linux/jiffies.h:138:26: note: expanded from macro 'time_before'
  138 | #define time_before(a,b)        time_after(b,a)
      |                                 ^
./include/linux/jiffies.h:128:3: note: expanded from macro 'time_after'
  128 |         (typecheck(unsigned long, a) && \
      |          ^
./include/linux/typecheck.h:11:12: note: expanded from macro 'typecheck'
   11 |         typeof(x) __dummy2; \
      |                   ^
In file included from drivers/target/target_core_tpg.c:21:
In file included from ./include/net/tcp.h:44:
In file included from ./include/net/xfrm.h:26:
./include/net/ip6_fib.h:271:10: warning: default initialization of an object of type 'typeof (f6i->expires)' (aka 'const unsigned long') leaves the object uninitialized and is incompatible with C++ [-Wdefault-const-init-var-unsafe]
  271 |                 return time_after(jiffies, f6i->expires);
      |                        ^
./include/linux/jiffies.h:129:3: note: expanded from macro 'time_after'
  129 |          typecheck(unsigned long, b) && \
      |          ^
./include/linux/typecheck.h:11:12: note: expanded from macro 'typecheck'
   11 |         typeof(x) __dummy2; \
      |                   ^
In file included from drivers/target/target_core_transport.c:27:
In file included from ./include/net/tcp.h:32:
In file included from ./include/net/inet_hashtables.h:26:
./include/net/ip.h:484:14: warning: default initialization of an object of type 'typeof (rt->dst.expires)' (aka 'const unsigned long') leaves the object uninitialized and is incompatible with C++ [-Wdefault-const-init-var-unsafe]
  484 |                 if (mtu && time_before(jiffies, rt->dst.expires))
      |                            ^
./include/linux/jiffies.h:138:26: note: expanded from macro 'time_before'
  138 | #define time_before(a,b)        time_after(b,a)
      |                                 ^
./include/linux/jiffies.h:128:3: note: expanded from macro 'time_after'
  128 |         (typecheck(unsigned long, a) && \
      |          ^
./include/linux/typecheck.h:11:12: note: expanded from macro 'typecheck'
   11 |         typeof(x) __dummy2; \
      |                   ^
In file included from drivers/target/target_core_transport.c:27:
In file included from ./include/net/tcp.h:44:
In file included from ./include/net/xfrm.h:26:
./include/net/ip6_fib.h:271:10: warning: default initialization of an object of type 'typeof (f6i->expires)' (aka 'const unsigned long') leaves the object uninitialized and is incompatible with C++ [-Wdefault-const-init-var-unsafe]
  271 |                 return time_after(jiffies, f6i->expires);
      |                        ^
./include/linux/jiffies.h:129:3: note: expanded from macro 'time_after'
  129 |          typecheck(unsigned long, b) && \
      |          ^
./include/linux/typecheck.h:11:12: note: expanded from macro 'typecheck'
   11 |         typeof(x) __dummy2; \
      |                   ^
2 warnings generated.
2 warnings generated.
In file included from drivers/target/iscsi/iscsi_target_login.c:17:
./include/net/ip.h:484:14: warning: default initialization of an object of type 'typeof (rt->dst.expires)' (aka 'const unsigned long') leaves the object uninitialized and is incompatible with C++ [-Wdefault-const-init-var-unsafe]
  484 |                 if (mtu && time_before(jiffies, rt->dst.expires))
      |                            ^
./include/linux/jiffies.h:138:26: note: expanded from macro 'time_before'
  138 | #define time_before(a,b)        time_after(b,a)
      |                                 ^
./include/linux/jiffies.h:128:3: note: expanded from macro 'time_after'
  128 |         (typecheck(unsigned long, a) && \
      |          ^
./include/linux/typecheck.h:11:12: note: expanded from macro 'typecheck'
   11 |         typeof(x) __dummy2; \
      |                   ^
1 warning generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions