[gccsdk] [Bug 205] New: __gcc_alloca_restore() can erroneously delete chunks associated with a parent stack frame

bugzilla-daemon at riscos.info bugzilla-daemon at riscos.info
Sat May 22 14:31:22 PDT 2010


http://www.riscos.info/bugzilla3/show_bug.cgi?id=205

           Summary: __gcc_alloca_restore() can erroneously delete chunks
                    associated with a parent stack frame
           Product: GCC/GCCSDK
           Version: other
          Platform: Other
        OS/Version: RISC OS
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Unixlib and SharedCLibrary
        AssignedTo: peter at chocky.org
        ReportedBy: me at phlamethrower.co.uk
   Estimated Hours: 0.0


Created an attachment (id=76)
 --> (http://www.riscos.info/bugzilla3/attachment.cgi?id=76)
Patch to fix __gcc_alloca_restore()

If a function directly or indirectly uses alloca() then GCC will emit code to
call __gcc_alloca_restore() during the function epilogue. However functions
with multiple flows of control sometimes result in __gcc_alloca_restore() being
called without any calls to alloca() having been made for that stack frame.
With the current implementation of __gcc_alloca_restore() this works fine if
this is the first function in the stack trace to use alloca(). But if alloca()
has been used by a parent stack frame then __gcc_alloca_restore() will
malfunction and delete that stack frame's data. The attached patch fixes this
issue, for both UnixLib and the SCL.

A simple test program to demonstrate the issue can be found in this mailing
list message: http://www.riscos.info/pipermail/gcc/2010-May/005284.html

-- 
Configure bugmail: http://www.riscos.info/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.




More information about the gcc mailing list