-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect parsing of CST_CODE_CE_GEP_WITH_INRANGE_INDEX
's type
#218
Comments
RyanGlScott
added a commit
that referenced
this issue
Apr 23, 2023
This bumps the `llvm-pretty` submodule to bring in the changes to the `GEP`/`ConstGEP` data constructors from GaloisInc/llvm-pretty#110 and adapts the code in `llvm-pretty-bc-parser` accordingly. Because `ConstGEP` now stores the basis type for calculations explicitly, I needed to fix #218 in order to ensure that the basis type is always parsed properly. In the process of fixing this issue, I refactored the `parseCeGep` to make the code clearer and more closely mirror the structure of LLVM's own bitcode parser. This is necessary in order to use `getelementptr` on an opaque pointer. See #177. A test case will be added in a subsequent commit.
RyanGlScott
added a commit
that referenced
this issue
Apr 23, 2023
This bumps the `llvm-pretty` submodule to bring in the changes to the `GEP`/`ConstGEP` data constructors from GaloisInc/llvm-pretty#110 and adapts the code in `llvm-pretty-bc-parser` accordingly. Because `ConstGEP` now stores the basis type for calculations explicitly, I needed to fix #218 in order to ensure that the basis type is always parsed properly. In the process of fixing this issue, I refactored the `parseCeGep` to make the code clearer and more closely mirror the structure of LLVM's own bitcode parser. This is necessary in order to use `getelementptr` on an opaque pointer. See #177. A test case will be added in a subsequent commit.
RyanGlScott
added a commit
that referenced
this issue
May 3, 2023
This bumps the `llvm-pretty` submodule to bring in the changes to the `GEP`/`ConstGEP` data constructors from GaloisInc/llvm-pretty#110 and adapts the code in `llvm-pretty-bc-parser` accordingly. Because `ConstGEP` now stores the basis type for calculations explicitly, I needed to fix #218 in order to ensure that the basis type is always parsed properly. In the process of fixing this issue, I refactored the `parseCeGep` to make the code clearer and more closely mirror the structure of LLVM's own bitcode parser. This is necessary in order to use `getelementptr` on an opaque pointer. See #177. A test case will be added in a subsequent commit.
RyanGlScott
added a commit
that referenced
this issue
May 30, 2023
This bumps the `llvm-pretty` submodule to bring in the changes to the `GEP`/`ConstGEP` data constructors from GaloisInc/llvm-pretty#110 and adapts the code in `llvm-pretty-bc-parser` accordingly. Because `ConstGEP` now stores the basis type for calculations explicitly, I needed to fix #218 in order to ensure that the basis type is always parsed properly. In the process of fixing this issue, I refactored the `parseCeGep` to make the code clearer and more closely mirror the structure of LLVM's own bitcode parser. This is necessary in order to use `getelementptr` on an opaque pointer. See #177. A test case will be added in a subsequent commit.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While investigating the code for parsing
ConstGEP
, I noticed this suspicious-looking TODO:llvm-pretty-bc-parser/src/Data/LLVM/BitCode/IR/Constants.hs
Lines 457 to 473 in 0946cbe
And indeed, this code isn't right for
CST_CODE_CE_GEP_WITH_INRANGE_INDEX
. As proof, if you take this.ll
file (taken from here):Convert it to a
.bc
file:And then load it with
llvm-pretty-bc-parser
, you will get:The incorrect part is the
Nothing
inConstGEP True (Just 1) Nothing ...
, indicating that there is no explicit type to use as a basis for calculations. This is incorrect becauseCST_CODE_CE_GEP_WITH_INRANGE_INDEX
always includes an explicit type, as indicated here. The correct thing to do would be to mirror how LLVM's own bicode reader works here.The text was updated successfully, but these errors were encountered: