to a char variable
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4215
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2006-06-11 Vangelis Rokas <vrokas AT users.sourceforge.net>
+
+ * src/pic16/gen.c (genCast): fixed bug with assignment of a pointer
+ to a char variable
+
2006-06-10 Borut Razem <borut.razem AT siol.net>
* CVSROOT: removed the CVS left-over
2006-06-10 Borut Razem <borut.razem AT siol.net>
* CVSROOT: removed the CVS left-over
// char *rs;
pCodeOp *pcop;
// char *rs;
pCodeOp *pcop;
- FENTRY2;
- /* offset is greater than
- * size then zero */
+ FENTRY2;
+
+ /* offset is greater than size then zero */
// if (offset > (aop->size - 1) &&
// aop->type != AOP_LIT)
// if (offset > (aop->size - 1) &&
// aop->type != AOP_LIT)
case AOP_REG:
{
int rIdx;
case AOP_REG:
{
int rIdx;
- assert (aop && aop->aopu.aop_reg[offset] != NULL);
+
+// debugf2("aop = %p\toffset = %d\n", aop, offset);
+// assert (aop && aop->aopu.aop_reg[offset] != NULL);
rIdx = aop->aopu.aop_reg[offset]->rIdx;
DEBUGpic16_emitcode(";","%d\tAOP_REG", __LINE__);
rIdx = aop->aopu.aop_reg[offset]->rIdx;
DEBUGpic16_emitcode(";","%d\tAOP_REG", __LINE__);
- fprintf(stderr, "SDCC pic16 port error: the port currently does not support\n");
+ fprintf(stderr, "SDCC pic16 port error: the port currently does not support *reading*\n");
fprintf(stderr, "bitfields of size >=8. Instead of generating wrong code, bailling out...\n");
exit(-1);
fprintf(stderr, "bitfields of size >=8. Instead of generating wrong code, bailling out...\n");
exit(-1);
if ((AOP_TYPE(right) == AOP_PCODE) && AOP(right)->aopu.pcop->type == PO_IMMEDIATE) {
pic16_emitpcode(POC_MOVLW, pic16_popGet(AOP(right),0));
pic16_emitpcode(POC_MOVWF, pic16_popGet(AOP(result),0));
if ((AOP_TYPE(right) == AOP_PCODE) && AOP(right)->aopu.pcop->type == PO_IMMEDIATE) {
pic16_emitpcode(POC_MOVLW, pic16_popGet(AOP(right),0));
pic16_emitpcode(POC_MOVWF, pic16_popGet(AOP(result),0));
- pic16_emitpcode(POC_MOVLW, pic16_popGet(AOP(right),1));
- pic16_emitpcode(POC_MOVWF, pic16_popGet(AOP(result),1));
- if(AOP_SIZE(result) <2)
- fprintf(stderr,"%d -- result is not big enough to hold a ptr\n",__LINE__);
+
+ if(AOP_SIZE(result) < 2) {
+ fprintf(stderr,"%d -- casting a ptr to a char\n",__LINE__);
+ } else {
+ pic16_emitpcode(POC_MOVLW, pic16_popGet(AOP(right),1));
+ pic16_emitpcode(POC_MOVWF, pic16_popGet(AOP(result),1));
+ }
} else {
/* if they in different places then copy */
size = AOP_SIZE(result);
} else {
/* if they in different places then copy */
size = AOP_SIZE(result);