Bug 526428

Summary: gcc 4.4.1 -O1 optimization bug
Product: [Fedora] Fedora Reporter: Jochen Schlick <josch09>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 11CC: jakub
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-30 19:51:30 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:
Description Flags
test program that triggers this bug none

Description Jochen Schlick 2009-09-30 08:50:45 UTC
Created attachment 363153 [details]
test program that triggers this bug

Description of problem:

There is a problem with the -O1 optimization together with inline code, loops, class constructors and temporal objects.

Version-Release number of selected component (if applicable):
gcc-4.4.1-2.fc11

How reproducible:
see attached test program.
here the results from a Fedora 11 system with the mentioned compiler


>  /usr/bin/gcc -lstdc++ test.cpp
>  ./a.out
val1=1234, val2=0
val1=1234, val2=1

--> OK


>  /usr/bin/gcc -lstdc++ -O1  test.cpp
> ./a.out
val1=-1081510952, val2=-30798
val1=-1081510952, val2=-30798


--> FAIL


>  /usr/bin/gcc -lstdc++ -O2  test.cpp
> ./a.out
val1=1234, val2=0
val1=1234, val2=1

--> OK


PS: I've already created a bug report for Gentoo Linux but the same happens on Fedora 11 too (that's why I create also a Fedora bug report)

https://bugs.gentoo.org/show_bug.cgi?id=286982

Comment 1 Jakub Jelinek 2009-09-30 19:51:30 UTC
Works just fine with gcc-4.4.1-17.