Hi,
first things first, here's an output of arm-wince-mingw32ce-gcc -v:
Using built-in specs.
Target: arm-wince-mingw32ce
Configured with: /usr/src/rpm/BUILD/cegcc-mingw32ce-0.50/src/gcc/configure
--with-gcc --with-gnu-ld --with-gnu-as --target=arm-wince-mingw32ce
--prefix=/opt/mingw32ce --enable-threads=win32 --disable-nls
--enable-languages=c,c++ --disable-win32-registry --disable-multilib
--disable-interwork --without-newlib --enable-checking --with-headers
Thread model: win32
gcc version 4.1.0
I can't tell where I got the packages from because, frankly, I don't
remember ;)
Now a bit about the problem.
Casting a char* into uint32_t*, unsigned int* or int* and then using it
with operator [] in both GCC and G++ crashes the application.
memcpying and then using it works.
Nonworking code:
char a[50], c[255];
uint32_t *b;
b = (uint32_t*)a;
a[0] = 0;
a[1] = 0;
a[2] = 0;
a[3] = 1;
sprintf(c, "%ld", b[0]);
Working code:
char a[50], c[255];
uint32_t *b;
b = malloc(50);
a[0] = 0;
a[1] = 0;
a[2] = 0;
a[3] = 1;
memcpy(b, a, 4);
sprintf(c, "%ld", b[0]);
free(b);
This is a very ugly fix I had to made to the application, and it was very
hard to track the problem down (especially because WINCE isn't my main
target platform, I haven't forced myself to learn to use GDB on it, and I
obviously don't have an emulator since I use GNU/Linux any pointers?)
If this has been fixed already, please tell me so and I'll upgrade.
------------
Ivan Vucica
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Cegcc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cegcc-devel