byte access in MC68k

Robin Kirkham rjk@magni.mlb.dmt.csiro.au
Thu Jun 19 18:26:00 GMT 1997


> Reply-To: Jens Doege <doege@ljk.atsugi.asahi-kasei.co.jp>
>
> Is there a switch for gcc (68k) to force it not to use byte (char)
> operations?
> (I couldn't find something like this)
> All the variables I use are at least short. Nevertheless the compiler
> detects that from some variables just the lower byte is used:
> 	if((ist & SW_SRI) != SW_SRI){...}

You should use the `volatile' qualifier for these variables, i.e.

    volatile unsigned short ist;


> In the ready code 
> 	move.b -11(%a6),%d0
> 	and.b #128,%d0
> 	tst.b %d0
> odd memory addresses are accessed which causes really big trouble for my
> system. In the given case the preprocessor reduces
>       #define SW_SRI 0x00f0
> to just 0xf0. A precompilier switch to prevent that whould also be
> possible. 

This would make no difference, as it is the code generator that is doing 
this optimisation, not the preprocessor.

> Thanks in advance
> Jens

Robin Kirkham			CSIRO Division of Manufacturing Technology
Project Engineer		Locked Bag 9, Preston 3072, Australia
robin.kirkham@mlb.dmt.csiro.au	Phone: +61 3 9662-7756  Fax: +61 3 9662-7853



More information about the crossgcc mailing list