-
Notifications
You must be signed in to change notification settings - Fork 23
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
Segmentation fault when calling clang.cindex.Type.get_size() on cursor kind CursorKind.DECL_REF_EXPR #35
Comments
Cannot reproduce with libclang-14.0.6 on x86_64 MacOS. Will try to reproduce the issue on arm64 MacOS next Monday.
|
I checked on Ubuntu 20 + liblclang 14.0.1 - it works fine. |
Have you tried Ubuntu 20 + libclang 14.0.6 (the latest released version on Pypi)?
I'm keeping upload prebuilt wheels to pypi for LLVM releases.
In any case it shouldn't segmentation fault. Will investigate the issue on M1 macos. Thanks for your reporting. |
I checked. Everything works. I can also check the Windows 10 version in my free time if you want.
Now I know :) Just when I started using this module I wasn't sure about the support. Anyway, you doing good job. |
I've been messing around on the latest commits on I believe this is from the latest commit, not
This is what I get: ❯ python libclang_test/
/Users/paulwood/workspace/libclang-test
displayname=src/test.cpp, kind=CursorKind.TRANSLATION_UNIT, type=, size=-1
displayname=Foo, kind=CursorKind.STRUCT_DECL, type=Foo, size=20
displayname=a, kind=CursorKind.FIELD_DECL, type=int, size=4
displayname=b, kind=CursorKind.FIELD_DECL, type=int, size=4
displayname=c, kind=CursorKind.FIELD_DECL, type=char[10], size=10
displayname=, kind=CursorKind.INTEGER_LITERAL, type=int, size=4
displayname=Bar, kind=CursorKind.STRUCT_DECL, type=Bar, size=44
displayname=f1, kind=CursorKind.FIELD_DECL, type=Foo, size=20
displayname=struct Foo, kind=CursorKind.TYPE_REF, type=Foo, size=20
displayname=f2, kind=CursorKind.FIELD_DECL, type=Foo, size=20
displayname=struct Foo, kind=CursorKind.TYPE_REF, type=Foo, size=20
displayname=bb, kind=CursorKind.FIELD_DECL, type=int, size=4
displayname=main(int, char **), kind=CursorKind.FUNCTION_DECL, type=int (int, char **), size=1
displayname=argc, kind=CursorKind.PARM_DECL, type=int, size=4
displayname=argv, kind=CursorKind.PARM_DECL, type=char *[], size=-2
displayname=, kind=CursorKind.COMPOUND_STMT, type=, size=-1
displayname=, kind=CursorKind.UNEXPOSED_EXPR, type=<dependent type>, size=-3
fish: Job 1, 'python libclang_test/' terminated by signal SIGSEGV (Address boundary error) After removing all ❯ python libclang_test/
/Users/paulwood/workspace/libclang-test
displayname=src/test.cpp, kind=CursorKind.TRANSLATION_UNIT, type=
displayname=Foo, kind=CursorKind.STRUCT_DECL, type=Foo
displayname=a, kind=CursorKind.FIELD_DECL, type=int
displayname=b, kind=CursorKind.FIELD_DECL, type=int
displayname=c, kind=CursorKind.FIELD_DECL, type=char[10]
displayname=, kind=CursorKind.INTEGER_LITERAL, type=int
displayname=Bar, kind=CursorKind.STRUCT_DECL, type=Bar
displayname=f1, kind=CursorKind.FIELD_DECL, type=Foo
displayname=struct Foo, kind=CursorKind.TYPE_REF, type=Foo
displayname=f2, kind=CursorKind.FIELD_DECL, type=Foo
displayname=struct Foo, kind=CursorKind.TYPE_REF, type=Foo
displayname=bb, kind=CursorKind.FIELD_DECL, type=int
displayname=main(int, char **), kind=CursorKind.FUNCTION_DECL, type=int (int, char **)
displayname=argc, kind=CursorKind.PARM_DECL, type=int
displayname=argv, kind=CursorKind.PARM_DECL, type=char *[]
displayname=, kind=CursorKind.COMPOUND_STMT, type=
displayname=, kind=CursorKind.UNEXPOSED_EXPR, type=<dependent type>
displayname=, kind=CursorKind.DECL_REF_EXPR, type=<overloaded function type>
displayname=printf, kind=CursorKind.OVERLOADED_DECL_REF, type=
displayname="hello world!\n", kind=CursorKind.STRING_LITERAL, type=const char[14]
displayname=, kind=CursorKind.RETURN_STMT, type=
displayname=, kind=CursorKind.INTEGER_LITERAL, type=int |
Thanks for the information. I can produce the failure now. |
I can confirm that the segmentation fault is a bug of this prebuilt wheel itself. The code in For a workaround, you could use
to load the |
Description
I was testing out this library with some dummy code you can find here, and I came across a segmentation fault when calling
clang.cindex.Type.get_size()
on a cursor node of kind CursorKind.DECL_REF_EXPR. It doesn't really make sense to get the size, but I think it should just return 0 or None.Clang Version
To Reproduce
git clone https://github.com/plmwd/libclang-test.git cd libclang-test git checkout 65d236ee200eff80c3094e76e93b0358a1490636 python3.10 -m venv .venv pip install -r requirements.txt python libclang-test
The text was updated successfully, but these errors were encountered: