Strange results

General discussion on mikroPascal PRO for PIC32.
Post Reply
Author
Message
Skydec
Posts: 39
Joined: 30 Jan 2009 12:38

Strange results

#1 Post by Skydec » 20 Mar 2013 11:55

I have used this compiler for my first project (used the pic pro compiler for the pic24 many more, also there I get sometimes strange result, but not as bad as this compiler), but I think it's very buggy.

I'm using several interrupts and strangely enough when I change optimize to another level then 4 the program will crash.

Also I made a some floating point calculation converting it back to 2 words, I do that twice right between each other (exactly the same code) but the outcome is different. (what should be impossible)

When I pass variables to a procedure, the program gets unstable, when I use global variables with the same procedure, but not passing it to the variables, it is more stable.
It seems like the compiler makes a mess of the stack..

the piece of code with different result is paste below:

Code: Select all

  TPos:=TPos*(extended(1930464.7111111111));
  if (TPos >= 0) then
  begin
    DPos := dword(TPos);
  end
  else
  begin
    TPos:=TPos*-1;
    DPos := dword(TPos);
    //DPos := ((DPos xor $FFFFFFFF)+1) and $FFFFFFFF;
    DPos := not(DPos);
    DPos := LoDword(DPos);
    DPos := DPos + 1;
  end;
  LATLONWord1 := HiWord(Dpos);
  LATLONWord2 := LoWord(Dpos);
Tpos is a extended, dpos is dword;

When running this twice with the same value for tpos LATLONWord1 and LATLONWord2 have different values.

Also code in a dummy procedure (never get called) can make the program crash (when commented out all lines in the procedure will get a running program, otherwise it will crash right away)

Update:
I have upgraded to 3.0.0 that gave even worse result, program crashes right away.
After downgraded to 2.5.5 the same code (same settings) runs stable, only with some strange outcome (see above)
Changing optimize in version 2.5.5 won't change anything on the stability.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Strange results

#2 Post by filip » 26 Jun 2013 12:51

Hi,

Please, can you attach here the minimal project that can be compiled, so I can reproduce this issue ?

Regards,
Filip.

Post Reply

Return to “mikroPascal PRO for PIC32 General”