Re: [linux-next:master 5136/13299] include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of '__u8[0]' {aka 'unsigned char[]'}

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 18, 2023 at 1:01 PM kernel test robot <lkp@xxxxxxxxx> wrote:
>
> Hi Eric,
>
> FYI, the error/warning still remains.
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   2dac75696c6da3c848daa118a729827541c89d33
> commit: fa17a6d8a5bd0cd7565b613cb804242cd0f6b7ab [5136/13299] ipv6: lockless IPV6_ADDR_PREFERENCES implementation
> config: alpha-defconfig (https://download.01.org/0day-ci/archive/20231018/202310181854.pKtHd7fD-lkp@xxxxxxxxx/config)
> compiler: alpha-linux-gcc (GCC) 13.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231018/202310181854.pKtHd7fD-lkp@xxxxxxxxx/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202310181854.pKtHd7fD-lkp@xxxxxxxxx/
>

I have no idea why this compiler is not happy.

I would probably contact a compiler maintainer perhaps ?


> All warnings (new ones prefixed by >>):
>
>    In file included from arch/alpha/include/asm/rwonce.h:33,
>                     from include/linux/compiler.h:246,
>                     from include/linux/string.h:5,
>                     from net/sunrpc/xprtsock.c:23:
>    In function 'ip6_sock_set_addr_preferences',
>        inlined from 'xs_tcp_finish_connecting' at net/sunrpc/xprtsock.c:2325:4,
>        inlined from 'xs_tcp_setup_socket' at net/sunrpc/xprtsock.c:2405:11:
> >> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of '__u8[0]' {aka 'unsigned char[]'} [-Warray-bounds=]
>       44 | #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
>          |                         ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/asm-generic/rwonce.h:55:40: note: in definition of macro '__WRITE_ONCE'
>       55 |         *(volatile typeof(x) *)&(x) = (val);                            \
>          |                                        ^~~
>    include/net/ipv6.h:1365:9: note: in expansion of macro 'WRITE_ONCE'
>     1365 |         WRITE_ONCE(inet6_sk(sk)->srcprefs,
>          |         ^~~~~~~~~~
>    include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
>       50 |         __READ_ONCE(x);                                                 \
>          |         ^~~~~~~~~~~
>    include/net/ipv6.h:1366:21: note: in expansion of macro 'READ_ONCE'
>     1366 |                    (READ_ONCE(inet6_sk(sk)->srcprefs) & prefmask) | pref);
>          |                     ^~~~~~~~~
>    In function 'xs_tcp_setup_socket':
>    cc1: note: source object is likely at address zero
>    In function 'ip6_sock_set_addr_preferences',
>        inlined from 'xs_tcp_finish_connecting' at net/sunrpc/xprtsock.c:2325:4,
>        inlined from 'xs_tcp_setup_socket' at net/sunrpc/xprtsock.c:2405:11:
>    include/asm-generic/rwonce.h:55:37: warning: array subscript 0 is outside array bounds of '__u8[0]' {aka 'unsigned char[]'} [-Warray-bounds=]
>       55 |         *(volatile typeof(x) *)&(x) = (val);                            \
>          |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
>    include/asm-generic/rwonce.h:61:9: note: in expansion of macro '__WRITE_ONCE'
>       61 |         __WRITE_ONCE(x, val);                                           \
>          |         ^~~~~~~~~~~~
>    include/net/ipv6.h:1365:9: note: in expansion of macro 'WRITE_ONCE'
>     1365 |         WRITE_ONCE(inet6_sk(sk)->srcprefs,
>          |         ^~~~~~~~~~
>    In function 'xs_tcp_setup_socket':
>    cc1: note: source object is likely at address zero
>    In function 'ip6_sock_set_addr_preferences',
>        inlined from 'xs_tcp_tls_finish_connecting' at net/sunrpc/xprtsock.c:2478:4:
> >> include/asm-generic/rwonce.h:44:26: warning: array subscript 0 is outside array bounds of '__u8[0]' {aka 'unsigned char[]'} [-Warray-bounds=]
>       44 | #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
>          |                         ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/asm-generic/rwonce.h:55:40: note: in definition of macro '__WRITE_ONCE'
>       55 |         *(volatile typeof(x) *)&(x) = (val);                            \
>          |                                        ^~~
>    include/net/ipv6.h:1365:9: note: in expansion of macro 'WRITE_ONCE'
>     1365 |         WRITE_ONCE(inet6_sk(sk)->srcprefs,
>          |         ^~~~~~~~~~
>    include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
>       50 |         __READ_ONCE(x);                                                 \
>          |         ^~~~~~~~~~~
>    include/net/ipv6.h:1366:21: note: in expansion of macro 'READ_ONCE'
>     1366 |                    (READ_ONCE(inet6_sk(sk)->srcprefs) & prefmask) | pref);
>          |                     ^~~~~~~~~
>    In function 'xs_tcp_tls_finish_connecting':
>    cc1: note: source object is likely at address zero
>    In function 'ip6_sock_set_addr_preferences',
>        inlined from 'xs_tcp_tls_finish_connecting' at net/sunrpc/xprtsock.c:2478:4:
>    include/asm-generic/rwonce.h:55:37: warning: array subscript 0 is outside array bounds of '__u8[0]' {aka 'unsigned char[]'} [-Warray-bounds=]
>       55 |         *(volatile typeof(x) *)&(x) = (val);                            \
>          |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
>    include/asm-generic/rwonce.h:61:9: note: in expansion of macro '__WRITE_ONCE'
>       61 |         __WRITE_ONCE(x, val);                                           \
>          |         ^~~~~~~~~~~~
>    include/net/ipv6.h:1365:9: note: in expansion of macro 'WRITE_ONCE'
>     1365 |         WRITE_ONCE(inet6_sk(sk)->srcprefs,
>          |         ^~~~~~~~~~
>    In function 'xs_tcp_tls_finish_connecting':
>    cc1: note: source object is likely at address zero
>
>
> vim +44 include/asm-generic/rwonce.h
>
> e506ea451254ab Will Deacon 2019-10-15  28
> e506ea451254ab Will Deacon 2019-10-15  29  /*
> e506ea451254ab Will Deacon 2019-10-15  30   * Yes, this permits 64-bit accesses on 32-bit architectures. These will
> e506ea451254ab Will Deacon 2019-10-15  31   * actually be atomic in some cases (namely Armv7 + LPAE), but for others we
> e506ea451254ab Will Deacon 2019-10-15  32   * rely on the access being split into 2x32-bit accesses for a 32-bit quantity
> e506ea451254ab Will Deacon 2019-10-15  33   * (e.g. a virtual address) and a strong prevailing wind.
> e506ea451254ab Will Deacon 2019-10-15  34   */
> e506ea451254ab Will Deacon 2019-10-15  35  #define compiletime_assert_rwonce_type(t)                                    \
> e506ea451254ab Will Deacon 2019-10-15  36       compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
> e506ea451254ab Will Deacon 2019-10-15  37               "Unsupported access size for {READ,WRITE}_ONCE().")
> e506ea451254ab Will Deacon 2019-10-15  38
> e506ea451254ab Will Deacon 2019-10-15  39  /*
> e506ea451254ab Will Deacon 2019-10-15  40   * Use __READ_ONCE() instead of READ_ONCE() if you do not require any
> 3c9184109e78ea Will Deacon 2019-10-30  41   * atomicity. Note that this may result in tears!
> e506ea451254ab Will Deacon 2019-10-15  42   */
> b78b331a3f5c07 Will Deacon 2019-10-15  43  #ifndef __READ_ONCE
> e506ea451254ab Will Deacon 2019-10-15 @44  #define __READ_ONCE(x)       (*(const volatile __unqual_scalar_typeof(x) *)&(x))
> b78b331a3f5c07 Will Deacon 2019-10-15  45  #endif
> e506ea451254ab Will Deacon 2019-10-15  46
>
> :::::: The code at line 44 was first introduced by commit
> :::::: e506ea451254ab17e0bf918ca36232fec2a9b10c compiler.h: Split {READ,WRITE}_ONCE definitions out into rwonce.h
>
> :::::: TO: Will Deacon <will@xxxxxxxxxx>
> :::::: CC: Will Deacon <will@xxxxxxxxxx>
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux