Bug 19604

Summary: gcc miscompiles Mysql on IA32 with "-O2"(O1 works)
Product: [Retired] Red Hat Linux Reporter: Trond Eivind Glomsrxd <teg>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 7.0CC: dr
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-10-24 19:44:19 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:
Bug Depends On:    
Bug Blocks: 18620, 18905    
Attachments:
Description Flags
assembly file with "-O1"
none
assembly file with -O2
none
ii file of field.cc
none
test script for mysql
none
test script for mysql
none
Patch for aliasing problems in mysql none

Description Trond Eivind Glomsrxd 2000-10-23 14:31:52 UTC
gcc up to 2.96-60 miscompiles mysql (the file sql/field.cc) when compiled
with "-O2" as opposed to "-O1". This results in bad query results.

Comment 1 Trond Eivind Glomsrxd 2000-10-23 14:34:41 UTC
Created attachment 4553 [details]
assembly file with "-O1"

Comment 2 Trond Eivind Glomsrxd 2000-10-23 14:35:32 UTC
Created attachment 4554 [details]
assembly file with -O2

Comment 3 Trond Eivind Glomsrxd 2000-10-23 14:37:39 UTC
Created attachment 4555 [details]
ii file of field.cc

Comment 4 Trond Eivind Glomsrxd 2000-10-23 14:38:33 UTC
Created attachment 4556 [details]
test script for mysql

Comment 5 Trond Eivind Glomsrxd 2000-10-23 14:39:20 UTC
Created attachment 4557 [details]
test script for mysql

Comment 6 Jakub Jelinek 2000-10-24 12:40:01 UTC
That file is full of code dancing around the edge of what is and what is
not allowed with -fstrict-aliasing.
Either compile that file with -fno-strict-aliasing, or find out which exact
routine causes the testcase to fail and I'll tell you whether it is valid
C or not (but I assume the latter).
Basically, a char pointer can alias with any type, otherwise one should
access variables only through compatible types.

Comment 7 Trond Eivind Glomsrxd 2000-10-24 19:44:16 UTC
Is there a way to turn this on/off inside the source file? Suggestions on how to
find which function?

Comment 8 Trond Eivind Glomsrxd 2000-10-25 18:59:23 UTC
Closing - Jakub found bugs (aliasing) in the Mysql code.

Comment 9 Trond Eivind Glomsrxd 2000-10-25 19:00:36 UTC
Created attachment 4654 [details]
Patch for aliasing problems in mysql