[Bug c/115185] Missing "too long" warning when string-array size doesn't include NULL byte
wentaoz5 at illinois dot edu
gcc-bugzilla@gcc.gnu.org
Thu Jul 25 04:05:17 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115185
--- Comment #20 from Wentao Zhang <wentaoz5 at illinois dot edu> ---
(In reply to Wentao Zhang from comment #18)
>
> will get expanded to
>
> [POWER_SUPPLY_PROP_CHARGE_CONTROL_START_THRESHOLD] = {
> .prop_name = "CHARGE_CONTROL_START_THRESHOLD",
> .attr_name = "j" "\0",
> .text_values = ((void *)0),
> .text_values_len = 0,
> },
>
> It still triggers the warning even if "\0" is explicitly specified and the
> length is exactly MAX_PROP_NAME_LEN + 1 (31).
Sorry I mistyped. It should be
[POWER_SUPPLY_PROP_CHARGE_CONTROL_START_THRESHOLD] = {
.prop_name = "CHARGE_CONTROL_START_THRESHOLD",
.attr_name = "CHARGE_CONTROL_START_THRESHOLD" "\0",
.text_values = ((void *)0),
.text_values_len = 0,
},
Thanks, Andrew!
More information about the Gcc-bugs
mailing list