首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >“顶级重排”是什么意思?

“顶级重排”是什么意思?
EN

Stack Overflow用户
提问于 2017-07-20 17:44:46
回答 1查看 987关注 0票数 1

我为Fortran提供了一个开放的MPI代码,它在没有使用优化标志的情况下编译和运行没有错误。当我使用-O1标志时,在执行时会出现分段错误。导致此问题的唯一优化标志是-ftoplevel-reorder。您能直观地解释这个标志的作用以及在代码中发现错误的最佳策略(如果有的话)吗?

EN

回答 1

Stack Overflow用户

发布于 2017-07-21 04:24:41

来自https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

代码语言:javascript
运行
复制
-fno-toplevel-reorder

    Do not reorder top-level functions, variables, and asm statements. Output them in the same order that they appear in the input file. When this option is used, unreferenced static variables are not removed. This option is intended to support existing code that relies on a particular ordering. For new code, it is better to use attributes when possible.

    Enabled at level -O0. When disabled explicitly, it also implies -fno-section-anchors, which is otherwise enabled at -O0 on some targets.

您可能正在访问超出界限的数组,并且根据局部变量在堆栈中的放置方式,其后果范围从不明显到致命的崩溃。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45221752

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档