Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

GCC 4.7.0 breaks __attribute__((packed)) behavior on... (Developers)

posted by RayeR Homepage, CZ, 04.09.2012, 18:53

Hi,
maybe some of you are using mingw32 and/or writing portable code for 32/64bit systems so it may save your time on hunting bugs. I just recompiled my KMD under new mingw32 4.7.0 and got a crash. After night tracking I found that the problem is in size of structure:


typedef struct {                       // 48-bit adresa GDT/IDT
  Word limit;                          // size limit of GDT [Bytes-1]
  DWord base;                          // linear base address of the GDT in physical memory
} __attribute__((packed)) GDTR;


You may think that __attribute__((packed)) save your ass and will be always 6 Bytes. Forget, not now, world is going mad and packing behaves differently.
To fix it, it's needed to add -mno-ms-bitfields gcc option since version 4.7.0.
But not at all systems. DJGPP 4.7.1 doesn't need it. But mingw32 and 64-bit linux gcc yes. More at https://lists.gnu.org/archive/html/qemu-devel/2012-07/msg02240.html

---
DOS gives me freedom to unlimited HW access.

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 238 users online (0 registered, 238 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum