Update of bug #34278 (project avr-libc): Status: Need Info => Invalid Assigned to: None => joerg_wunsch Open/Closed: Open => Closed
_______________________________________________________ Follow-up Comment #2: Thanks for the archive, now I finally see the problem. Sorry for being blind in the first place. The compiler is correct. The code is: // Delay in 1/10's of a millisecond void msleep(INT16U ms) { /* This loop does not work with optimization != 0. Therefore we use avr-libc _delay routines K. Schwichtenberg INT16S i,j; for (i = 1; i < ms; i++) for (j = 1; j < ONETENTH_MS; j++); / * to give 1/10 ms*/ _delay_ms(ms); // Changed K. Schwichtenberg } Thus, _delay_ms() is called with "ms" which is a function parameter. This is not supported (and has never been, but with the current implementation, you finally get an error while the code simply didn't do what it was expected to do before). A correct (with respect to what the comment above the function says) implementation would look like: // Delay in 1/10's of a millisecond void msleep(INT16U ms) { while (ms-- != 0) _delay_ms(0.1); } In addition (and unlike the original comment), optimization _must_ be turned on for any of the _delay_us/ms functions to work correctly. _______________________________________________________ Reply to this item at: <http://savannah.nongnu.org/bugs/?34278> _______________________________________________ Message sent via/by Savannah http://savannah.nongnu.org/ _______________________________________________ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-libc-dev