This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Output file size?


Kai Ruottu wrote:
 One known bug? with the targets capable to do bit operations directly
with the data in memory places, like m68k, h8300, h8500 and v850, is the
so called 'volatile bug'. The following example should demonstrate this:

------------------- clip ------------------------------
void write_device1(unsigned char *addr, int val)
{
        unsigned char *ptr = addr;
        *ptr = val;
}

void write_device2(volatile unsigned char *addr, int val)
{
        volatile unsigned char *ptr = addr;
        *ptr = val;
}
------------------- clip ------------------------------

The produced code for both cases should of course be the same:

------------------- clip ------------------------------
/home1/kai/test/m68k > gcc-cpu32-elf-3.3 -Os -fomit-frame-pointer -S \
-o volatbug.s volatbug.c
/home1/kai/test/m68k > less volatbug.s
        .file   "volatbug.c"
        .text
        .align  2
        .globl  write_device1
        .type   write_device1, @function
write_device1:
        move.l 4(%sp),%a0
        move.b 11(%sp),(%a0)
        rts
        .size   write_device1, .-write_device1
        .align  2
        .globl  write_device2
        .type   write_device2, @function
write_device2:
        move.l 4(%sp),%a0
        move.b 11(%sp),(%a0)
        rts
        .size   write_device2, .-write_device2
        .ident  "GCC: (GNU) 3.3.1"
------------------- clip ------------------------------

And it appears to be. What's the bug? - Dan

--
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045


------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]