> cat uninit-13b.c
float
foo(void)
{
    _Complex float f;
    __imag__ f = 0;
    return f;
}
> gcc -O -Wuninitialized -S uninit-13b.c
uninit-13b.c: In function 'foo':
uninit-13b.c:4:20: warning: 'REALPART_EXPR <f>' is used uninitialized in this
function

This is as expected, and occurs consistently for all(?) targets (I've checked
i686, x86_64, sparc64, ppc64, alpha, and armv5tel Linux).

Changing the return type to '_Complex float', without changing anything else,
including the line numbers for the function body declarations and statements,
causes the diagnostic to refer to a different line:

> sed 's/^float/_Complex float/' < uninit-13b.c > uninit-13.c
> gcc -O -Wuninitialized -S uninit-13.c
uninit-13.c: In function 'foo':
uninit-13.c:5:16: warning: 'REALPART_EXPR <f>' is used uninitialized in this
function

This difference occurs on the i686, x86_64, sparc64, ppc64, and alpha targets,
but not the armv5tel target which continues to refer to line 4.

These inconsistencies are seen with gcc-4.5-20091029, 4.4.2, and 4.3.4.


-- 
           Summary: _Complex return type changes line numbers in diagnostics
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mikpe at it dot uu dot se
  GCC host triplet: i686-pc-linux-gnu


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

Reply via email to