[nac3standalone 32-bit error] ./ndarray.py: Bad LLVM codegen #476

Closed
opened 2024-07-21 17:55:54 +08:00 by lyken · 0 comments
Collaborator

(Requires #468)
(Error found by https://git.m-labs.hk/lyken/misc/src/branch/main/nac3/find_ndarray_anomalies.py)

How to reproduce

Go to nac3standalone/demo and do:

cargo build && ./run_demo.sh --debug -s 32 src/ndarray.py

However, the error output from this command is unhelpful, see section "Special details on discovering bugs"

Special details on discovering bugs

See attachment (ndarray_crash_log.txt) for the full list of discovered LLVM IR codegen errors found using https://git.m-labs.hk/lyken/misc/src/branch/main/nac3/find_ndarray_anomalies.py by testing all def test_* individually.

Problem

Almost all test_* produces malformed LLVM IR, and those LLVM errors generally look like this:

Both operands to a binary operator are not of the same type!
  %44 = mul i32 %38, i64 ptrtoint (i32* getelementptr (i32, i32* null, i32 1) to i64), !dbg !20
Both operands to a binary operator are not of the same type!
  %83 = mul i32 %51, i64 ptrtoint (double* getelementptr (double, double* null, i32 1) to i64), !dbg !20
Both operands to a binary operator are not of the same type!
  %126 = mul i32 %120, i64 ptrtoint (i32* getelementptr (i32, i32* null, i32 1) to i64), !dbg !21
Both operands to a binary operator are not of the same type!
  %165 = mul i32 %133, i64 ptrtoint (double* getelementptr (double, double* null, i32 1) to i64), !dbg !21

Probably there is a common implementation in nac3core that produces the wrong IR, causing all the co-dependent ndarray functions to generate incorrect IR as a result. Issue #466 probably suffers from the same bug too.

(Requires https://git.m-labs.hk/M-Labs/nac3/pulls/468) (Error found by https://git.m-labs.hk/lyken/misc/src/branch/main/nac3/find_ndarray_anomalies.py) ## How to reproduce Go to `nac3standalone/demo` and do: ``` cargo build && ./run_demo.sh --debug -s 32 src/ndarray.py ``` However, the error output from this command is unhelpful, see section "Special details on discovering bugs" ## Special details on discovering bugs See attachment (ndarray_crash_log.txt) for the full list of discovered LLVM IR codegen errors found using https://git.m-labs.hk/lyken/misc/src/branch/main/nac3/find_ndarray_anomalies.py by testing all `def test_*` individually. ## Problem *Almost* all `test_*` produces malformed LLVM IR, and those LLVM errors generally look like this: ``` Both operands to a binary operator are not of the same type! %44 = mul i32 %38, i64 ptrtoint (i32* getelementptr (i32, i32* null, i32 1) to i64), !dbg !20 Both operands to a binary operator are not of the same type! %83 = mul i32 %51, i64 ptrtoint (double* getelementptr (double, double* null, i32 1) to i64), !dbg !20 Both operands to a binary operator are not of the same type! %126 = mul i32 %120, i64 ptrtoint (i32* getelementptr (i32, i32* null, i32 1) to i64), !dbg !21 Both operands to a binary operator are not of the same type! %165 = mul i32 %133, i64 ptrtoint (double* getelementptr (double, double* null, i32 1) to i64), !dbg !21 ``` Probably there is a common implementation in `nac3core` that produces the wrong IR, causing all the co-dependent ndarray functions to generate incorrect IR as a result. Issue https://git.m-labs.hk/M-Labs/nac3/issues/466 probably suffers from the same bug too.
lyken changed title from [nac3standalone 32-bit error] `src/ndarray.py`: Bad LLVM codegen to [nac3standalone 32-bit error] `./ndarray.py`: Bad LLVM codegen 2024-07-21 17:57:19 +08:00
sb10q closed this issue 2024-08-14 17:39:40 +08:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#476
No description provided.