[LLVMbugs] [Bug 11311] New: Range checking on builtins before template instantiation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Nov 4 09:01:09 PDT 2011


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

             Bug #: 11311
           Summary: Range checking on builtins before template
                    instantiation
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: marton78 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Hi,

The following code doesn't compile:

#include <arm_neon.h>

template <int Ofs>
void test(float32x4_t& a, float32x4_t&b)
{
    a = vextq_f32(a,b,Ofs);
}

int main()
{
    float32x4_t a, b;
    test<1>(a, b);
}

Compilation fails with the following error:

bug.cpp:8:9: error: argument should be a value from 0 to 3
    a = vextq_f32(a,b,Ofs);
        ^~~~~~~~~~~~~~~~~~

Replacing Ofs -> 1 by hand resolves the error. Seems like clang performs range
checking even on templates that are not yet instantiated.

Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin10.8.0
Thread model: posix

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list