This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Fix stack overflow for test bug54082.c
ClosedPublic

Authored by tianshilei1992 on Jan 26 2023, 7:20 PM.

Details

Summary

When N is 1024, int result[N][N] is obviously large stack that Windows cannot support...

Fix #60326.

Diff Detail

Event Timeline

tianshilei1992 created this revision.Jan 26 2023, 7:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 26 2023, 7:20 PM
tianshilei1992 requested review of this revision.Jan 26 2023, 7:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 26 2023, 7:20 PM
tianshilei1992 edited the summary of this revision. (Show Details)Jan 26 2023, 7:47 PM
This revision is now accepted and ready to land.Jan 26 2023, 8:11 PM
This revision was automatically updated to reflect the committed changes.

Thanks for the fix! It does indeed seem to fix the issue.

Do you happen to know why this worked before, but now suddenly stopped working after D142297 - was the stack usage so close to the edges of what's allowed, that any minor tweak pushed it over the limit, or did the change in D142297 affect the amount of stack used in a bigger way? (I presume that the main int result[N][N] array here only gets allocated once on the stack, and the OpenMP threads just refer to that? I presume the change didn't cause the array to be allocated in more places than before?)

Thanks for the fix! It does indeed seem to fix the issue.

Do you happen to know why this worked before, but now suddenly stopped working after D142297 - was the stack usage so close to the edges of what's allowed, that any minor tweak pushed it over the limit, or did the change in D142297 affect the amount of stack used in a bigger way? (I presume that the main int result[N][N] array here only gets allocated once on the stack, and the OpenMP threads just refer to that? I presume the change didn't cause the array to be allocated in more places than before?)

There is no issue. That test case was added in that patch. It didn’t pass before…

Thanks for the fix! It does indeed seem to fix the issue.

Do you happen to know why this worked before, but now suddenly stopped working after D142297 - was the stack usage so close to the edges of what's allowed, that any minor tweak pushed it over the limit, or did the change in D142297 affect the amount of stack used in a bigger way? (I presume that the main int result[N][N] array here only gets allocated once on the stack, and the OpenMP threads just refer to that? I presume the change didn't cause the array to be allocated in more places than before?)

There is no issue. That test case was added in that patch. It didn’t pass before…

Oh, I see - doh. Thanks for explaining and sorry for the noise!