FreeRTOS / FreeRTOS-Plus-TCP

FreeRTOS-Plus-TCP library repository. +TCP files only. Submoduled into https://github.com/FreeRTOS/FreeRTOS and various other repos.
MIT License
139 stars 156 forks source link

[BUG] Compiler errors/warnings - always have to manually ignore when building the Kernel with Clang #958

Closed phelter closed 1 year ago

phelter commented 1 year ago

Describe the bug When compiling with the CMake options:

add_compile_options(
    $<$<COMPILE_LANG_AND_ID:C,GNU>:-fdiagnostics-color=always>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-fcolor-diagnostics>

    $<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wall>
    $<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wextra>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wpedantic> # Note not used in GNU to allow C99 designated initializers.
    $<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Werror>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Weverything>

    # Allow clang and gnu pramgmas.
    $<$<COMPILE_LANG_AND_ID:C,GNU>:-Wno-unknown-pragmas>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-typedef-redefinition>

    # Documentation types
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-fcomment-block-commands=retval> # Doesn't recongize doxygen retval
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-fcomment-block-commands=copydetails> # Doesn't recongize doxygen copydetails
)

There are several isssues/warnings that arise when compling with Clang-14 when compiling V4.0.0-rc3

Target

Host

To Reproduce

freertos_plus_tcp-src/source/FreeRTOS_BitConfig.c:135:15: error: parameter 'pxConfig:' not found in the function declaration [-Werror,-Wdocumentation]
freertos_plus_tcp-src/source/FreeRTOS_BitConfig.c:136:15: error: parameter 'pucData:' not found in the function declaration [-Werror,-Wdocumentation]
freertos_plus_tcp-src/source/FreeRTOS_BitConfig.c:137:15: error: parameter 'uxSize:' not found in the function declaration [-Werror,-Wdocumentation]
freertos_plus_tcp-src/source/FreeRTOS_BitConfig.c:203:59: error: implicit conversion loses integer precision: 'int' to 'uint16_t' (aka 'unsigned short') [-Werror,-Wimplicit-int-conversion]
freertos_plus_tcp-src/source/FreeRTOS_DHCP.c:785:17: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
freertos_plus_tcp-src/source/FreeRTOS_DHCP.c:1375:23: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_DNS_Callback.c:154:62: error: implicit conversion loses integer precision: 'TickType_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
freertos_plus_tcp-src/source/FreeRTOS_DNS_Callback.c:276:10: error: no previous prototype for function 'vDNSCallbackInitialise' [-Werror,-Wmissing-prototypes]
freertos_plus_tcp-src/source/FreeRTOS_DNS_Callback.c:276:32: error: this old-style function definition is not preceded by a prototype [-Werror,-Wstrict-prototypes]
freertos_plus_tcp-src/source/FreeRTOS_DNS_Parser.c:474:60: error: implicit conversion loses integer precision: 'uint16_t' (aka 'unsigned short') to 'uint8_t' (aka 'unsigned char') [-Werror,-Wimplicit-int-conversion]
freertos_plus_tcp-src/source/FreeRTOS_DNS_Parser.c:563:98: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
freertos_plus_tcp-src/source/FreeRTOS_DNS_Parser.c:575:122: error: implicit conversion loses integer precision: 'unsigned long' to 'int16_t' (aka 'short') [-Werror,-Wimplicit-int-conversion]
freertos_plus_tcp-src/source/FreeRTOS_DNS_Parser.c:582:143: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
freertos_plus_tcp-src/source/FreeRTOS_DNS_Parser.c:1220:80: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
freertos_plus_tcp-src/source/FreeRTOS_DNS_Parser.c:1224:122: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
freertos_plus_tcp-src/source/FreeRTOS_IP.c:236:1: error: function 'prvIPTask' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
freertos_plus_tcp-src/source/FreeRTOS_IP.c:478:9: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
freertos_plus_tcp-src/source/FreeRTOS_IP.c:893:23: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_IP.c:1227:48: error: cast from 'const void *' to 'unsigned char *' drops const qualifier [-Werror,-Wcast-qual]
freertos_plus_tcp-src/source/FreeRTOS_IP.c:1660:9: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
freertos_plus_tcp-src/source/FreeRTOS_IP.c:1888:25: error: variable 'uxHeaderLength' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
freertos_plus_tcp-src/source/FreeRTOS_IP_Utils.c:1030:47: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_IP_Utils.c:67:13: error: macro is not used [-Werror,-Wunused-macros]
freertos_plus_tcp-src/source/FreeRTOS_IP_Utils.c:75:13: error: macro is not used [-Werror,-Wunused-macros]
freertos_plus_tcp-src/source/FreeRTOS_IPv6.c:640:16: error: variable 'xExtHeaderCount' set but not used [-Werror,-Wunused-but-set-variable]
freertos_plus_tcp-src/source/FreeRTOS_IPv4.c:420:86: error: unused parameter 'pxNetworkBuffer' [-Werror,-Wunused-parameter]
freertos_plus_tcp-src/source/FreeRTOS_DNS.c:933:33: error: enumeration value 'xPreferenceNone' not explicitly handled in switch [-Werror,-Wswitch-enum]
freertos_plus_tcp-src/source/FreeRTOS_DNS.c:1011:42: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_DNS.c:1031:49: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_DNS.c:1002:25: error: enumeration value 'xPreferenceNone' not explicitly handled in switch [-Werror,-Wswitch-enum]
freertos_plus_tcp-src/source/FreeRTOS_DNS.c:862:20: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_DNS.c:1188:20: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_DNS.c:1561:13: error: cast from 'const struct xDNSTail *' to 'unsigned char *' drops const qualifier [-Werror,-Wcast-qual]
freertos_plus_tcp-src/source/FreeRTOS_DNS.c:1561:13: error: cast from 'const struct xDNSTail *' to 'unsigned char *' drops const qualifier [-Werror,-Wcast-qual]
freertos_plus_tcp-src/source/FreeRTOS_DNS.c:1562:13: error: cast from 'const struct xDNSTail *' to 'unsigned char *' drops const qualifier [-Werror,-Wcast-qual]
freertos_plus_tcp-src/source/FreeRTOS_DNS.c:1562:13: error: cast from 'const struct xDNSTail *' to 'unsigned char *' drops const qualifier [-Werror,-Wcast-qual]
freertos_plus_tcp-src/source/FreeRTOS_IPv4_Utils.c:130:16: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_IPv6_Sockets.c:229:12: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
freertos_plus_tcp-src/source/FreeRTOS_IPv6_Utils.c:101:16: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_ND.c:891:28: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_ND.c:1220:39: error: use of GNU statement expression extension [-Werror,-Wgnu-statement-expression]
freertos_plus_tcp-src/source/FreeRTOS_ND.c:1220:39: error: '(' and '{' tokens introducing statement expression are separated by whitespace [-Werror,-Wcompound-token-split-by-space]
freertos_plus_tcp-src/source/FreeRTOS_ND.c:1220:39: error: '}' and ')' tokens terminating statement expression are separated by whitespace [-Werror,-Wcompound-token-split-by-space]
freertos_plus_tcp-src/source/FreeRTOS_ND.c:1244:20: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_ND.c:69:13: error: macro is not used [-Werror,-Wunused-macros]
freertos_plus_tcp-src/source/FreeRTOS_RA.c:521:17: error: enumeration values 'eRAStateWait' and 'eRAStateIPWait' not explicitly handled in switch [-Werror,-Wswitch-enum]
freertos_plus_tcp-src/source/FreeRTOS_RA.c:632:24: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_Routing.c:867:61: error: cast from 'const unsigned char *' to 'void *' drops const qualifier [-Werror,-Wcast-qual]
freertos_plus_tcp-src/source/FreeRTOS_Routing.c:871:63: error: cast from 'const unsigned char *' to 'void *' drops const qualifier [-Werror,-Wcast-qual]
freertos_plus_tcp-src/source/FreeRTOS_Routing.c:1459:35: error: use of GNU statement expression extension [-Werror,-Wgnu-statement-expression]
freertos_plus_tcp-src/source/FreeRTOS_Routing.c:1459:35: error: '(' and '{' tokens introducing statement expression are separated by whitespace [-Werror,-Wcompound-token-split-by-space]
freertos_plus_tcp-src/source/FreeRTOS_Routing.c:1459:35: error: '}' and ')' tokens terminating statement expression are separated by whitespace [-Werror,-Wcompound-token-split-by-space]
freertos_plus_tcp-src/source/FreeRTOS_Routing.c:1462:67: error: implicit conversion loses integer precision: 'int' to 'uint16_t' (aka 'unsigned short') [-Werror,-Wimplicit-int-conversion]
freertos_plus_tcp-src/source/FreeRTOS_Routing.c:1507:50: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
freertos_plus_tcp-src/source/FreeRTOS_Routing.c:1516:50: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
freertos_plus_tcp-src/source/FreeRTOS_TCP_IP_IPV6.c:112:31: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_TCP_IP.c:187:123: error: implicit conversion loses integer precision: 'unsigned long' to 'uint32_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]
freertos_plus_tcp-src/source/FreeRTOS_TCP_IP.c:471:21: error: 10 enumeration values not explicitly handled in switch: 'eCLOSED', 'eTCP_LISTEN', 'eCONNECT_SYN'... [-Werror,-Wswitch-enum]
freertos_plus_tcp-src/source/FreeRTOS_TCP_IP.c:655:20: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_TCP_Transmission_IPV4.c:237:32: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_TCP_Transmission_IPV4.c:351:9: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
freertos_plus_tcp-src/source/FreeRTOS_TCP_State_Handling_IPV6.c:177:33: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_TCP_State_Handling.c:117:13: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
freertos_plus_tcp-src/source/FreeRTOS_TCP_State_Handling.c:171:17: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
freertos_plus_tcp-src/source/FreeRTOS_TCP_State_Handling.c:885:17: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:1451:76: error: cast from 'const struct xSOCKET *' to 'struct xSOCKET *' drops const qualifier [-Werror,-Wcast-qual]
freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:2202:48: error: format specifies type 'void *' but the argument has type 'uint8_t *' (aka 'unsigned char *') [-Werror,-Wformat-pedantic]
freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:2204:48: error: format specifies type 'void *' but the argument has type 'uint8_t *' (aka 'unsigned char *') [-Werror,-Wformat-pedantic]
freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:2234:44: error: format specifies type 'void *' but the argument has type 'uint8_t *' (aka 'unsigned char *') [-Werror,-Wformat-pedantic]
freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:2873:80: error: cast from 'const void *' to 'struct QueueDefinition **' drops const qualifier [-Werror,-Wcast-qual]
freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:2896:83: error: cast from 'const void *' to 'void (*)(struct xSOCKET *)' drops const qualifier [-Werror,-Wcast-qual]
freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:3342:38: error: implicit conversion changes signedness: 'char' to 'unsigned int' [-Werror,-Wsign-conversion]
freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:3633:13: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:3774:38: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:5109:43: error: cast from 'const unsigned char *' to 'unsigned char *' drops const qualifier [-Werror,-Wcast-qual]
freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:5768:11: error: empty paragraph passed to '@return' command [-Werror,-Wdocumentation]
freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:5768:5: error: '@return' command used in a comment that is attached to a function returning void [-Werror,-Wdocumentation]
freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:5812:48: error: format specifies type 'void *' but the argument has type 'const uint8_t *' (aka 'const unsigned char *') [-Werror,-Wformat-pedantic]
freertos_plus_tcp-src/source/FreeRTOS_TCP_Utils.c:64:5: error: '@param' command used in a comment that is not attached to a function declaration [-Werror,-Wdocumentation]
freertos_plus_tcp-src/source/FreeRTOS_TCP_Utils.c:66:5: error: '@return' command used in a comment that is not attached to a function or method declaration [-Werror,-Wdocumentation]
freertos_plus_tcp-src/source/FreeRTOS_TCP_Utils_IPV6.c:97:25: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_TCP_Transmission_IPV6.c:233:32: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_TCP_Transmission_IPV6.c:359:9: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
freertos_plus_tcp-src/source/FreeRTOS_UDP_IP.c:93:15: error: parameter 'pxNetworkBuffer:' not found in the function declaration [-Werror,-Wdocumentation]
freertos_plus_tcp-src/source/FreeRTOS_UDP_IP.c:131:15: error: parameter 'pxNetworkBuffer:' not found in the function declaration [-Werror,-Wdocumentation]
freertos_plus_tcp-src/source/FreeRTOS_UDP_IP.c:132:15: error: parameter 'usPort:' not found in the function declaration [-Werror,-Wdocumentation]
freertos_plus_tcp-src/source/FreeRTOS_UDP_IP.c:133:16: error: parameter 'pxIsWaitingForARPResolution:' not found in the function declaration [-Werror,-Wdocumentation]
freertos_plus_tcp-src/source/FreeRTOS_UDP_IP.c:153:25: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_UDP_IPv4.c:68:9: error: macro is not used [-Werror,-Wunused-macros]
freertos_plus_tcp-src/source/FreeRTOS_UDP_IPv4.c:360:31: error: mixing declarations and code is a C99 extension [-Werror,-Wdeclaration-after-statement]
freertos_plus_tcp-src/source/FreeRTOS_UDP_IPv6.c:70:9: error: macro is not used [-Werror,-Wunused-macros]
freertos_plus_tcp-src/source/portable/NetworkInterface/linux/NetworkInterface.c:869:44: error: cast from 'const unsigned char *' to 'struct xETH_HEADER *' drops const qualifier [-Werror,-Wcast-qual]

