[LLVMbugs] [Bug 3314] New: clang treats local array with constant var as size as VLA

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Jan 11 11:21:42 PST 2009


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

           Summary: clang treats local array with constant var as size as
                    VLA
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: AST
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: pelle at morth.org
                CC: llvmbugs at cs.uiuc.edu


Example:
void tests_const_var_array(void)
{
        const int sz = 10;
        int arr[sz];

        arr[0] = 1;
}

$ ccc -c bing.c 
bing.c
clang -emit-llvm-bc -x c -o bing.o bing.c
Assertion failed: (0 && "FIXME: Local VLAs not implemented yet"), function
EmitLocalBlockVarDecl, file
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_llvm-devel/work/llvm-53722/tools/clang/lib/CodeGen/CGDecl.cpp,
line 162.

Expected result:
clang should realize sz is constant and treat this as a normal array, not a
VLA.


If nothing else, this should be considered when local VLAs are implemented.


-- 
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