Issue regarding -Wmissing-field-initializers
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Arm Embedded Toolchain |
New
|
Undecided
|
Unassigned |
Bug Description
The warning: missing initializer for field ... [-Wmissing-
The following code is correct, however [-Wmissing-
struct test_t{
int value1;
int value2;
};
struct test_t test[] = {
[0].value1 = 1,
[0].value2 = 2,
[1].value1 = 10,
[1].value2 = 20
};
int main(){
return 0;
}
warning: missing initializer for field 'value2' of 'struct test_t' [-Wmissing-
[0].value2 = 2,
warning: missing initializer for field 'value2' of 'struct test_t' [-Wmissing-
[1].value2 = 20
The initialization is correct:
_test:
.long 1
.long 2
.long 10
.long 20
This bug can be reproduced with (GNU Arm Embedded Toolchain 10-2020-q4-major) 10.2.1 20201103. Please note you need the -Wextra flag in order to reproduce this.