Expected behavior Should be warning clean or explicitly state that you are allowing these to be in the code so the consumer knows some level of expectations of ignored warnings.

If you are fine with these then please add them to your definition of the CMakeLists.txt for freertos_plus_tcp targets via:

target_compile_options(freertos_plus_tcp
  PRIVATE
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-cast-qual>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-compound-token-split-by-space>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-conditional-uninitialized>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-covered-switch-default>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-declaration-after-statement>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-documentation>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-extra-semi-stmt>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-format-pedantic>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-gnu-statement-expression>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-implicit-int-conversion>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-missing-noreturn>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-missing-prototypes>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-shorten-64-to-32>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-sign-conversion>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-strict-prototypes>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-switch-enum>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-unused-but-set-variable>
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-unused-macros>
    $<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wno-unused-parameter>
)

target_compile_options(freertos_plus_tcp_network_if
  PRIVATE
    $<$<COMPILE_LANG_AND_ID:C,Clang>:-Wno-cast-qual>
)

Screenshots N/A Wireshark logs N/A Additional context N/A

moninom1 commented 1 year ago

HI @phelter, Thank you for the detailed explanation of the issue! We will be looking further into this issue and fix it, thank you for your patience!

phelter commented 1 year ago

@moninom1 I am also seeing the following issues when compiling with gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0 And RelWithDebInfo settings - wtih above add_compile_options.

