X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Favr%2Fgen.c;h=06c7476a5c142b29bdc24215c922da173701b10b;hb=19eb37fd0abc83f9e2491a3f9ac2033363954852;hp=651dab24039a843048a1072a0fc72193942024e8;hpb=4d711df34233a47f093f6d6a3e8840b17d577887;p=fw%2Fsdcc diff --git a/src/avr/gen.c b/src/avr/gen.c index 651dab24..06c7476a 100644 --- a/src/avr/gen.c +++ b/src/avr/gen.c @@ -4945,8 +4945,6 @@ genCast (iCode * ic) /* pointer to generic pointer */ if (IS_GENPTR (ctype)) { - char *l = zero; - if (IS_PTR (type)) p_type = DCL_TYPE (type); else { @@ -4962,30 +4960,22 @@ genCast (iCode * ic) aopGet (AOP (right), offset), offset); offset++; } - /* the last byte depending on type */ - switch (p_type) { - case IPOINTER: - case POINTER: - l = zero; - break; - case FPOINTER: - l = one; - break; - case CPOINTER: - l = "0x02"; - break; - case PPOINTER: - l = "0x03"; - break; - - default: - /* this should never happen */ - werror (E_INTERNAL_ERROR, __FILE__, __LINE__, - "got unknown pointer type"); - exit (1); + + /* the last byte depending on type */ + { + int gpVal = pointerTypeToGPByte(p_type, NULL, NULL); + char gpValStr[10]; + + if (gpVal == -1) + { + // pointerTypeToGPByte will have bitched. + exit(1); } - aopPut (AOP (result), l, GPTRSIZE - 1); - goto release; + + sprintf(gpValStr, "#0x%d", gpVal); + aopPut (AOP (result), gpValStr, GPTRSIZE - 1); + } + goto release; } /* just copy the pointers */