[LLVMbugs] [Bug 2510] New: Non-power-of-2 _Bool vector asserts

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Jul 1 06:31:38 PDT 2008


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

           Summary: Non-power-of-2 _Bool vector asserts
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Semantic Analyzer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: matthijs at stdin.nl
                CC: llvmbugs at cs.uiuc.edu


The following trivial code, declaring a vector of 3 _Bool's lets clang crash
with an assert:
   _Bool __attribute__((vector_size(3))) X;

$ clang -emit-llvm  < tmp.c 
clang: ASTContext.cpp:317: std::pair<long long unsigned int, unsigned int>
clang::ASTContext::getTypeInfo(clang::QualType): Assertion `Align && (Align &
(Align-1)) == 0 && "Alignment must be power of 2"' failed.
clang[0x8637ffa]
clang[0x863812c]
[0xffffe420]
/lib/tls/i686/cmov/libc.so.6(abort+0x101)[0xb7d32201]
/lib/tls/i686/cmov/libc.so.6(__assert_fail+0xee)[0xb7d29b6e]
clang(_ZN5clang10ASTContext11getTypeInfoENS_8QualTypeE+0x70f)[0x84ba1d3]
clang(_ZN5clang10ASTContext12getTypeAlignENS_8QualTypeE+0x1f)[0x83bb46f]
clang(_ZN5clang7CodeGen13CodeGenModule17EmitGlobalVarInitEPKNS_7VarDeclE+0x55c)[0x83b0cb2]
clang(_ZN5clang7CodeGen13CodeGenModule13EmitGlobalVarEPKNS_7VarDeclE+0x7e)[0x83b0f9a]
clang(_ZN5clang7CodeGen13CodeGenModule23EmitGlobalVarDeclaratorEPKNS_7VarDeclE+0x29)[0x83b0fc5]
clang(_ZN46_GLOBAL__N_ModuleBuilder.cpp_00000000_B4E8DBEF13CodeGenerator18HandleTopLevelDeclEPN5clang4DeclE+0x181)[0x83aee8d]
clang(_ZN5clang8ParseASTERNS_12PreprocessorEPNS_11ASTConsumerEb+0x1e1)[0x846ea0d]
clang[0x83a2562]
clang(main+0x66b)[0x83a2f6b]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb7d1c050]
clang[0x8373321]
Aborted (core dumped)

When replacing the _Bool with int, clang properly generates the following
error:

   <stdin>:1:20: error: vector size not an integral multiple of component size
   int __attribute__((vector_size(3))) X;
                      ^           ~

I guess this should also happen with _Bool, don't know why those are handled
differently.


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