搭建网站的软件有哪些,打开网页,网站添加关键字,怎么在自己的网站上做漂浮链接当我在this question中提出时#xff0c;gcc正在移除(是的#xff0c;使用 -O0 )一行代码 _mm_div_ss(s1, s2); #xff0c;大概是因为结果未保存 . 但是#xff0c;这应该触发浮点异常并引发SIGFPE#xff0c;如果删除调用则不会发生这种情况 .Question #xff1a;是否…当我在this question中提出时gcc正在移除(是的使用 -O0 )一行代码 _mm_div_ss(s1, s2); 大概是因为结果未保存 . 但是这应该触发浮点异常并引发SIGFPE如果删除调用则不会发生这种情况 .Question 是否有一个标志或多个标志传递给gcc以便代码按原样编译我正在考虑像 fno-remove-unused 这样的东西但是我支持使用gcc属性/ pragma代替吗我尝试过的事情$ gcc --helpoptimizers | grep -i remove没有结果 .$ gcc --helpoptimizers | grep -i unused没有结果 .并明确禁用所有死代码/消除标志 - 请注意没有关于未使用代码的警告$ gcc -O0 -msse2 -Wall -Wextra -pedantic -Winline \-fno-dce -fno-dse -fno-tree-dce \-fno-tree-dse -fno-tree-fre -fno-compare-elim -fno-gcse \-fno-gcse-after-reload -fno-gcse-las -fno-rerun-cse-after-loop \-fno-tree-builtin-call-dce -fno-tree-cselim a.ca.c: In function ‘main’:a.c:25:5: warning: ISO C90 forbids mixed declarations and code [-Wpedantic]__m128 s1, s2;^$来源计划#include #include #include #include static void sigaction_sfpe(int signal, siginfo_t *si, void *arg){printf(%d,%d,%d\n, signal, si!NULL?1:0, arg!NULL?1:0);printf(inside SIGFPE handler\nexit now.\n);exit(1);}int main(){struct sigaction sa;memset(sa, 0, sizeof(sa));sigemptyset(sa.sa_mask);sa.sa_sigaction sigaction_sfpe;sa.sa_flags SA_SIGINFO;sigaction(SIGFPE, sa, NULL);_mm_setcsr(0x00001D80);__m128 s1, s2;s1 _mm_set_ps(1.0, 1.0, 1.0, 1.0);s2 _mm_set_ps(0.0, 0.0, 0.0, 0.0);_mm_div_ss(s1, s2);printf(done (no error).\n);return 0;}编译上面的程序给出了$ ./a.outdone (no error).换线_mm_div_ss(s1, s2);至s2 _mm_div_ss(s1, s2); // add s2 产生预期的结果$ ./a.outinside SIGFPE handler编辑更多细节 .这似乎与 _mm_div_ss definition上的 __always_inline__ 属性有关 .$ cat t.cintdiv(int b){return 1/b;}int main(){div(0);return 0;}$ gcc -O0 -Wall -Wextra -pedantic -Winline t.c -o t.out$(没有警告或错误)$ ./t.outFloating point exception$vs下面(功能属性除外)$ cat t.c__inline int __attribute__((__always_inline__))div(int b){return 1/b;}int main(){div(0);return 0;}$ gcc -O0 -Wall -Wextra -pedantic -Winline t.c -o t.out$(没有警告或错误)$ ./t.out$添加函数属性 __warn_unused_result__ 至少会给出一条有用的消息$ gcc -O0 -Wall -Wextra -pedantic -Winline t.c -o t.outt.c: In function ‘main’:t.c:9:5: warning: ignoring return value of ‘div’, declared with attribute warn_unused_result [-Wunused-result]div(0);^编辑关于gcc mailing list的一些讨论 . 最终我认为一切都按预期工作 .