Bug 70045

Summary: -malign-double option causes program to fail.
Product: [Retired] Red Hat Linux Reporter: Need Real Name <lee.bryson>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: high Docs Contact:
Priority: medium    
Version: 7.3   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-07-29 16:56:09 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
Source for test program to demonstrate -malign-double / stringstream interaction none

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.