-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed
Labels
area: LoggingbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bugMedium impact/importance bug
Description
When building with clang we get these warnings, which seem like a real possible issue. Seems like we might need some ifdef protection.
This was seen building:
-p nrf52840_pca10056 -T samples/basic/fade_led
/home/galak/git/zephyr/subsys/logging/log_backend_rtt.c:116:4: error: array index -2 is before the beginning of the array [-Werror,-Warray-bounds]
line_buf[DROP_MSG_LEN - 2] = ' ';
^ ~~~~~~~~~~~~~~~~
/home/galak/git/zephyr/subsys/logging/log_backend_rtt.c:49:1: note: array 'line_buf' declared here
static u8_t line_buf[MESSAGE_SIZE + DROP_MSG_LEN];
^
/home/galak/git/zephyr/subsys/logging/log_backend_rtt.c:117:4: error: array index -3 is before the beginning of the array [-Werror,-Warray-bounds]
line_buf[DROP_MSG_LEN - 3] = (u8_t) ('0' + cnt);
^ ~~~~~~~~~~~~~~~~
/home/galak/git/zephyr/subsys/logging/log_backend_rtt.c:49:1: note: array 'line_buf' declared here
static u8_t line_buf[MESSAGE_SIZE + DROP_MSG_LEN];
^
/home/galak/git/zephyr/subsys/logging/log_backend_rtt.c:118:4: error: array index -4 is before the beginning of the array [-Werror,-Warray-bounds]
line_buf[DROP_MSG_LEN - 4] = ' ';
^ ~~~~~~~~~~~~~~~~
/home/galak/git/zephyr/subsys/logging/log_backend_rtt.c:49:1: note: array 'line_buf' declared here
static u8_t line_buf[MESSAGE_SIZE + DROP_MSG_LEN];
^
/home/galak/git/zephyr/subsys/logging/log_backend_rtt.c:120:4: error: array index -2 is before the beginning of the array [-Werror,-Warray-bounds]
line_buf[DROP_MSG_LEN - 2] = (u8_t) ('0' + cnt % 10);
^ ~~~~~~~~~~~~~~~~
/home/galak/git/zephyr/subsys/logging/log_backend_rtt.c:49:1: note: array 'line_buf' declared here
static u8_t line_buf[MESSAGE_SIZE + DROP_MSG_LEN];
^
/home/galak/git/zephyr/subsys/logging/log_backend_rtt.c:121:4: error: array index -3 is before the beginning of the array [-Werror,-Warray-bounds]
line_buf[DROP_MSG_LEN - 3] = (u8_t) ('0' + cnt / 10);
^ ~~~~~~~~~~~~~~~~
/home/galak/git/zephyr/subsys/logging/log_backend_rtt.c:49:1: note: array 'line_buf' declared here
static u8_t line_buf[MESSAGE_SIZE + DROP_MSG_LEN];
^
/home/galak/git/zephyr/subsys/logging/log_backend_rtt.c:122:4: error: array index -4 is before the beginning of the array [-Werror,-Warray-bounds]
line_buf[DROP_MSG_LEN - 4] = '>';
^ ~~~~~~~~~~~~~~~~
/home/galak/git/zephyr/subsys/logging/log_backend_rtt.c:49:1: note: array 'line_buf' declared here
static u8_t line_buf[MESSAGE_SIZE + DROP_MSG_LEN];
^
6 errors generated.
make[3]: *** [zephyr/CMakeFiles/zephyr.dir/build.make:414: zephyr/CMakeFiles/zephyr.dir/subsys/logging/log_backend_rtt.c.obj] Error 1
Metadata
Metadata
Assignees
Labels
area: LoggingbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bugMedium impact/importance bug