[Bug rtl-optimization/89965] [8 Regression] wrong code with -O -mtune=nano-x2 -fcaller-saves -fexpensive-optimizations -fno-tree-dce -fno-tree-ter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89965 --- Comment #18 from William Bader --- I did a bisection for the bug from my previous comment (which is still present in the current gcc 11 in master): 058e97ecf33ad0dfd926b3876a4bcf59ac9556ff is the first bad commit commit 058e97ecf33ad0dfd926b3876a4bcf59ac9556ff Author: Vladimir Makarov Date: Tue Aug 26 12:39:58 2008 + `git diff '058e97ecf33ad0dfd926b3876a4bcf59ac9556ff^!' | wc -l` shows 16192 lines. gcc/caller-save.c has a lot of changes. I want it fixed in the current gcc. I don't care about gcc 4, other than that the git bisect found that the bug was introduced in a commit to gcc 4. Is it worth trying to fix it in gcc 4, or would that just waste time making a patch that would not apply to the current gcc?
[Bug rtl-optimization/89965] [8 Regression] wrong code with -O -mtune=nano-x2 -fcaller-saves -fexpensive-optimizations -fno-tree-dce -fno-tree-ter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89965 William Bader changed: What|Removed |Added CC||williambader at hotmail dot com --- Comment #17 from William Bader --- Something similar to this might be back in gcc 10. I have gcc-10.2.1-9.fc32.x86_64 (gcc 10.2.1 from Fedora 32) and it also happens on gcc-10.2.0 built from source on CentOS 6.10. I have a 64 bit CPU, but I am building a 32 bit executable. I have a 30K line C module that misbehaves with "-O1 -fcaller-saves -fexpensive-optimizations". It works with less optimization (-O1, -O0, or either of -fcaller-saves or -fexpensive-optimizations removed). It works under under valgrind (and does not show any uninitialized variables or memory overwrites). I have debug code like "if (debug) fprintf(stderr, ...);" It works if I set debug to 1. It also works if I go to any of several debug statements and change "if (debug)" to "if (debug || 1)". It seems as if one of the local variables is getting messed up, and either the preparation or clean up after a fprintf() call invalidates the register with the variable or gets a fresh copy from the stack. I suppose that it would be impossible to track down without an example, but if anyone has a similar problem with the combination of 32 bit Intel + -O1 + -fcaller-saves + -fexpensive-optimizations, maybe this comment will add another data point, and if there is a patch, I could try to build it.
[Bug rtl-optimization/89965] [8 Regression] wrong code with -O -mtune=nano-x2 -fcaller-saves -fexpensive-optimizations -fno-tree-dce -fno-tree-ter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89965 Jakub Jelinek changed: What|Removed |Added Status|ASSIGNED|RESOLVED Known to work||8.3.1 Resolution|--- |FIXED --- Comment #16 from Jakub Jelinek --- Fixed for 8.4+ too.
[Bug rtl-optimization/89965] [8 Regression] wrong code with -O -mtune=nano-x2 -fcaller-saves -fexpensive-optimizations -fno-tree-dce -fno-tree-ter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89965 --- Comment #15 from Jakub Jelinek --- Author: jakub Date: Tue Apr 30 21:03:56 2019 New Revision: 270750 URL: https://gcc.gnu.org/viewcvs?rev=270750&root=gcc&view=rev Log: Backported from mainline 2019-04-12 Jakub Jelinek PR rtl-optimization/89965 * dce.c: Include rtl-iter.h. (struct check_argument_load_data): New type. (check_argument_load): New function. (find_call_stack_args): Check for loads from stack slots still tracked in sp_bytes and punt if any is found. * gcc.target/i386/pr89965.c: New test. Added: branches/gcc-8-branch/gcc/testsuite/gcc.target/i386/pr89965.c Modified: branches/gcc-8-branch/gcc/ChangeLog branches/gcc-8-branch/gcc/dce.c branches/gcc-8-branch/gcc/testsuite/ChangeLog
[Bug rtl-optimization/89965] [8 Regression] wrong code with -O -mtune=nano-x2 -fcaller-saves -fexpensive-optimizations -fno-tree-dce -fno-tree-ter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89965 --- Comment #14 from Jakub Jelinek --- Author: jakub Date: Tue Apr 30 21:01:23 2019 New Revision: 270747 URL: https://gcc.gnu.org/viewcvs?rev=270747&root=gcc&view=rev Log: Backported from mainline 2019-04-11 Jakub Jelinek PR rtl-optimization/89965 * dce.c (sp_based_mem_offset): New function. (find_call_stack_args): Use sp_based_mem_offset. Modified: branches/gcc-8-branch/gcc/ChangeLog branches/gcc-8-branch/gcc/dce.c
[Bug rtl-optimization/89965] [8 Regression] wrong code with -O -mtune=nano-x2 -fcaller-saves -fexpensive-optimizations -fno-tree-dce -fno-tree-ter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89965 Jakub Jelinek changed: What|Removed |Added Known to work||9.0 Summary|[8/9 Regression] wrong code |[8 Regression] wrong code |with -O -mtune=nano-x2 |with -O -mtune=nano-x2 |-fcaller-saves |-fcaller-saves |-fexpensive-optimizations |-fexpensive-optimizations |-fno-tree-dce -fno-tree-ter |-fno-tree-dce -fno-tree-ter Known to fail|9.0 | --- Comment #13 from Jakub Jelinek --- Fixed on the trunk so far.