Bug 712480
Summary: | Incorrect common subexpression elimination in 4.6.0 | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Tom Lane <tgl> | ||||
Component: | gcc | Assignee: | Jakub Jelinek <jakub> | ||||
Status: | CLOSED UPSTREAM | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | unspecified | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | 15 | CC: | hhorak, jakub | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | x86_64 | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2011-06-13 11:27:32 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
I've so far distilled a small self-contained testcase from this, tracking upstream. |
Created attachment 504181 [details] gzip'd intermediate file. Description of problem: 4.6.0 with -O2 incorrectly optimizes code of the following form: struct foo fooTmp; struct foo *fooPtr = &fooTmp; ... expression involving fooPtr->fld fooTmp.fld += something; same expression involving fooPtr->fld The generated code assumes that the value fetched through fooPtr is still good after the update to the referenced variable. The same code has worked fine in all previous gcc versions (it's out of postgresql FWIW) Version-Release number of selected component (if applicable): gcc-4.6.0-9.fc15.x86_64 How reproducible: 100% Steps to Reproduce: 1. Compile with /usr/bin/gcc -O2 -fno-strict-aliasing -fwrapv -g -I../../../../src/include -D_GNU_SOURCE -c xlog.c 2. Inspect code for lines 3772, 3780, 3798 Additional info: Unsurprisingly, -fno-gcse makes the bug go away. I attach the .i file for the source code.