Bugzilla – Bug 299
[Sparc] Code generator asserts on alloca of zero size type
Last modified: 2004-03-18 22:25:01
You need to log in before you can comment on or make changes to this bug.
The llc program on Solaris generates the following assertion on the attached input: Assertion failed: tsize > 0 && "Illegal (zero) type size for alloca", file /home/vadve/criswell/rel12/llvm/lib/Target/SparcV9/SparcV9InstrSelection.cpp, line 1159 Abort The Linux/x86 code generator accepts the input.
Created an attachment (id=103) [details] Code to reproduce problem This is reduced from Shootout's ackermann. Note the alloca of [0 x sbyte].
That alloca seems pretty pointless. Are all of the failures on C++ programs? If so, I wouldn't worry about this at all for the release. The sparc backend has never worked well with the C++ standard library, and now does not seem like the time to fix it... -Chris
I've verified that this is perfectly correct code being generated and optimized by the C++ front-end. It basically comes from something like this: unsigned Amt = blah ? x : 0; X = builtin_alloca(Amt); The alloca gets tail duplicated into the two arms of the conditional, becoming 'alloca 0' in the false arm. I'll try to fix this in the sparc backend. Wish me luck :) -Chris
Fixed, patch here: http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040315/013269.html I don't know if the code really will break on a zero sized alloca, so I just had it pretend to be a unit sized alloca instead. This seems to fix the problem :) -Chris