The following causes an assertion in recent svn pulls, but not in 2.5. The assertion: llvm-as: /home/bgl/work/llvm-work/include/llvm/ADT/SmallVector.h:125: T& llvm::SmallVectorImpl<T>::operator[](unsigned int) [with T = llvm::Constant*]: Assertion `Begin + idx < End' failed. The .ll code: target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32" target triple = "x86-unknown-unknown" @foo = constant [4 x [0 x i8]*] [ [0 x i8]* bitcast( [5 x i8]* getelementptr( [5 x i8]* @.str1 ) to [0 x i8]* ), [0 x i8]* bitcast( [4 x i8]* getelementptr( [4 x i8]* @.str2 ) to [0 x i8]* ), [0 x i8]* bitcast( [4 x i8]* getelementptr( [4 x i8]* @.str3 ) to [0 x i8]* ), [0 x i8]* bitcast( [6 x i8]* getelementptr( [6 x i8]* @.str4 ) to [0 x i8]* ) ] @.str1 = internal constant [5 x i8] c"zero\00" @.str2 = internal constant [4 x i8] c"one\00" @.str3 = internal constant [4 x i8] c"two\00" @.str4 = internal constant [6 x i8] c"three\00" I'm not sure how to proceed on tracking down the cause.
On Fri, Jul 24, 2009 at 1:21 PM, Bagel<bagel99 at gmail.com> wrote:> The following causes an assertion in recent svn pulls, but not in 2.5. > > The assertion: > > llvm-as: /home/bgl/work/llvm-work/include/llvm/ADT/SmallVector.h:125: T& > llvm::SmallVectorImpl<T>::operator[](unsigned int) [with T = llvm::Constant*]: > Assertion `Begin + idx < End' failed.Fixed in r77005.> The .ll code: > > target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32" > target triple = "x86-unknown-unknown" > @foo = constant [4 x [0 x i8]*] [ > [0 x i8]* bitcast( [5 x i8]* getelementptr( [5 x i8]* @.str1 ) to [0 x i8]* ),You're using getelementptr in a slightly strange way here; it isn't illegal, but LLVM would never generate it because of the constant folder.> I'm not sure how to proceed on tracking down the cause.gdb is your friend; a backtrace made the issue pretty obvious. -Eli
On Fri Jul 24 17:00:52 CDT 2009 Eli Friedman eli.friedman at gmail.com wrote: >On Fri, Jul 24, 2009 at 1:21 PM, Bagel<bagel99 at gmail.com> wrote: >> The following causes an assertion in recent svn pulls, but not in 2.5. >> >> The assertion: >> >> llvm-as: /home/bgl/work/llvm-work/include/llvm/ADT/SmallVector.h:125: T& >> llvm::SmallVectorImpl<T>::operator[](unsigned int) [with T = llvm::Constant*]: >> Assertion `Begin + idx < End' failed. > >Fixed in r77005. Thanks. >> The .ll code: >> >> target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32" >> target triple = "x86-unknown-unknown" >> @foo = constant [4 x [0 x i8]*] [ > Anton Korobeynikov wrote: > Hello, > > I'm awfully sorry - I was pretty busy to include your patches to LLVM > mainline but hope to do this during this weekend. Apple folks just > released their "alternative" of libgcc. It might be pretty interesting > thing for msp430: http://compiler-rt.llvm.org/ > > [0 x i8]* bitcast( [5 x i8]* getelementptr( [5 x i8]* @.str1 ) to [0 x i8]* ), You're using getelementptr in a slightly strange way here; it isn't illegal, but LLVM would never generate it because of the constant folder. > I'm not sure how to proceed on tracking down the cause. gdb is your friend; a backtrace made the issue pretty obvious. -Eli
Sorry about the previous message, fumbled fingered, please ignore.
On Fri Jul 24 17:00:52 CDT 2009, Eli Friedman eli.friedman at gmail.com wrote: > Fixed in r77005. Thanks. > You're using getelementptr in a slightly strange way here; it isn't > illegal, but LLVM would never generate it because of the constant > folder. This is generated by my front-end for an experimental language of mine. I'm still learning how to map to LLVM code. > gdb is your friend; a backtrace made the issue pretty obvious. I did a gdb backtrace, looked at some of the code, and realized that it would take a long term to learn enough to do the fix. So I left it to the experts :-). Thanks again. bagel