Issue regarding -Wmissing-field-initializers

Bug #1923823 reported by Robert Dumitru
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
New
Undecided
Unassigned

Bug Description

The warning: missing initializer for field ... [-Wmissing-field-initializers] is being thrown incorrectly.

The following code is correct, however [-Wmissing-field-initializers] are shown.

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-field-initializers]
   [0].value2 = 2,
warning: missing initializer for field 'value2' of 'struct test_t' [-Wmissing-field-initializers]
   [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.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.