[LTP] [PATCH 1/9] metaparse: Print parsing file on verbose
Cyril Hrubis
chrubis@suse.cz
Fri Feb 23 13:12:49 CET 2024
Hi!
> This introduces warning:
>
> $ make metaparse
> In file included from metaparse.c:17:
> In function ‘data_node_string’,
> inlined from ‘main’ at metaparse.c:894:6:
> data_storage.h:84:20: warning: array subscript ‘struct data_node[0]’ is partly outside array bounds of ‘unsigned char[6]’ [-Warray-bounds=]
> 84 | node->type = DATA_STRING;
> | ~~~~~~~~~~~^~~~~~~~~~~~~
> data_storage.h:79:34: note: object of size 6 allocated by ‘malloc’
> 79 | struct data_node *node = malloc(size);
> | ^~~~~~~~~~~~
> HOSTCC metadata/metaparse
>
> What am I missing?
This looks like the compiler is confused by the union and flexible array
and static analysis produces gibberish. The very fact that this is
triggered by addition of unrelated piece of code supports that hypotesis
as well.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list