View Issue Details

IDProjectCategoryView StatusLast Update
0029128FPCCompilerpublic2021-02-21 22:54
ReporterBernd Assigned ToJeppe Johansen  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformAVROSembedded 
Product Version3.1.1 
Target Version3.1.1 
Summary0029128: AVR, problem with mod/div operators
DescriptionThe attached program executes line 13 (CurrentDigit:= ...) only one time. The second time, the cpu (ATMega128) remains/crashes somwhere in the rtl. Unfortunately, I have no debugger to give more details.

Compiler/rtl built with fpc 3.0.0
make crosszipinstall CPU_TARGET=avr OS_TARGET=embedded SUBARCH=avr51

program compiled with:
avr-embedded-fpc -Wpatmega128 -O2 -Cpavr51 -al test.pas


TagsAVR
Fixed in Revision32589
FPCOldBugId
FPCTarget
Attached Files

Activities

Bernd

2015-12-02 15:14

reporter  

test.pas (496 bytes)   
Program Test;
{$mode objfpc}{$H-}
        
procedure Nirvana;
var
   Value, ModVar, DivVar, CurrentDigit: Integer;
begin
   Value:= 5;
   ModVar:= 10000;
   DivVar:= 1000;
   repeat
      // LED_On;
      CurrentDigit:= (Value mod ModVar) div DivVar;
      // wont't reach this point a second time
      // LED_Off;
      ModVar:= ModVar div 10;
      DivVar:= DivVar div 10;
   until ModVar = 1;   
end;

begin
   // InitLED;
   Nirvana;
   repeat
   until FALSE;
end.
test.pas (496 bytes)   

Jeppe Johansen

2015-12-05 23:58

developer   ~0087807

Can you retest with the latest trunk?

Bernd

2015-12-07 10:28

reporter   ~0087831

it is working now with revision 32605. Thank you.

Issue History

Date Modified Username Field Change
2015-12-02 15:14 Bernd New Issue
2015-12-02 15:14 Bernd File Added: test.pas
2015-12-03 13:54 Simon Ameis Tag Attached: AVR
2015-12-05 23:58 Jeppe Johansen Note Added: 0087807
2015-12-07 10:28 Bernd Note Added: 0087831
2015-12-07 20:43 Jeppe Johansen Fixed in Revision => 32589
2015-12-07 20:43 Jeppe Johansen Status new => resolved
2015-12-07 20:43 Jeppe Johansen Resolution open => fixed
2015-12-07 20:43 Jeppe Johansen Assigned To => Jeppe Johansen
2015-12-07 20:43 Jeppe Johansen Target Version => 3.1.1