search for: ex1_opt

Displaying 6 results from an estimated 6 matches for "ex1_opt".

2019 Jul 22
3
[RFC] A new multidimensional array indexing intrinsic
...> > > ``` > > n = m = 3 > > x1 = 1, y1 = 0; B[x1][y1] = nx1+y1 = 3*1+0=3 > > x2 = 0, y2 = 3; B[x2][y2] = nx2+y2 = 3*0+3=3 > > ``` > > > > Hence, the array elements `B[x1][y1]` and `B[x2][y2]` _can alias_, and > > so the transformation proposed in `ex1_opt` is unsound in general. > > I'm unsure your example actually showcases the problem: > > C standard, N1570 draft, Page 560, Appendix J.2 Undefined Behavior: > > An array subscript is out of range, even if an object is apparently > accessible with the given subscript (as in t...
2019 Jul 21
6
[RFC] A new multidimensional array indexing intrinsic
...indices _interpreted as tuples_ `(x1, y1)` and `(x2, y2)` do not have the same value, due to the guarding asserts that `x1 != x2` and `y1 != y2`. As a result, the write `B[x1][y1] = 1` can in no way interfere with the value of `B[x2][y2]`. Consquently, we can optimise the program into: ```cpp int ex1_opt(int n, int m, B[n][m], int x1, int x2, int y1, int y2) { // B[x1][y1] = 1 is omitted because the result // cannot be used: // It is not used in the print and then the program exits printf("%d", B[x2][y2]); exit(0); } ``` However, alas, this is illegal, for the C language d...
2019 Jul 22
2
[RFC] A new multidimensional array indexing intrinsic
...not have the same value, due to the guarding asserts >> that `x1 != x2` and `y1 != y2`. As a result, the write `B[x1][y1] = 1` can >> in no way interfere with the value of `B[x2][y2]`. Consquently, >> we can optimise the program into: >> >> >> ```cpp >> int ex1_opt(int n, int m, B[n][m], int x1, int x2, int y1, int y2) { >> // B[x1][y1] = 1 is omitted because the result >> // cannot be used: >> // It is not used in the print and then the program exits >> printf("%d", B[x2][y2]); >> exit(0); >> } >&...
2019 Jul 22
2
[RFC] A new multidimensional array indexing intrinsic
...y2)` do not have the same value, due to the guarding asserts > that `x1 != x2` and `y1 != y2`. As a result, the write `B[x1][y1] = 1` can > in no way interfere with the value of `B[x2][y2]`. Consquently, > we can optimise the program into: > > > ```cpp > int ex1_opt(int n, int m, B[n][m], int x1, int x2, int y1, int y2) { > // B[x1][y1] = 1 is omitted because the result > // cannot be used: > // It is not used in the print and then the program exits > printf("%d", B[x2][y2]); > exit(0); > }...
2019 Jul 25
0
[RFC] A new multidimensional array indexing intrinsic
...to the guarding asserts >>> that `x1 != x2` and `y1 != y2`. As a result, the write `B[x1][y1] = 1` can >>> in no way interfere with the value of `B[x2][y2]`. Consquently, >>> we can optimise the program into: >>> >>> >>> ```cpp >>> int ex1_opt(int n, int m, B[n][m], int x1, int x2, int y1, int y2) { >>> // B[x1][y1] = 1 is omitted because the result >>> // cannot be used: >>> // It is not used in the print and then the program exits >>> printf("%d", B[x2][y2]); >>> exit(...
2019 Jul 22
1
[RFC] A new multidimensional array indexing intrinsic
...> that `x1 != x2` and `y1 != y2`. As a result, the write `B[x1][y1] = 1` can > > > in no way interfere with the value of `B[x2][y2]`. Consquently, > > > we can optimise the program into: > > > > > > > > > ```cpp > > > int ex1_opt(int n, int m, B[n][m], int x1, int x2, int y1, int y2) { > > > // B[x1][y1] = 1 is omitted because the result > > > // cannot be used: > > > // It is not used in the print and then the program exits > > > printf("%d&qu...