On Thu, 2005-09-22 at 14:48 +0100, Peter Onion wrote:
> Thanks Raphael, I'll give it another try and send you anything I can
> find.
>
OK I've tracked down the source code that causes the optimisation to
crash....
#include "stdio.h"
#include "stdlib.h"
#include "malloc.h"
#pragma stack 0x500 255
/* Memory for malloc and friends */
unsigned char _MALLOC_SPEC heap[MAX_HEAP_SIZE];
struct testStruct
{
int n;
struct testStruct *next;
};
void main(void)
{
struct testStruct *ts;
ts = (struct testStruct *) malloc(sizeof(struct testStruct));
ts->next = NULL; /* <<<<< CRASHES THE OPTIMISER */
}
It seems the problem is assigning a constant to the next field in the
structure.
If for example I change it to "ts->next = ts" then it compiles OK.
I ran sdcc under gdb, but the backtrace complained about a corrupt
stack !
Peter.
|