Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

gcc 4.7.2 miscompiles stackless #19

Closed
ghost opened this issue Nov 29, 2013 · 3 comments
Closed

gcc 4.7.2 miscompiles stackless #19

ghost opened this issue Nov 29, 2013 · 3 comments

Comments

@ghost
Copy link

ghost commented Nov 29, 2013

Originally reported by: RMTEW FULL NAME (Bitbucket: rmtew, GitHub: rmtew)


(originally reported in Trac by @akruis on 2013-04-07 09:39:02)

Compilers constantly improve. When I tried to build Stackless 2.7.4rc1 with gcc 4.7.2 the stackless unittests didn't terminate. Python went into an endless loop just before terminating.

It turned out that gcc overly optimised climb_stack_and_transfer. The compiler removed the alloca call and then performed a tail recursion optimisation. Pretty cool. :-)
Details: linux amd64, gcc 4.7.2, options "-O2". The relevant command line switches are
-foptimize-sibling-calls
-ftree-vrp
-ftree-dce
Because this optimisation does not depend on the architecture, I suspect that this problem affects
other architectures and stackless versions too.

I see two possibilities to fix this issue:

    1. Add some #pragmas or specific compiler switches to inhibit the optimisation.
    1. Use the pointer returned from alloca, i.e. store the pointer in a global variable.

I prefer option 2, because it is less compiler specific. And the overhead of an additional write is negligible.


@ghost
Copy link
Author

ghost commented Nov 29, 2013

Original comment by RMTEW FULL NAME (Bitbucket: rmtew, GitHub: rmtew):


@ctismer on 2013-04-07 10:28:32 said:

Option 2 looks fine for me.
We can make the global invisible enough so that we never use it.
I prefer solutions that cannot be optimized in some future (presumably) ;-)

@ghost
Copy link
Author

ghost commented Nov 29, 2013

Original comment by RMTEW FULL NAME (Bitbucket: rmtew, GitHub: rmtew):


@akruis on 2013-04-24 16:30:58 said:

I fixed it for 2.7-slp. Changeset [53f0e5446729]

To do: eventually port the fix to 3.x-slp

@ghost
Copy link
Author

ghost commented Dec 6, 2013

Original comment by Anselm Kruis (Bitbucket: akruis, GitHub: akruis):


Resolved for 3.x since commit fac9fb5b115e.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

0 participants