Bug 19604 - gcc miscompiles Mysql on IA32 with "-O2"(O1 works)
Summary: gcc miscompiles Mysql on IA32 with "-O2"(O1 works)
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.0
Hardware: i386
OS: Linux
high
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks: 18620 18905
TreeView+ depends on / blocked
 
Reported: 2000-10-23 14:31 UTC by Trond Eivind Glomsrxd
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

(edit)
Clone Of:
(edit)
Last Closed: 2000-10-24 19:44:19 UTC


Attachments (Terms of Use)
assembly file with "-O1" (47.34 KB, application/octet-stream)
2000-10-23 14:34 UTC, Trond Eivind Glomsrxd
no flags Details
assembly file with -O2 (48.14 KB, application/octet-stream)
2000-10-23 14:35 UTC, Trond Eivind Glomsrxd
no flags Details
ii file of field.cc (73.29 KB, application/octet-stream)
2000-10-23 14:37 UTC, Trond Eivind Glomsrxd
no flags Details
test script for mysql (984 bytes, text/plain)
2000-10-23 14:38 UTC, Trond Eivind Glomsrxd
no flags Details
test script for mysql (666 bytes, text/plain)
2000-10-23 14:39 UTC, Trond Eivind Glomsrxd
no flags Details
Patch for aliasing problems in mysql (2.01 KB, patch)
2000-10-25 19:00 UTC, Trond Eivind Glomsrxd
no flags Details | Diff

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


Note You need to log in before you can comment on or make changes to this bug.