Bug 70045 - -malign-double option causes program to fail.
Summary: -malign-double option causes program to fail.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.3
Hardware: i686
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-07-29 16:53 UTC by Need Real Name
Modified: 2007-04-18 16:44 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-07-29 16:56:09 UTC
Embargoed:


Attachments (Terms of Use)
Source for test program to demonstrate -malign-double / stringstream interaction (299 bytes, text/plain)
2002-07-29 16:56 UTC, Need Real Name
no flags Details

Description Need Real Name 2002-07-29 16:53:17 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.4.9-12smp i686)

Description of problem:
When I compile with the -malign-double option to g++, an application that uses a
stringstream to tokenize an input buffer does not operate correctly (no tokens
are found).  If I omit the -malign-double option, the program operates
correctly.  I've created and attached a test case that abstracts the problematic
code fragment.  In the actual application, this failure prevents the application
(a data server) from reading in the data it's supposed to provide to the rest of
our system, and causes a coredump.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.  Compile the attached test program as follows:
"g++ -o tester tester.cc"

2.  Run the program and note the output:
"5 tokens"

3.  Recompile the program as follows:
"g++ -o tester -malign-double tester.cc"

4.  Run the program and note the output:
"0 tokens"
	

Actual Results:  The program should write the string "5 tokens" to stdout.

Expected Results:  The program wrote the string "0 tokens" to stdout.

Additional info:

From the test system, output of uname -a:

Linux itacsdev02 2.4.18-3 #1 Thu Apr 18 07:37:53 EDT 2002 i686 unknown

output of g++ -v:

Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)

Comment 1 Need Real Name 2002-07-29 16:56:02 UTC
Created attachment 67544 [details]
Source for test program to demonstrate -malign-double / stringstream interaction

Comment 2 Jakub Jelinek 2002-07-29 17:00:19 UTC
-malign-double changes the ABI, so all libraries which the program uses
(including glibc and libstdc++) must be recompiled with those options
for things to work.
      *Warning:* if you use the -malign-double' switch, structures
      containing the above types will be aligned differently than the
      published application binary interface specifications for the 386.


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