https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94548
Bug ID: 94548 Summary: [AVR] Part of the code seems to have disappeared in the elf Product: gcc Version: 9.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: fabrice.salvaire at orange dot fr Target Milestone: --- For this code ### unsigned long int ### ml_per_h_to_timer_value(int desired_ml_per_h, int syringe_step_per_ml) { ### unsigned long int timer = 0; ### timer = ((31.2500 * 3600000UL) / ((unsigned long) desired_ml_per_h * (unsigned long) syringe_step_per_ml)); ### #ifdef DEBUG_PROCESS ### Serial.println("********************* TIMER VALUE *********************"); ### Serial.println(timer); ### #endif ### return (timer); ### } I got ### unsigned long int ### ml_per_h_to_timer_value(int desired_ml_per_h, int syringe_step_per_ml) { ### 9cc: cf 92 push r12 ### 9ce: df 92 push r13 ### 9d0: ef 92 push r14 ### 9d2: ff 92 push r15 ### unsigned long int timer = 0; ### timer = ((31.2500 * 3600000UL) / ((unsigned long) desired_ml_per_h * (unsigned long) syringe_step_per_ml)); ### 9d4: 9c 01 movw r18, r24 ### 9d6: db 01 movw r26, r22 ### 9d8: 0e 94 7f 1d call 0x3afe ; 0x3afe <__mulhisi3> ### 9dc: 0e 94 bb 1c call 0x3976 ; 0x3976 <__floatunsisf> ### 9e0: 9b 01 movw r18, r22 ### 9e2: ac 01 movw r20, r24 ### 9e4: 64 ea ldi r22, 0xA4 ; 164 ### 9e6: 73 e9 ldi r23, 0x93 ; 147 ### 9e8: 86 ed ldi r24, 0xD6 ; 214 ### 9ea: 9c e4 ldi r25, 0x4C ; 76 ### 9ec: 0e 94 1a 1c call 0x3834 ; 0x3834 <__divsf3> ### 9f0: 0e 94 8c 1c call 0x3918 ; 0x3918 <__fixunssfsi> ### 9f4: 6b 01 movw r12, r22 ### 9f6: 7c 01 movw r14, r24 ### // timer = ((f0 * 3600000UL) / ((unsigned long) desired_ml_per_h * (unsigned long) syringe_step_per_ml)); ### #ifdef DEBUG_PROCESS ### Serial.println("********************* TIMER VALUE *********************"); ### 9f8: 83 ef ldi r24, 0xF3 ; 243 ### 9fa: 91 e0 ldi r25, 0x01 ; 1 ### 9fc: 0e 94 d3 04 call 0x9a6 ; 0x9a6 <Print::println(char const*) [clone .constprop.13]> ### else return printNumber(n, base); ### a00: 2a e0 ldi r18, 0x0A ; 10 ### a02: b7 01 movw r22, r14 ### a04: a6 01 movw r20, r12 ### a06: 83 e6 ldi r24, 0x63 ; 99 ### a08: 96 e0 ldi r25, 0x06 ; 6 ### a0a: 0e 94 5a 04 call 0x8b4 ; 0x8b4 <Print::printNumber(unsigned long, unsigned char)> ### a0e: 60 ef ldi r22, 0xF0 ; 240 ### a10: 71 e0 ldi r23, 0x01 ; 1 ### a12: 83 e6 ldi r24, 0x63 ; 99 ### a14: 96 e0 ldi r25, 0x06 ; 6 ### a16: 0e 94 4b 04 call 0x896 ; 0x896 <Print::write(char const*) [clone .part.2]> ### Serial.println(timer); ### #endif ### return (timer); ### } ### a1a: c7 01 movw r24, r14 ### a1c: b6 01 movw r22, r12 ### a1e: ff 90 pop r15 ### a20: ef 90 pop r14 ### a22: df 90 pop r13 ### a24: cf 90 pop r12 ### a26: 08 95 ret But ### unsigned long int ### ml_per_h_to_timer_value(int desired_ml_per_h, int syringe_step_per_ml) { ### unsigned long int timer = 0; ### const unsigned long int f0 = (8UL*10^6) / (1000*256UL); ### timer = ((f0 * 3600000UL) / ((unsigned long) desired_ml_per_h * (unsigned long) syringe_step_per_ml)); ### #ifdef DEBUG_PROCESS ### Serial.println("********************* TIMER VALUE *********************"); ### Serial.println(timer); ### #endif ### return (timer); ### } I got ### 000009cc <ml_per_h_to_timer_value(int, int) [clone .constprop.13]>: ### unsigned long int timer = 0; ### const unsigned long int f0 = (8UL*10^6) / (1000*256UL); ### // timer = ((31.2500 * 3600000UL) / ((unsigned long) desired_ml_per_h * (unsigned long) syringe_step_per_ml)); ### timer = ((f0 * 3600000UL) / ((unsigned long) desired_ml_per_h * (unsigned long) syringe_step_per_ml)); ### #ifdef DEBUG_PROCESS ### Serial.println("********************* TIMER VALUE *********************"); ### 9cc: 83 ef ldi r24, 0xF3 ; 243 ### 9ce: 91 e0 ldi r25, 0x01 ; 1 ### 9d0: 0e 94 d3 04 call 0x9a6 ; 0x9a6 <Print::println(char const*) [clone .constprop.14]> ### else return printNumber(n, base); ### 9d4: 2a e0 ldi r18, 0x0A ; 10 ### 9d6: 40 e0 ldi r20, 0x00 ; 0 ### 9d8: 50 e0 ldi r21, 0x00 ; 0 ### 9da: ba 01 movw r22, r20 ### 9dc: 83 e6 ldi r24, 0x63 ; 99 ### 9de: 96 e0 ldi r25, 0x06 ; 6 ### 9e0: 0e 94 5a 04 call 0x8b4 ; 0x8b4 <Print::printNumber(unsigned long, unsigned char)> ### 9e4: 60 ef ldi r22, 0xF0 ; 240 ### 9e6: 71 e0 ldi r23, 0x01 ; 1 ### 9e8: 83 e6 ldi r24, 0x63 ; 99 ### 9ea: 96 e0 ldi r25, 0x06 ; 6 ### 9ec: 0e 94 4b 04 call 0x896 ; 0x896 <Print::write(char const*) [clone .part.2]> ### Serial.println(timer); ### #endif ### return (timer); ### } ### 9f0: 60 e0 ldi r22, 0x00 ; 0 ### 9f2: 70 e0 ldi r23, 0x00 ; 0 ### 9f4: cb 01 movw r24, r22 ### 9f6: 08 95 ret If I am right this code return 0 and the division is gone.