[LLVMbugs] [Bug 15421] New: indexing an integral type with a pointer type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Mar 2 08:03:46 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15421

            Bug ID: 15421
           Summary: indexing an integral type with a pointer type
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: M8R-9yw8a5 at mailinator.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

C allows "indexing an integral type with a pointer type":

int a;
char *p;
a[p];

This is an obscure feature, and is possibly the result of C trying to mimic
some assembly syntax.

The proposal is to give a warning and 2 notes:
- warning: indexing an integral type with a pointer is an obscure feature
- note: use ``p[a]'' to silence this warning
- note: use ``*(p + a)'' to allow p and a to be flippable macro parameters,
while silencing this warning.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130302/cdd47ef8/attachment.html>


More information about the llvm-bugs mailing list