[llvmlinux] [LLVMdev] opt fails with assertion in Attributes.cpp

Marcelo Sousa marceloabsousa at gmail.com
Thu Jun 20 13:37:44 UTC 2013


Hi again,

I believe the error is caused by the following global declaration:
@__ksymtab_fw_csr_iterator_init = internal constant %struct.kernel_symbol {
i64 ptrtoint (void (%struct.fw_csr_iterator*, i32*)* @fw_csr_iterator_init
to i64), i8* getelementptr inbounds ([21 x i8]*
@__kstrtab_fw_csr_iterator_init, i32 0, i32 0) }, section
"___ksymtab+fw_csr_iterator_init", align 8

The assertion is being triggered from Verifier::VerifyAttributeTypes.

Regards,
Marcelo


On Thu, Jun 20, 2013 at 2:24 PM, Marcelo Sousa <marceloabsousa at gmail.com>wrote:

> Hi Bill,
>
> With the latest llvm version I'm getting the following error:
>
> opt -instnamer < core-device.c.bc > core-device.o.bc
> Attribute 'nobuiltin' only applies to functions!
> void (%struct.fw_csr_iterator*, i32*)* @fw_csr_iterator_init
> Broken module found, compilation aborted!
> 0  opt             0x0000000001914bf1
> llvm::sys::PrintStackTrace(_IO_FILE*) + 38
> 1  opt             0x0000000001914e78
> 2  opt             0x00000000019148bc
> 3  libpthread.so.0 0x00000035d980efe0
> 4  libc.so.6       0x00000035d8c35935 gsignal + 53
> 5  libc.so.6       0x00000035d8c370e8 abort + 328
> 6  opt             0x00000000017ee645
> 7  opt             0x00000000017ee33d
> 8  opt             0x00000000017cccad
> llvm::FPPassManager::runOnFunction(llvm::Function&) + 385
> 9  opt             0x00000000017cce9e
> llvm::FPPassManager::runOnModule(llvm::Module&) + 84
> 10 opt             0x00000000017cd1fb
> llvm::MPPassManager::runOnModule(llvm::Module&) + 559
> 11 opt             0x00000000017cd7fd
> llvm::PassManagerImpl::run(llvm::Module&) + 249
> 12 opt             0x00000000017cda0f
> llvm::PassManager::run(llvm::Module&) + 39
> 13 opt             0x000000000090ab1b main + 5486
> 14 libc.so.6       0x00000035d8c21735 __libc_start_main + 245
> 15 opt             0x00000000008fc7c9
> Stack dump:
> 0.    Program arguments: /home/scratch/llvm/build/bin/opt -instnamer
> 1.    Running pass 'Function Pass Manager' on module '<stdin>'.
> 2.    Running pass 'Module Verifier' on function '@fw_csr_iterator_init'
> Aborted
>
> The bytecode of the function is:
> ; Function Attrs: noredzone nounwind
> define void @fw_csr_iterator_init(%struct.fw_csr_iterator* nocapture %ci,
> i32* %p) #1 {
>   tail call void @llvm.dbg.value(metadata !{%struct.fw_csr_iterator* %ci},
> i64 0, metadata !159), !dbg !3500
>   tail call void @llvm.dbg.value(metadata !{i32* %p}, i64 0, metadata
> !160), !dbg !3500
>   %1 = getelementptr i32* %p, i64 1, !dbg !3501
>   %2 = getelementptr inbounds %struct.fw_csr_iterator* %ci, i64 0, i32 0,
> !dbg !3501
>   store i32* %1, i32** %2, align 8, !dbg !3501
>   %3 = load i32* %p, align 4, !dbg !3503
>   %4 = lshr i32 %3, 16, !dbg !3503
>   %5 = zext i32 %4 to i64, !dbg !3503
>   %.sum = add i64 %5, 1, !dbg !3503
>   %6 = getelementptr i32* %p, i64 %.sum, !dbg !3503
>   %7 = getelementptr inbounds %struct.fw_csr_iterator* %ci, i64 0, i32 1,
> !dbg !3503
>   store i32* %6, i32** %7, align 8, !dbg !3503
>   ret void, !dbg !3504
> }
>
> Can someone fix this or point me to where I should fix it?
>
> Kind regards,
> Marcelo
>
>
> On Tue, Jun 18, 2013 at 10:28 PM, Bill Wendling <wendling at apple.com>wrote:
>
>> Hi Marcelo,
>>
>> That should be fixed now at r184239. Sorry about the failure!
>>
>> -bw
>>
>> On Jun 17, 2013, at 6:16 AM, Marcelo Sousa <marceloabsousa at gmail.com>
>> wrote:
>>
>> > Hello,
>> >
>> > I'm getting an error when running opt with what seems to be a valid
>> bytecode file compiled from one the Linux Kernel files.
>> > The error is:
>> > opt: /home/scratch/llvm/lib/IR/Attributes.cpp:119: llvm::StringRef
>> llvm::Attribute::getKindAsString() const: Assertion `isStringAttribute() &&
>> "Invalid attribute type to get the kind as a string!"' failed.
>> >
>> > I send you in attach the .{c,bc,ll} and the log file of the error.
>> > Any insight on how to solve this would be quite helpful because it
>> occurs in several bytecode files of the Linux Kernel source.
>> >
>> > I'm using llvm-3.4svn.
>> >
>> > Kind regards,
>> > Marcelo
>> >
>> <async.c><async.c.bc><async.c.ll><errorlog>_______________________________________________
>> > LLVM Developers mailing list
>> > LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/llvmlinux/attachments/20130620/31d367e3/attachment.html>


More information about the LLVMLinux mailing list