Hi, Your problem is that "mybuffer" is an unused local variable - the compiler can therefore eliminate it entirely when optimising.
If you write code that uses mybuffer in some way (that can't be optimised away), then it should work fine. mvh., David On 26/06/14 09:48, Kees Schoenmakers wrote: >> Hello, >> >> I experienced some odd effect when msp430-gcc tries to inline >> memcpy and/or memset. >> >> the code >> >> #include <stdint.h> >> >> void test_memcpy(void) { uint8_t mybuffer[10]; >> memset((uint8_t*)&mybuffer, 0, 10); } >> >> when compiled with msp430-gcc -c -O2 -mmcu=msp430f449 >> mspgcc_memcpy.c results in >> >> Disassembly of section .text: >> >> 00000000 <test_memcpy>: 0: 31 50 f6 ff add #-10, r1 >> ;#0xfff6 4: 81 43 06 00 mov #0, 6(r1) ;r3 As==00, >> 0x0006(r1) 8: 81 43 08 00 mov #0, 8(r1) ;r3 As==00, >> 0x0008(r1) c: 31 50 0a 00 add #10, r1 ;#0x000a >> 10: 30 41 ret >> >> In my opion thats not clearing 10 bytes.... Without optimation the >> code appears sound. >> >> msp430-gcc (GCC) 4.7.0 20120322 (mspgcc dev 20120911) Copyright (C) >> 2012 Free Software Foundation, Inc. This is free software; see the >> source for copying conditions. There is NO warranty; not even for >> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. >> >> Same size problem I noticed with memcpy if inlined.... >> >> best regards >> >> Kees >> >> ------------------------------------------------------------------------------ >> >> Open source business process management suite built on Java and Eclipse >> Turn processes into business applications with Bonita BPM Community >> Edition Quickly connect people, data, and systems into organized >> workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards >> http://p.sf.net/sfu/Bonitasoft >> > ------------------------------------------------------------------------------ Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users