https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82283

Robert Dumitru <robert.dumitru at cyberthorstudios dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |robert.dumitru@cyberthorstu
                   |                            |dios.com

--- Comment #10 from Robert Dumitru <robert.dumitru at cyberthorstudios dot 
com> ---
We are experiencing the same issue:

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 was discovered first on version 8.3 but it can be reproduced on
version 10.2 as well. Please note you need the -Wextra flag in order to
reproduce this. 

I think https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99081 is also relating to
this.
  • [Bug c/82283] Wron... robert.dumitru at cyberthorstudios dot com via Gcc-bugs

Reply via email to