-
Notifications
You must be signed in to change notification settings - Fork 1.3k
alloca seems buggy on M4 #548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alloca seems buggy on M4 #548
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great find!
Great job! - I just tried this PR on my M4 and it works fine in executing the same code that failed for #521 |
Unix builds are failing import tests! I'll look at it. |
Weird! There is a Unix test hanging for my pr.
…On Tue, Jan 23, 2018 at 6:19 PM Dan Halbert ***@***.***> wrote:
Unix builds are failing import tests!
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#548 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADNqUiSP4Y08BaLcZqanZXs532lG9Teks5tNpNFgaJpZM4Rqmpe>
.
|
Now travis is happy. I had to remove a different alloca() that I had changed to an array. It went out of scope and was destroyed, but the data was needed later. alloca() storage lives until the function returns, so that was wrong in this case. Original alloca() changed to an array still stands, to fix the bug. |
I repeated the tests from #521 and this PR still works fine. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, cool! Should we try to remove it in the future?
I did some further testing on this and found that the problem arose when the double-tap stuff was added to the loader map. There's no bug with this:
The bug appears when
I actually just adjusted Then I changed it to
@tannewt: I'll check in with you about this. |
So - does this imply that there is really no issue with "alloca"? It is just a memory alignment issue? |
@jerryneedell I don't know yet. I have something else to do for a while and then will come back to this. It could be that alloca() assumes certain alignment, which isn't true, and the array decl doesn't make that assumption. The generated code does not differ between the working and non-working versions. |
Assuming word size of 4 bytes was an issue I had with my unix tests as
well. I think making it -8 always would be fine unless the linker script
can actually tell us how big a word is.
…On Wed, Jan 24, 2018 at 9:30 AM Dan Halbert ***@***.***> wrote:
@jerryneedell <https://github.com/jerryneedell> I don't know yet. I have
something else to do for a while and then will come back to this. It could
be that alloca() assumes certain alignment, which isn't true, and the array
decl doesn't make that assumption. The generated code does not differ
between the working and non-working versions.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#548 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADNqTuVgcbvE4n9L1iICgTnvqNePjqsks5tN2ipgaJpZM4Rqmpe>
.
|
Fixes #521. The problem appears to be bad compilation of
alloca()
.alloca()
can be replaced with a run-time variable array: that works.I replaced a few other uses of
alloca()
that were similar, just in case they might also be problematic. There are some uses wherealloca()
is not done at the point of declaration, and those are harder to change. Also there are submodules with lots of uses ofalloca()
that I didn't change.Eventually I will try to come up with a small test case and submit a gcc bug report.