More inline arm assembly woes... (long)
Dan Kegel
dank@kegel.com
Tue Oct 21 23:37:00 GMT 2003
Bryce Schober wrote:
> int main() {
>
> float float_a, float_b;
> INT_32 int_a, int_b, result;
> ...
> int_a = int_rand[0];
> int_b = int_rand[1];
> result = fixp_mul_32u_n16( int_a, int_b );
> int_a = int_rand[2];
> int_b = int_rand[3];
> result = result + fixp_mul_32u_n16( int_a, int_b );
>
> /* Loop forever */
> while(1) { GPIOC->dr ^= 0x08; }
Yup, gcc will optimize away 'result'. Declare it outside
main, and/or make it volatile, and gcc will keep it around.
- 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
More information about the crossgcc
mailing list