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)
Created attachment 67544 [details] Source for test program to demonstrate -malign-double / stringstream interaction
-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.