/*--------------------------------------------------------------------*/
-/* ptrPseudoSymSafe - check to see if the convertion of the result of */
+/* ptrPseudoSymSafe - check to see if the conversion of the result of */
/* a pointerGet of a rematerializable pointer to a pseudo symbol is */
/* safe. Returns true if safe, or false if hazards were detected. */
/*--------------------------------------------------------------------*/
ptrPseudoSymConvert (symbol *sym, iCode *dic, char *name)
{
symbol *psym = newSymbol (name, 1);
- psym->type = sym->type;
- psym->etype = sym->etype;
psym->psbase = ptrBaseRematSym (OP_SYMBOL (IC_LEFT (dic)));
-
+ psym->type = sym->type;
+ psym->etype = psym->psbase->etype;
+
strcpy (psym->rname, psym->name);
sym->isspilt = 1;
sym->usl.spillLoc = psym;
--- /dev/null
+/*
+ bug1536762.c
+*/
+
+#include <testfwk.h>
+#include <string.h>
+#include <stdint.h>
+
+xdata uint8_t c = 1;
+
+struct d {
+ xdata struct d *n;
+ uint8_t f;
+ uint8_t s;
+ xdata uint8_t *buffer;
+ uint16_t length;
+};
+
+
+xdata struct d xd = {&xd, 1, 0xab, &c, 3};
+
+
+struct {
+ xdata struct d *c;
+ int16_t count;
+ xdata uint8_t *bptr;
+} s = {&xd, -1, &c};
+
+
+void blurb(void)
+{
+ if (s.count < 0) {
+ s.c->s = 0xef;
+ s.count = s.c->length - 1;
+ s.bptr = s.c->buffer;
+ }
+ *s.bptr = 0;
+ s.bptr++;
+ s.count--;
+}
+
+
+void
+testBug(void)
+{
+ ASSERT(xd.s == 0xab);
+ ASSERT(s.c->s == 0xab);
+
+ s.c->s = 0xcd;
+
+ ASSERT(xd.s == 0xcd);
+ ASSERT(s.c->s == 0xcd);
+
+ blurb();
+
+ ASSERT(xd.s == 0xef);
+ ASSERT(s.c->s == 0xef);
+ ASSERT(c == 0);
+}
+