Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1013 Division failure...

closed
nobody
5
2005-11-22
2005-11-13
grasbon
No

Version:
SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
2.5.4 #1149 (Nov 7 2005) (MINGW32)
Call:
sdcc --stack-auto Main.c

In the following code, 'r' gets a wrong
value of 255.

Here's the Main.c:

-------------------------
#include <8052.h>

void main(void)
{
unsigned char v;
unsigned char* p;
unsigned char r;

v = 0;
p = &v;
r = ((*p)+1)/10;

while( 1 )
{
P0 = r; // Wrong value 255
}
}
-------------------------

Have a look in Main.asm. Maybe a problem
somewhere around the "divsint"-call?

Reimar Grasbon

Discussion

  • grasbon
    grasbon
    2005-11-13

     
    Attachments
  • remarc
    remarc
    2005-11-13

    Logged In: YES
    user_id=1375403

    I didn't see your bug report before I submitted mine just
    now, but it looks very similar. If your code is compiled
    without --stack-auto the results are OK.

    Regards,
    Jim

     
  • Maarten Brock
    Maarten Brock
    2005-11-14

    Logged In: YES
    user_id=888171

    Have you recompiled the libraries with --stack-auto? If not
    then do so. See also the manual.

     
  • Logged In: NO

    I'm missing a makefile for the sdcclib-calls.

     
  • grasbon
    grasbon
    2005-11-22

    • status: open --> closed