🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #50520

gcc-1.40 bit map field access question

#50520
From: Jayne Johnson
Date: Mon, 20 Sep 1993 02:26
56 lines
2603 bytes
I am using gcc-1.40 with the following switches : -O -m68030  
I have noticed the following behaviour of the compiler when I defined
a bit map structure as the following:

union CONTROL_REG
{
    unsigned int reg;
    struct 
    {
       unsigned unused4    8;
       unsigned unused3    8;
       unsigned unused2    8;
       unsigned bit7       1;
       unsigned bit6       1;
       unsigned bit5       1;
       unsigned bit4       1;
       unsigned bit3       1;
       unsigned bit2       1;
       unsigned bit1       1;
       unsigned bit0       1;
     }bits;
 }

Now in my code:

I define a local variable
union CONTROL_REG creg;

I perform a bit assignment to the control register :
creg.bits.bit2 = OFF;

I noticed that the assembly language used a MOVE.B to access
the variable in memory. What I want is this structure to be
accessed as an unsigned int NOT a byte structure. My VME custom
board's VME decoder does not allow byte accesses. 

My question to you learned folks is there a switch or preprocessor
statement I should use in order to make this an unsigned int access?
You should be alerted I have tried some of the macros like
STRUCTURE_SIZE_.... (pardon me I am using my memory and do not have
my manuals at my home ), to try to force the compiler to obey the 
alignment rules of this structure.

Is there something special about bit assignments and the M68000 family
with the gcc compiler?

I am in dire straights. I need access to a gcc manual but also do not
have one on my workstation . It seems gcc-1.40 is pretty old. We are
not ready to upgrade.... I appreciate any clues to this mystery. Please
respond to the following email addresses. Again, my thanks for your 
help. I will forward any solutions to this news group....

Jayne F. Johnson
Realtime System Solutions,Inc.
email: jayne@access.digex.net 
       johnson@interf.com
Technical Details
Message-ID: <27j4d1$sri@access.digex.net>
Path: arc1-ca.pugleaf.net!gmd.de!rrz.uni-koeln.de!unidui!math.fu-berlin.de!xlink.net!sol.ctr.columbia.edu!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!digex.net!digex.net!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,b56cef0d3851818d,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-09-19 19:58:19 PST
Path: arc1-ca.pugleaf.net!gmd.de!rrz.uni-koeln.de!unidui!math.fu-berlin.de!xlink.net!sol.ctr.columbia.edu!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!digex.net!digex.net!not-for-mail
From: jayne@access.digex.net (Jayne Johnson)
Newsgroups: gnu.gcc.help
Subject: gcc-1.40 bit map field access question
Date: 19 Sep 1993 22:26:41 -0400
Organization: Express Access Online Communications, Greenbelt, MD USA
Lines: 59
Distribution: usa
Message-ID: <27j4d1$sri@access.digex.net>
NNTP-Posting-Host: access.digex.net