diff --git a/SingleSource/Regression/C/Makefile b/SingleSource/Regression/C/Makefile --- a/SingleSource/Regression/C/Makefile +++ b/SingleSource/Regression/C/Makefile @@ -32,6 +32,10 @@ ConstructorDestructorAttributes \ DuffsDevice \ globalrefs \ + issue44994-1 \ + issue44994-2 \ + issue44994-3 \ + issue44994-4 \ matrixTranspose \ pointer_arithmetic \ PR10189 \ diff --git a/SingleSource/Regression/C/issue44994-1.c b/SingleSource/Regression/C/issue44994-1.c new file mode 100644 --- /dev/null +++ b/SingleSource/Regression/C/issue44994-1.c @@ -0,0 +1,71 @@ +#include + +union usBitIntUion { + unsigned int i; + unsigned long long a[4]; + unsigned _BitInt(256) b; +}; + +union usBitIntUion A,B,R,E; + +void make_BitIntA(unsigned long long a3, unsigned long long a2, + unsigned long long a1, unsigned long long a0) { + A.a[0] = a0; + A.a[1] = a1; + A.a[2] = a2; + A.a[3] = a3; +} + +void make_BitIntB(unsigned long long a3, unsigned long long a2, + unsigned long long a1, unsigned long long a0) { + B.a[0] = a0; + B.a[1] = a1; + B.a[2] = a2; + B.a[3] = a3; +} + +void make_BitIntE(unsigned long long a3, unsigned long long a2, + unsigned long long a1, unsigned long long a0) { + E.a[0] = a0; + E.a[1] = a1; + E.a[2] = a2; + E.a[3] = a3; +} + +int test() +{ + R.b = A.b / B.b; + return R.b != E.b; +} + +int main() +{ + make_BitIntA(0, 0, 0, 0); + make_BitIntB(0, 0, 0, 1); + make_BitIntE(0, 0, 0, 0); + if (test()) + return 1; + make_BitIntA(0, 0, 0, 2); + make_BitIntB(0, 0, 0, 1); + make_BitIntE(0, 0, 0, 2); + if (test()) + return 1; + make_BitIntA(0x8000000000000000uLL, 0, 0, 0); + make_BitIntB(0, 0, 0, 1); + make_BitIntE(0x8000000000000000uLL, 0, 0, 0); + if (test()) + return 1; + make_BitIntA(0x8000000000000000uLL, 0, 0, 0); + make_BitIntB(0, 0, 0, 2); + make_BitIntE(0x4000000000000000uLL, 0, 0, 0); + if (test()) + return 1; + make_BitIntA(0xFFFFFFFFFFFFFFFFuLL, 0xFFFFFFFFFFFFFFFFuLL, + 0xFFFFFFFFFFFFFFFFuLL, 0xFFFFFFFFFFFFFFFFuLL); + make_BitIntB(0, 0, 0, 2); + make_BitIntE(0x7FFFFFFFFFFFFFFFuLL, 0xFFFFFFFFFFFFFFFFuLL, + 0xFFFFFFFFFFFFFFFFuLL, 0xFFFFFFFFFFFFFFFFuLL); + if (test()) + return 1; + return 0; +} diff --git a/SingleSource/Regression/C/issue44994-1.reference_output b/SingleSource/Regression/C/issue44994-1.reference_output new file mode 100644 --- /dev/null +++ b/SingleSource/Regression/C/issue44994-1.reference_output @@ -0,0 +1 @@ +exit 0 diff --git a/SingleSource/Regression/C/issue44994-2.c b/SingleSource/Regression/C/issue44994-2.c new file mode 100644 --- /dev/null +++ b/SingleSource/Regression/C/issue44994-2.c @@ -0,0 +1,105 @@ +#include + +union sBitIntUion { + int i; + long long a[4]; + _BitInt(256) b; +}; + +union sBitIntUion A, B, R, E; + +void make_BitIntA(long long a3, long long a2, + long long a1, long long a0) { + A.a[0] = a0; + A.a[1] = a1; + A.a[2] = a2; + A.a[3] = a3; +} + +void make_BitIntB(long long a3, long long a2, + long long a1, long long a0) { + B.a[0] = a0; + B.a[1] = a1; + B.a[2] = a2; + B.a[3] = a3; +} + +void make_BitIntE(long long a3, long long a2, + long long a1, long long a0) { + E.a[0] = a0; + E.a[1] = a1; + E.a[2] = a2; + E.a[3] = a3; +} + +int test() +{ + R.b = A.b / B.b; + return R.b != E.b; +} + +int main() +{ + make_BitIntA(0, 0, 0, 0); + make_BitIntB(0, 0, 0, 1); + make_BitIntE(0, 0, 0, 0); + if (test()) + return 1; + make_BitIntA(0, 0, 0, 0); + make_BitIntB(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL); // -1 + make_BitIntE(0, 0, 0, 0); + if (test()) + return 1; + + make_BitIntA(0, 0, 0, 2); + make_BitIntB(0, 0, 0, 1); + make_BitIntE(0, 0, 0, 2); + if (test()) + return 1; + make_BitIntA(0, 0, 0, 2); + make_BitIntB(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL); // -1 + make_BitIntE(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFELL); // -2 + if (test()) + return 1; + make_BitIntA(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFELL); // -2 + make_BitIntB(0, 0, 0, 1); + make_BitIntE(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFELL); // -2 + if (test()) + return 1; + make_BitIntA(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFELL); // -2 + make_BitIntB(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL); // -1 + make_BitIntE(0, 0, 0, 2); + if (test()) + return 1; + + make_BitIntA(0x8000000000000000LL, 0, 0, 0); + make_BitIntB(0, 0, 0, 1); + make_BitIntE(0x8000000000000000LL, 0, 0, 0); + if (test()) + return 1; + make_BitIntA(0x8000000000000000LL, 0, 0, 0); + make_BitIntB(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL); // -1 + make_BitIntA(0x8000000000000000LL, 0, 0, 0); + if (test()) + return 1; + make_BitIntA(0x8000000000000000LL, 0, 0, 0); + make_BitIntB(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFELL); // -2 + make_BitIntE(0x4000000000000000LL, 0, 0, 0); + if (test()) + return 1; + make_BitIntA(0x8000000000000000LL, 0, 0, 0); + make_BitIntB(0, 0, 0, 2); + make_BitIntE(0xC000000000000000LL, 0, 0, 0); + if (test()) + return 1; + return 2; // this is a intent test. +} diff --git a/SingleSource/Regression/C/issue44994-2.reference_output b/SingleSource/Regression/C/issue44994-2.reference_output new file mode 100644 --- /dev/null +++ b/SingleSource/Regression/C/issue44994-2.reference_output @@ -0,0 +1 @@ +exit 0 diff --git a/SingleSource/Regression/C/issue44994-3.c b/SingleSource/Regression/C/issue44994-3.c new file mode 100644 --- /dev/null +++ b/SingleSource/Regression/C/issue44994-3.c @@ -0,0 +1,69 @@ +#include + +union usBitIntUion { + unsigned int i; + unsigned long long a[4]; + unsigned _BitInt(256) b; +}; + +union usBitIntUion A,B,R,E; + +void make_BitIntA(unsigned long long a3, unsigned long long a2, + unsigned long long a1, unsigned long long a0) { + A.a[0] = a0; + A.a[1] = a1; + A.a[2] = a2; + A.a[3] = a3; +} + +void make_BitIntB(unsigned long long a3, unsigned long long a2, + unsigned long long a1, unsigned long long a0) { + B.a[0] = a0; + B.a[1] = a1; + B.a[2] = a2; + B.a[3] = a3; +} + +void make_BitIntE(unsigned long long a3, unsigned long long a2, + unsigned long long a1, unsigned long long a0) { + E.a[0] = a0; + E.a[1] = a1; + E.a[2] = a2; + E.a[3] = a3; +} + +int test() +{ + R.b = A.b % B.b; + return R.b != E.b; +} + +int main() +{ + make_BitIntA(0, 0, 0, 0); + make_BitIntB(0, 0, 0, 1); + make_BitIntE(0, 0, 0, 0); + if (test()) + return 1; + make_BitIntA(0, 0, 0, 2); + make_BitIntB(0, 0, 0, 1); + make_BitIntE(0, 0, 0, 0); + if (test()) + return 1; + make_BitIntA(0, 0, 0, 19); + make_BitIntB(0, 0, 0, 5); + make_BitIntE(0, 0, 0, 4); + if (test()) + return 1; + make_BitIntA(0x8000000000000000uLL, 0, 0, 0); + make_BitIntB(0, 0, 0, 8); + make_BitIntE(0, 0, 0, 0); + if (test()) + return 1; + make_BitIntA(0x8000000000000000uLL, 0, 0, 3); + make_BitIntB(0, 0, 0, 8); + make_BitIntE(0, 0, 0, 3); + if (test()) + return 1; + return 0; +} diff --git a/SingleSource/Regression/C/issue44994-3.reference_output b/SingleSource/Regression/C/issue44994-3.reference_output new file mode 100644 --- /dev/null +++ b/SingleSource/Regression/C/issue44994-3.reference_output @@ -0,0 +1 @@ +exit 0 diff --git a/SingleSource/Regression/C/issue44994-4.c b/SingleSource/Regression/C/issue44994-4.c new file mode 100644 --- /dev/null +++ b/SingleSource/Regression/C/issue44994-4.c @@ -0,0 +1,115 @@ +#include + +union sBitIntUion { + int i; + long long a[4]; + _BitInt(256) b; +}; + +union sBitIntUion A, B, R, E; + +void make_BitIntA(long long a3, long long a2, + long long a1, long long a0) { + A.a[0] = a0; + A.a[1] = a1; + A.a[2] = a2; + A.a[3] = a3; +} + +void make_BitIntB(long long a3, long long a2, + long long a1, long long a0) { + B.a[0] = a0; + B.a[1] = a1; + B.a[2] = a2; + B.a[3] = a3; +} + +void make_BitIntE(long long a3, long long a2, + long long a1, long long a0) { + E.a[0] = a0; + E.a[1] = a1; + E.a[2] = a2; + E.a[3] = a3; +} + +int test() +{ + R.b = A.b % B.b; + return R.b != E.b; +} + +int main() +{ + make_BitIntA(0, 0, 0, 0); + make_BitIntB(0, 0, 0, 1); + make_BitIntE(0, 0, 0, 0); + if (test()) + printf("0\n");//return 1; + make_BitIntA(0, 0, 0, 0); + make_BitIntB(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL); // -1 + make_BitIntE(0, 0, 0, 0); + if (test()) + printf("1\n");//return 1; + + make_BitIntA(0, 0, 0, 2); + make_BitIntB(0, 0, 0, 1); + make_BitIntE(0, 0, 0, 0); + if (test()) + printf("2\n");//return 1; + make_BitIntA(0, 0, 0, 2); + make_BitIntB(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL); // -1 + make_BitIntE(0, 0, 0, 0); + if (test()) + printf("3\n");//return 1; + make_BitIntA(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFELL); // -2 + make_BitIntB(0, 0, 0, 1); + make_BitIntE(0, 0, 0, 0); + if (test()) + printf("4\n");//return 1; + make_BitIntA(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFELL); // -2 + make_BitIntB(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL); // -1 + make_BitIntE(0, 0, 0, 0); + if (test()) + printf("5\n");//return 1; + + make_BitIntA(0, 0, 0, 7); + make_BitIntB(0, 0, 0, 5); + make_BitIntE(0, 0, 0, 2); + if (test()) + printf("6\n");//return 1; + make_BitIntA(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFF9LL); // -7 + make_BitIntB(0, 0, 0, 5); + make_BitIntE(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFELL); // -2 + if (test()) + printf("7\n");//return 1; + make_BitIntA(0, 0, 0, 19); + make_BitIntB(0, 0, 0, 5); + make_BitIntE(0, 0, 0, 4); + if (test()) + printf("8\n");//return 1; + make_BitIntA(0, 0, 0, 19); + make_BitIntB(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFBLL); // -5 + make_BitIntE(0, 0, 0, 4); + if (test()) + printf("9\n");//return 1; + make_BitIntA(0x8000000000000000LL, 0, 0, 0); + make_BitIntB(0, 0, 0, 8); + make_BitIntE(0, 0, 0, 0); + if (test()) + printf("10\n");//return 1; + make_BitIntA(0x8000000000000000LL, 0, 0, 7); + make_BitIntB(0, 0, 0, 8); + make_BitIntE(0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL, + 0xFFFFFFFFFFFFFFFFLL, 0xFFFFFFFFFFFFFFFFLL); // -1 + if (test()) + printf("11\n");//return 1; + return 0; +} diff --git a/SingleSource/Regression/C/issue44994-4.reference_output b/SingleSource/Regression/C/issue44994-4.reference_output new file mode 100644 --- /dev/null +++ b/SingleSource/Regression/C/issue44994-4.reference_output @@ -0,0 +1 @@ +exit 0