First Last Prev Next    No search results available
Details
: [Sparc] Code generator asserts on alloca of zero size type
Bug#: 299
: libraries
: Backend: SparcV9
Status: RESOLVED
Resolution: FIXED
: All
: All
: 1.0
: P2
: normal
: 1.2

:
: compile-fail
:
:
  Show dependency tree - Show dependency graph
People
Reporter: John T. Criswell <criswell@uiuc.edu>
Assigned To: Chris Lattner <sabre@nondot.org>

Attachments
Code to reproduce problem (1.85 KB, text/plain)
2004-03-18 21:42, John T. Criswell
Details


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2004-03-18 21:41
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.
------- Comment #1 From John T. Criswell 2004-03-18 21:42:51 -------
Created an attachment (id=103) [details]
Code to reproduce problem

This is reduced from Shootout's ackermann.

Note the alloca of [0 x sbyte].
------- Comment #2 From Chris Lattner 2004-03-18 21:44:43 -------
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
------- Comment #3 From Chris Lattner 2004-03-18 22:17:31 -------
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
------- Comment #4 From Chris Lattner 2004-03-18 22:24:10 -------
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

First Last Prev Next    No search results available