| Summary: | [4.8/4.9 Regression] wrong code for assignment in conditional at -Os | ||
|---|---|---|---|
| Product: | gcc | Reporter: | Dara Hazeghi <dhazeghi> |
| Component: | rtl-optimization | Assignee: | Jakub Jelinek <jakub> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | jakub |
| Priority: | P3 | ||
| Version: | 4.9.0 | ||
| Target Milestone: | 4.8.2 | ||
| Host: | Target: | ||
| Build: | Known to work: | ||
| Known to fail: | Last reconfirmed: | 2013-06-08 00:00:00 | |
| Attachments: | gcc49-pr57568.patch | ||
Started with r188785, but guess it has just been latent before that. Created attachment 30280 [details] gcc49-pr57568.patch Untested fix. Author: jakub Date: Sun Jun 9 18:30:01 2013 New Revision: 199870 URL: http://gcc.gnu.org/viewcvs?rev=199870&root=gcc&view=rev Log: PR target/57568 * config/i386/i386.md (TARGET_READ_MODIFY_WRITE peepholes): Ensure that operands[2] doesn't overlap with operands[0]. * gcc.c-torture/execute/pr57568.c: New test. Added: trunk/gcc/testsuite/gcc.c-torture/execute/pr57568.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.md trunk/gcc/testsuite/ChangeLog Author: jakub Date: Sun Jun 9 18:33:32 2013 New Revision: 199871 URL: http://gcc.gnu.org/viewcvs?rev=199871&root=gcc&view=rev Log: PR target/57568 * config/i386/i386.md (TARGET_READ_MODIFY_WRITE peepholes): Ensure that operands[2] doesn't overlap with operands[0]. * gcc.c-torture/execute/pr57568.c: New test. Added: branches/gcc-4_8-branch/gcc/testsuite/gcc.c-torture/execute/pr57568.c Modified: branches/gcc-4_8-branch/gcc/ChangeLog branches/gcc-4_8-branch/gcc/config/i386/i386.md branches/gcc-4_8-branch/gcc/testsuite/ChangeLog Author: jakub Date: Sun Jun 9 18:37:51 2013 New Revision: 199872 URL: http://gcc.gnu.org/viewcvs?rev=199872&root=gcc&view=rev Log: PR target/57568 * config/i386/i386.md (TARGET_READ_MODIFY_WRITE peepholes): Ensure that operands[2] doesn't overlap with operands[0]. * gcc.c-torture/execute/pr57568.c: New test. Added: branches/gcc-4_7-branch/gcc/testsuite/gcc.c-torture/execute/pr57568.c Modified: branches/gcc-4_7-branch/gcc/ChangeLog branches/gcc-4_7-branch/gcc/config/i386/i386.md branches/gcc-4_7-branch/gcc/testsuite/ChangeLog Wow, that was fast! Confirmed fixed, thanks. Thanks for the report (and other reports). |
The following code is miscompiled by gcc trunk and 4.8 on x86_64-linux at -Os and above optimization levels in 32-bit mode (should print nothing). This is a regression from 4.7.x. $ gcc-trunk -v gcc version 4.9.0 20130608 (experimental) [trunk revision 199849] (GCC) $ gcc-trunk -O1 -m32 reduced.c $ ./a.out $ gcc-4.7 -Os -m32 reduced.c $ ./a.out $ gcc-trunk -Os -m32 reduced.c $ ./a.out 1 $ --------------- int printf (const char *, ...); int a[6][9] = {}; int b = 1; int *c = &a[3][5]; int main () { if (b) if (*c = *c + *c) printf ("%d\n", a[3][5]); return 0; }