[llvm-commits] [PATCH] bad behavior in calculateFrameObjectOffsets

Bruno Cardoso Lopes bruno.cardoso at gmail.com
Mon Jun 2 23:11:38 PDT 2008


Using unsigned in the loop below can lead to bad stack objects access,
one example is when
MinCSFrameIndex = 0, the variable i doesnt go negative
and the loop starts to access fixed objects locations (since getObjectAlignment
param is int) overwriting previous calculated stack locations. This is
breaking callee
saved register spill in Mips.

lib/CodeGen/PrologEpilogInserter.cpp, line 365
for (unsigned i = MaxCSFrameIndex; i >= MinCSFrameIndex; --i) {
      unsigned Align = FFI->getObjectAlignment(i);

-- 
Bruno Cardoso Lopes ( now @ Cocos Island )
http://www.brunocardoso.cc

++ The saddest aspect of life right now is that
science gathers knowledge faster than society
gathers wisdom + Isaac Asimov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PrologEpilogInserter.cpp.patch
Type: application/octet-stream
Size: 656 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20080603/3c1116da/attachment.obj>


More information about the llvm-commits mailing list