http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60139

            Bug ID: 60139
           Summary: Imprecise column number for -pedantic on
                    non-computable initializer element
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com

I have two questions regarding the warnings by gcc on array initializers. 
1) the column numbers in the warnings by -pedantic are not precise. 
2) the warning message says the warning is enabled by default, but in fact the
warning is only enabled with -pedantic. When I use the command 
    $gcc-trunk -c -std=c89 non-constant-initializers.c
then no warning is emitted.



$: cat non-constant-initializers.c 
void fn() {
  int a1;
  int *p1 = &a1;
  int** array[5] = 
  {&p1, 
        (void*)0, (void*)0, (void*)0, &p1};

}
$: gcc-trunk -c -std=c89 -pedantic non-constant-initializers.c 
non-constant-initializers.c: In function ‘fn’:
non-constant-initializers.c:5:3: warning: initializer element is not computable
at load time [enabled by default]
   {&p1, 
   ^
non-constant-initializers.c:6:9: warning: initializer element is not computable
at load time [enabled by default]
         (void*)0, (void*)0, (void*)0, &p1};
         ^
$: gcc-trunk -c -std=c89 non-constant-initializers.c 
$: 
$:

Reply via email to