Skip to content

Commit

Permalink
Fixes SEGFAULT in integration_tests/elemental_01.py (lcompilers#2452)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kishan-Ved authored and Agent-Hellboy committed Mar 5, 2024
1 parent bef8f4c commit 7398278
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 18 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ Please follow the below steps for Windows:
./run_tests.py
```

- Update test references:
```
./run_tests.py -u
```

- Run integration tests:

```bash
Expand Down
Binary file added expr
Binary file not shown.
10 changes: 5 additions & 5 deletions integration_tests/elemental_01.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,17 @@ def elemental_sin():

verify1d(array1d, sin1d, 256)

arraynd: f64[256, 64, 16] = empty((256, 64, 16), dtype=float64)
sinnd: f64[256, 64, 16] = empty((256, 64, 16), dtype=float64)
arraynd: f64[200, 64, 16] = empty((200, 64, 16), dtype=float64)
sinnd: f64[200, 64, 16] = empty((200, 64, 16), dtype=float64)

for i in range(256):
for i in range(200):
for j in range(64):
for k in range(16):
arraynd[i, j, k] = float(i + j + k)

sinnd = sin(arraynd)**2.0

verifynd(arraynd, sinnd, 256, 64, 16)
verifynd(arraynd, sinnd, 200, 64, 16)

def elemental_cos():
i: i32
Expand Down Expand Up @@ -162,4 +162,4 @@ def elemental_trig_identity():
elemental_cos()
elemental_trig_identity()
elemental_sum()
elemental_mul()
elemental_mul()
4 changes: 2 additions & 2 deletions tests/reference/asr-elemental_01-b58df26.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"basename": "asr-elemental_01-b58df26",
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
"infile": "tests/../integration_tests/elemental_01.py",
"infile_hash": "1d1eb8ce26df5817c1e474e4f69b0b96e53df362a31f1b722efaadf0",
"infile_hash": "e96eed9469877faf7f0b6ddb472d3df5fd0270d0528d0334b1751783",
"outfile": null,
"outfile_hash": null,
"stdout": "asr-elemental_01-b58df26.stdout",
"stdout_hash": "f6657ff256291caa10a0681ae7c5ad89f5c103725e44318d42b1445e",
"stdout_hash": "11322144ccc20362db9bf290de89fdbaaa0436821aa5377f20218dae",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
22 changes: 11 additions & 11 deletions tests/reference/asr-elemental_01-b58df26.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@
(Array
(Real 8)
[((IntegerConstant 0 (Integer 4))
(IntegerConstant 256 (Integer 4)))
(IntegerConstant 200 (Integer 4)))
((IntegerConstant 0 (Integer 4))
(IntegerConstant 64 (Integer 4)))
((IntegerConstant 0 (Integer 4))
Expand Down Expand Up @@ -855,7 +855,7 @@
(Array
(Real 8)
[((IntegerConstant 0 (Integer 4))
(IntegerConstant 256 (Integer 4)))
(IntegerConstant 200 (Integer 4)))
((IntegerConstant 0 (Integer 4))
(IntegerConstant 64 (Integer 4)))
((IntegerConstant 0 (Integer 4))
Expand Down Expand Up @@ -1012,7 +1012,7 @@
(Array
(Real 8)
[((IntegerConstant 0 (Integer 4))
(IntegerConstant 256 (Integer 4)))
(IntegerConstant 200 (Integer 4)))
((IntegerConstant 0 (Integer 4))
(IntegerConstant 64 (Integer 4)))
((IntegerConstant 0 (Integer 4))
Expand All @@ -1030,7 +1030,7 @@
(Array
(Real 8)
[((IntegerConstant 0 (Integer 4))
(IntegerConstant 256 (Integer 4)))
(IntegerConstant 200 (Integer 4)))
((IntegerConstant 0 (Integer 4))
(IntegerConstant 64 (Integer 4)))
((IntegerConstant 0 (Integer 4))
Expand All @@ -1046,11 +1046,11 @@
((Var 218 i)
(IntegerConstant 0 (Integer 4))
(IntegerBinOp
(IntegerConstant 256 (Integer 4))
(IntegerConstant 200 (Integer 4))
Sub
(IntegerConstant 1 (Integer 4))
(Integer 4)
(IntegerConstant 255 (Integer 4))
(IntegerConstant 199 (Integer 4))
)
(IntegerConstant 1 (Integer 4)))
[(DoLoop
Expand Down Expand Up @@ -1126,7 +1126,7 @@
(Array
(Real 8)
[((IntegerConstant 0 (Integer 4))
(IntegerConstant 256 (Integer 4)))
(IntegerConstant 200 (Integer 4)))
((IntegerConstant 0 (Integer 4))
(IntegerConstant 64 (Integer 4)))
((IntegerConstant 0 (Integer 4))
Expand All @@ -1144,7 +1144,7 @@
(Array
(Real 8)
[((IntegerConstant 0 (Integer 4))
(IntegerConstant 256 (Integer 4)))
(IntegerConstant 200 (Integer 4)))
((IntegerConstant 0 (Integer 4))
(IntegerConstant 64 (Integer 4)))
((IntegerConstant 0 (Integer 4))
Expand All @@ -1165,7 +1165,7 @@
(Array
(Real 8)
[((IntegerConstant 0 (Integer 4))
(IntegerConstant 256 (Integer 4)))
(IntegerConstant 200 (Integer 4)))
((IntegerConstant 0 (Integer 4))
(IntegerConstant 64 (Integer 4)))
((IntegerConstant 0 (Integer 4))
Expand All @@ -1181,7 +1181,7 @@
(Array
(Real 8)
[((IntegerConstant 0 (Integer 4))
(IntegerConstant 256 (Integer 4)))
(IntegerConstant 200 (Integer 4)))
((IntegerConstant 0 (Integer 4))
(IntegerConstant 64 (Integer 4)))
((IntegerConstant 0 (Integer 4))
Expand All @@ -1190,7 +1190,7 @@
)
()
))
((IntegerConstant 256 (Integer 4)))
((IntegerConstant 200 (Integer 4)))
((IntegerConstant 64 (Integer 4)))
((IntegerConstant 16 (Integer 4)))]
()
Expand Down

0 comments on commit 7398278

Please sign in to comment.