From: "ICE (Instrumentacion y Control Electr.)" To: djgpp AT delorie DOT com Subject: Patch for __attribute__ ((packed)) Date: Wed, 3 Apr 1996 16:47:20 +0300 (GMT) Message-ID: <9604031647.aa24779@ailin.inti.edu.ar> Hi everybody: My name is Salvador Eduardo Tropea (SET), i'm from Argentina (South America). Sorry for my english. Robert Hoehne autor of RHIDE says in your READMETV.SRC: *******NOT*******NOT********* Do N O T compile the library with GCC V.2.7.1 or GCC 2.7.2, because there is a bug in cc1plus, which dosn't handle correct packed structures, which are used by the File-classes (struct ffblk). I have compiled the library with GCC V.2.7.0. If you have no access to this version and you want it, see my on my TV-Homepage. *******NOT******NOT********** I sent the following message to Robert: > > 2) I succesfully remake RHIDE (and libtv ofcourse) with gcc 2.7.2 !!!! > I know about the bug in gcc, i'm one of the people (hundreds i guess) that > report this bug to GNU, but on april 2 A. Appleyard (from england) > wrote the following message to the djgpp list: > > > One problem might be that you declare structs with packed fields and use > > the size of struct modeinfo in one of the variants (but not in the > > other). GCC 2.7.2 has a known bug in its C++ compiler: it doesn't pack > > structs even if you use __attribute__((packed)), so you might use a wrong > > struct layout and size. > > > To make GCC pack the structures, surround the code with these (I hope I > > get this right; to be sure, search the DJGPP mailing archives for > > `pragma' as keyword): > > > #ifdef __cplusplus > > #pragma pack(1) > > !!> put here the code that declares packed structures > > >#pragma pack() > >#endif > > I made the following: > > a) I created a header file called 'pack.h': > > #ifndef __pack_bug_fixer > #define __pack_bug_fixer > > #define Pack_ON #pragma pack(1) > #define Pack_OFF #pragma pack() > > #endif > > b) I enclosed the declarations in dos.h and dir.h which use > __attribute__ ((packed)), with Pack_ON and Pack_OFF (including the header > pack.h very close to the declaration). > > c) I made the same in 'file.cc' of RHIDE. > > This procedure seems to work fine. > Now i propose this procedure to make a patch for gcc 2.7.2. Note: I don't know nothing about diff and related tools, and i supose that Delorie must put this patch in SimTel. Greetings SET. -------------------------------------------------------------------------------- INTI - CITEI - ICE Av Gral Paz y Alvarellos. T.E. (+541) 754-4141/5 Interno: 315 CC 157 - CP 1650 - San Martin Fax: (+541) 754-5194 Buenos Aires, Argentina E-mail: ice AT inti DOT edu DOT ar