Probably,
this is not documented, but I'll check.
The following will work.
const unsigned char __attribute__ ((aligned(2))) MyMAC[] =
{
MYMAC_1, MYMAC_2, MYMAC_3,
MYMAC_4, MYMAC_5, MYMAC_6
};
~d
P.S. just checked. yes, documented :) But anyway, I'll make an extra check
within gcc to make sure that all data are aligned properly.
On Wednesday 18 December 2002 02:00, Victor Antonovich wrote:
> Hello!
>
> When I trying to compile EasyWeb source code I found thing which
> looks like a bug.
>
> We have next constructions in the sources:
>
> --8<-----------------------------------------------------------------
> ...
> #define MYMAC_1 0x00 // our ethernet (MAC)
> address #define MYMAC_2 0xC0 // (MUST be unique
> in LAN!) #define MYMAC_3 0x26
> #define MYMAC_4 0xF1
> #define MYMAC_5 0x12
> #define MYMAC_6 0x34
>
> const unsigned char MyMAC[] = // "M1-M2-M3-M4-M5-M6"
> {
> MYMAC_1, MYMAC_2, MYMAC_3,
> MYMAC_4, MYMAC_5, MYMAC_6
> };
> ...
> memcpy(&TxFrame2[ARP_SENDER_HA_OFS], &MyMAC, 6);
> ...
> --8<-----------------------------------------------------------------
>
> Compiled code:
>
> --8<-----------------------------------------------------------------
> ...
> 0000116d <MyMAC>:
> 116d: 00 c0
> 116f: 26 f1
> 1171: 12 34
> ...
> 1c1c: 3f 40 6d 11 mov #4461, r15 ;#0x116d
> 1c20: b2 4f 06 02 mov @r15+, &0x0206 ;
> 1c24: b2 4f 08 02 mov @r15+, &0x0208 ;
> 1c28: b2 4f 0a 02 mov @r15+, &0x020a ;
> ...
> --8<-----------------------------------------------------------------
>
> It doesn't work (at least, inside my board :)! 0x116d is odd value
> and word moving (@r15+) will not work correctly there, isn't it?
>
> This looks like incorrect optimization result.
>
> Victor ANTONOVICH mailto:[email protected]
> 2:5055/124...@fidonet
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:
> With Great Power, Comes Great Responsibility
> Learn to use your power at OSDN's High Performance Computing Channel
> http://hpc.devchannel.org/
> _______________________________________________
> Mspgcc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
--
/********************************************************************
("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
`6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys
(_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44
_..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
(il),-'' (li),' ((!.-' +7 (812) 3468202, 5585314
********************************************************************/