This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Why does the Keil compiler generate bad code for the DS400C80?

The following code:
fwsUniChar c;
fwsUniChar *temp;

temp=p->inPtr;
c = *temp;
temp++;
p->inPtr = temp;
correctly increments the pointer p by 0x01


instead of
fwsUniChar c = p->inPtr++;
which incorrectly increments the pointer p by 0x101
This code compiles and runs correctly with ANSI C compilers



Also
routine1() reentrant
{
enum ElementTagType type;

routine2(&type);
}

routine2(enum ElementTagType *type)
{
type = START_TAG;
}


does not work (i.e. type in routine1 is not set to START_TAG after calling routine 2.

There is a default XBPSTACK

Any Ideas

Thanks

Barry

Parents
  • I tried to duplicate the first problem using the following example code and couldn't:

    struct info_st
      {
      char *ptr;
      int  number_1;
      long number_2;
      };
    
    char junk[] = "1234567890";
    
    char *check_struct_ptr_inc (struct info_st *p)
    {
    volatile char c;
    c = *p->ptr++;
    return (c);
    }
    
    void main (void)
    {
    struct info_st ppp = { junk, 12, 123456789L };
    check_struct_ptr_inc (&ppp);
    while (1);
    }

    I tried this in LARGE, 512K Contiguous, and 16M Contiguous ROM models and the program ran just fine.

    I used C51 V7.06a from the update section of the web site.

    Jon

Reply
  • I tried to duplicate the first problem using the following example code and couldn't:

    struct info_st
      {
      char *ptr;
      int  number_1;
      long number_2;
      };
    
    char junk[] = "1234567890";
    
    char *check_struct_ptr_inc (struct info_st *p)
    {
    volatile char c;
    c = *p->ptr++;
    return (c);
    }
    
    void main (void)
    {
    struct info_st ppp = { junk, 12, 123456789L };
    check_struct_ptr_inc (&ppp);
    while (1);
    }

    I tried this in LARGE, 512K Contiguous, and 16M Contiguous ROM models and the program ran just fine.

    I used C51 V7.06a from the update section of the web site.

    Jon

Children