Loading libacc/acc.cpp +81 −91 Original line number Diff line number Diff line Loading @@ -1467,17 +1467,12 @@ class Compiler : public ErrorSink { if (pA->tag == TY_ARRAY && pB->tag == TY_POINTER) { pA = pA->pTail; } if (typeEqual(pA, pB)) { return; // OK } if (pB->pHead->tag == TY_VOID) { return; // convert to void* is OK. } if (pA->tag == TY_POINTER && pB->tag == TY_POINTER && isCast) { return; // OK } if (! (typeEqual(pA, pB) || pB->pHead->tag == TY_VOID || (pA->tag == TY_POINTER && pB->tag == TY_POINTER && isCast) )) { error("Incompatible pointer or array types"); } } else if (bitsSame(pType, pR0Type)) { // do nothing special } else { Loading Loading @@ -2608,17 +2603,12 @@ class Compiler : public ErrorSink { if (pA->tag == TY_ARRAY && pB->tag == TY_POINTER) { pA = pA->pTail; } if (typeEqual(pA, pB)) { return; // OK } if (pB->pHead->tag == TY_VOID) { return; // convert to void* is OK. } if (pA->tag == TY_POINTER && pB->tag == TY_POINTER && isCast) { return; // OK } if (! (typeEqual(pA, pB) || pB->pHead->tag == TY_VOID || (pA->tag == TY_POINTER && pB->tag == TY_POINTER && isCast) )) { error("Incompatible pointer or array types"); } } else if (bitsSame(pType, pR0Type)) { // do nothing special } else if (isFloatType(pType) && isFloatType(pR0Type)) { Loading libacc/tests/data/b2071670.c 0 → 100644 +9 −0 Original line number Diff line number Diff line // See http://b/2071670 int main() { float f = 10.0f; float* floatPointer = &f; // The following line used to incorrectly error: "Incompatible pointer or array types" int* buffer = (int*) floatPointer; return *buffer; } libacc/tests/test.py +6 −0 Original line number Diff line number Diff line Loading @@ -458,6 +458,12 @@ result: 3 result: 4 ""","""""") def testB2071670(self): self.compileCheck(["-R", "data/b2071670.c"], """Executing compiled code: result: 1092616192 ""","""""") def main(): checkEnvironment() parseArgv() Loading Loading
libacc/acc.cpp +81 −91 Original line number Diff line number Diff line Loading @@ -1467,17 +1467,12 @@ class Compiler : public ErrorSink { if (pA->tag == TY_ARRAY && pB->tag == TY_POINTER) { pA = pA->pTail; } if (typeEqual(pA, pB)) { return; // OK } if (pB->pHead->tag == TY_VOID) { return; // convert to void* is OK. } if (pA->tag == TY_POINTER && pB->tag == TY_POINTER && isCast) { return; // OK } if (! (typeEqual(pA, pB) || pB->pHead->tag == TY_VOID || (pA->tag == TY_POINTER && pB->tag == TY_POINTER && isCast) )) { error("Incompatible pointer or array types"); } } else if (bitsSame(pType, pR0Type)) { // do nothing special } else { Loading Loading @@ -2608,17 +2603,12 @@ class Compiler : public ErrorSink { if (pA->tag == TY_ARRAY && pB->tag == TY_POINTER) { pA = pA->pTail; } if (typeEqual(pA, pB)) { return; // OK } if (pB->pHead->tag == TY_VOID) { return; // convert to void* is OK. } if (pA->tag == TY_POINTER && pB->tag == TY_POINTER && isCast) { return; // OK } if (! (typeEqual(pA, pB) || pB->pHead->tag == TY_VOID || (pA->tag == TY_POINTER && pB->tag == TY_POINTER && isCast) )) { error("Incompatible pointer or array types"); } } else if (bitsSame(pType, pR0Type)) { // do nothing special } else if (isFloatType(pType) && isFloatType(pR0Type)) { Loading
libacc/tests/data/b2071670.c 0 → 100644 +9 −0 Original line number Diff line number Diff line // See http://b/2071670 int main() { float f = 10.0f; float* floatPointer = &f; // The following line used to incorrectly error: "Incompatible pointer or array types" int* buffer = (int*) floatPointer; return *buffer; }
libacc/tests/test.py +6 −0 Original line number Diff line number Diff line Loading @@ -458,6 +458,12 @@ result: 3 result: 4 ""","""""") def testB2071670(self): self.compileCheck(["-R", "data/b2071670.c"], """Executing compiled code: result: 1092616192 ""","""""") def main(): checkEnvironment() parseArgv() Loading