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

            Bug ID: 66527
           Summary: incorrect line number in diagnostics for multiline
                    initializers
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

In a diagnostic message pointing to an initializer that spans multiple lines,
instead of pointing to the offending construct gcc points to the line withe the
terminating semicolon or closing brace (when the initializer is an aggregate).

For example:

$ cat t.c && /build/gcc-66516/gcc/xgcc -B /build/gcc-66516/gcc -S -o/dev/null
t.c
/* 1 */ void f (register int i) {
/* 2 */ int* a =
/* 3 */     &i
/* 4 */ ;
/* 5 */ }
t.c: In function ā€˜f’:
t.c:4:9: error: address of register variable ā€˜i’ requested
 /* 4 */ ;
         ^

(I haven't seen this mentioned on the
https://gcc.gnu.org/wiki/Better_Diagnostics Wiki; sorry if this is another
known issue and I missed it.)

Reply via email to