The fragment:- module Size; var BoolVar: Boolean;
procedure fred; begin BoolVar := True; end; {fred} end. {module}
produces the following 68k code (from 20010623). Should the .lcomm line not be .lcomm Boolvar,1, or is the compiler saying that byte alignment is really horrid and is trying to avoid it?
.file "size.p" gcc2_compiled.: __gnu_compiled_pascal: .lcomm Boolvar,2 .text .even Fred: link.w %a6,#0 move.b #1,Boolvar .L2: unlk %a6 rts
Loris Caren wrote:
The fragment:- module Size; var BoolVar: Boolean;
procedure fred; begin BoolVar := True; end; {fred} end. {module}
produces the following 68k code (from 20010623). Should the .lcomm line not be .lcomm Boolvar,1, or is the compiler saying that byte alignment is really horrid and is trying to avoid it?
I don't know much about m68k. Perhaps on that processor byte-misalignment is really bad. On IA32 which I'm on now, it's not so bad (because of its 8 bit history), and BoolVar is indeed byte aligned there.
Frank
On 2 Oct 2001, at 1:41, Frank Heckenbach wrote:
I don't know much about m68k. Perhaps on that processor byte-misalignment is really bad.
A requirement on some, but not all, 68K processors is that sized accesses must begin on a boundary corresponding to the size. For example, byte accesses may begin on any byte boundary, word accesses must begin on even byte boundaries, etc. On those 68K processors allowing misaligned accesses, speed penalties are imposed. Those not allowing misaligned access will respond with a processor exception.
Byte accesses may begin on any byte boundary without penalty.
However, the issue doesn't appear to be a boundary question, but rather a question of the size allocated for a Boolean. The ".lcomm Boolvar,2" statement is allocating two bytes for the Boolean variable, although only the upper byte is begin used with "move.b #1,Boolvar" (the 68K is a big- endian machine).
On IA32 which I'm on now, it's not so bad (because of its 8 bit history), and BoolVar is indeed byte aligned there.
Is this a gcc or a gpc issue? If it's a gpc issue, it would seem to me that Booleans should be specified as requiring one byte on 68K machines.
-- Dave