[LLVMbugs] [Bug 2021] New: clang prints bogus type compatibility warning between constant and variable array types

Neil Booth neil at daikokuya.co.uk
Tue Feb 12 05:44:37 PST 2008


bugzilla-daemon at cs.uiuc.edu wrote:-

> http://llvm.org/bugs/show_bug.cgi?id=2021
> 
>            Summary: clang prints bogus type compatibility warning between
>                     constant and variable array types
>            Product: clang
>            Version: unspecified
>           Platform: PC
>         OS/Version: Linux
>             Status: NEW
>           Severity: normal
>           Priority: P2
>          Component: AST
>         AssignedTo: unassignedbugs at nondot.org
>         ReportedBy: sharparrow1 at yahoo.com
>                 CC: llvmbugs at cs.uiuc.edu
> 
> 
> Testcase:
> int a(int i) {
>   int (*pf)[2];
>   int (*pv)[i];
>   (i ? pf : pv);
> }
> 
> This shouldn't warn because the pointed-to types are compatible.  Easy fix to
> ASTContext, which I'll sort out in a bit.

It's best to tighten up the testcases and ensure they can only
complain about the thing being tested.  For example this code
has good reason to complain twice:

c$ ~/src/cfe/cfe /tmp/bug.c
"/tmp/bug.c", line 4: warning: expression has no effect
  (i ? pf : pv);
  ^
"/tmp/bug.c", line 5: warning: function "a" should return a value
}
^

Neil.



More information about the llvm-bugs mailing list