X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: RazorSliph Newsgroups: comp.os.msdos.djgpp Subject: -fpack-struct issues Message-ID: <6kvo4ukaf4ceud3gn6pp0ut7t08jsup0kv@4ax.com> X-Newsreader: Forte Agent 1.8/32.553 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 72 Date: Mon, 21 Jan 2002 15:57:26 -0500 NNTP-Posting-Host: 24.200.83.135 X-Complaints-To: abuse AT videotron DOT ca X-Trace: wagner.videotron.net 1011646611 24.200.83.135 (Mon, 21 Jan 2002 15:56:51 EST) NNTP-Posting-Date: Mon, 21 Jan 2002 15:56:51 EST To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Greetings! I need to compile an application using the -fpack-struct so that the structures generated (and written to disk) are identical to the saved structures created by another program. The structures, unfortunately, are 10 bytes wide, and get padded to 12 bytes with a base compile. However, whenever I compile with the -fpack-struct option, the resulting executable segfaults. (GPF's) Is there some kind of workaround (other than memcpying the structs to arrays of bytes, or other kludges) ? Or am I unique in experiencing this problem? Here's a trial run I did with a hello world proggie: D:\home\hello>dir Volume in drive D is Dogma Volume Serial Number is 4C1B-1934 Directory of D:\home\hello 21/01/2002 03:48 PM . 21/01/2002 03:48 PM .. 21/01/2002 03:49 PM 157 hello.cc 1 File(s) 157 bytes 2 Dir(s) 13,691,617,280 bytes free D:\home\hello>type hello.cc #include #include using namespace std; int main() { string s="Hello world!\n"; cout << s; } D:\home\hello>gxx hello.cc -o hello.exe D:\home\hello>hello Hello world! D:\home\hello>gxx hello.cc -o hello.exe -fpack-struct D:\home\hello>hello Exiting due to signal SIGSEGV General Protection Fault at eip=00018acc eax=60000000 ebx=00000000 ecx=00000000 edx=000bfaa4 esi=00000001 edi=0003fb60 ebp=000bfa5c esp=000bfa48 program=D:\HOME\HELLO\HELLO.EXE cs: sel=01a7 base=02980000 limit=000cffff ds: sel=01af base=02980000 limit=000cffff es: sel=01af base=02980000 limit=000cffff fs: sel=017f base=000058e0 limit=0000ffff gs: sel=01bf base=00000000 limit=0010ffff ss: sel=01af base=02980000 limit=000cffff App stack: [000bfb60..0003fb60] Exceptn stack: [0003fabc..0003db7c] Call frame traceback EIPs: 0x00018acc 0x0001857b 0x00018a8d 0x00010e58 0x00010f39 0x00001f90 0x00002035 0x0000a67f 0x00005a6e D:\home\hello> Thanks.