[build]     inlined from ‘pxNew_AddrInfo’ at ./freertos_plus_tcp-src/source/FreeRTOS_DNS.c:285:22:
[build] /usr/include/x86_64-linux-gnu/bits/string_fortified.h:95:10: error: ‘__builtin_strncpy’ specified bound 254 equals destination size [-Werror=stringop-truncation]
[build]    95 |   return __builtin___strncpy_chk (__dest, __src, __len,
[build]       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build]    96 |                                   __glibc_objsize (__dest));
[build]       |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
[build] cc1: all warnings being treated as errors

The line in FreeRTOS_DNS.c is in error not leaving any room for a guaranteed null termination: It should be:

            ( void ) strncpy( pxAddrInfo->xPrivateStorage.ucName, pcName, sizeof( pxAddrInfo->xPrivateStorage.ucName )-1 );
./freertos_plus_tcp-src/source/include/FreeRTOS_IP_Private.h: In function 'vSocketClose':
./freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:2304:29: error: array subscript 'ListItem_t {aka const struct xLIST_ITEM}[0]' is partly outside array bounds of 'List_t[1]' {aka 'struct xLIST[1]'} [-Werror=array-bounds]
 2304 |             for( pxIterator = listGET_NEXT( pxEnd );
      |                             ^
In file included from ./freertos_plus_tcp-src/source/include/FreeRTOS_IP_Utils.h:57,
                 from ./freertos_plus_tcp-src/source/include/FreeRTOS_IP.h:495,
                 from ./freertos_plus_tcp-src/source/include/FreeRTOS_UDP_IP.h:41,
                 from ./freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:46:
./freertos_plus_tcp-src/source/include/FreeRTOS_IP_Private.h:363:19: note: while referencing 'xBoundTCPSocketsList'
  363 |     extern List_t xBoundTCPSocketsList;
      |                   ^~~~~~~~~~~~~~~~~~~~
./freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:2280:24: error: array subscript 'ListItem_t {aka const struct xLIST_ITEM}[0]' is partly outside array bounds of 'List_t[1]' {aka 'struct xLIST[1]'} [-Werror=array-bounds]
 2280 |             pxIterator = listGET_NEXT( pxEnd );
      |                        ^
In file included from ./freertos_plus_tcp-src/source/include/FreeRTOS_IP_Utils.h:57,
                 from ./freertos_plus_tcp-src/source/include/FreeRTOS_IP.h:495,
                 from ./freertos_plus_tcp-src/source/include/FreeRTOS_UDP_IP.h:41,
                 from ./freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:46:
./freertos_plus_tcp-src/source/include/FreeRTOS_IP_Private.h:363:19: note: while referencing 'xBoundTCPSocketsList'
  363 |     extern List_t xBoundTCPSocketsList;
      |                   ^~~~~~~~~~~~~~~~~~~~
./freertos_plus_tcp-src/source/include/FreeRTOS_IP_Private.h: In function 'pxUDPSocketLookup':
./freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:3039:25: error: array subscript 'ListItem_t {aka const struct xLIST_ITEM}[0]' is partly outside array bounds of 'List_t[1]' {aka 'struct xLIST[1]'} [-Werror=array-bounds]
 3039 |         for( pxIterator = listGET_NEXT( pxEnd );
      |                         ^
In file included from ./freertos_plus_tcp-src/source/include/FreeRTOS_IP_Utils.h:57,
                 from ./freertos_plus_tcp-src/source/include/FreeRTOS_IP.h:495,
                 from ./freertos_plus_tcp-src/source/include/FreeRTOS_UDP_IP.h:41,
                 from ./freertos_plus_tcp-src/source/FreeRTOS_Sockets.c:46:
./freertos_plus_tcp-src/source/include/FreeRTOS_IP_Private.h:325:15: note: while referencing 'xBoundUDPSocketsList'
  325 | extern List_t xBoundUDPSocketsList;
      |               ^~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Suggest running with gcc installed in Ubuntu 22.04 - (v 11.2 or above) and run with release builds.

moninom1 commented 1 year ago

Hi @phelter I have fixed the clang issues, but i was not able to see any issue with gcc on Ubuntu. I am working on FreeRTOS-Plus-TCP main branch as we have merged all the dev/IPv6_Integration chages back to main.

phelter commented 1 year ago

@moninom1 - are you running with the latest GNU GCC compiler or at a minimum v11.2 or higher? It is possible that those files have changed since merging the IPv6 integration branch into master, and those issues were fixed by the other branch.

moninom1 commented 1 year ago

Hi @phleter, Yes I am using this version - gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0

Can you please help in checking on the latest FreeRTOS-Plus- TCP main branch, if the issues are not there, we can conclude that they are resolved.

moninom1 commented 1 year ago

Hi @phelter As the Clang changs are merged PR984 i will close the issue for now. Feel free to create new bug if you find any issue with gcc. One again thank you for reporting the issue to us.