Skip to content
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

performing pointer subtraction with a null pointer has undefined behavior #3

Open
nouraellm opened this issue Apr 6, 2023 · 0 comments

Comments

@nouraellm
Copy link

I am actually trying to run this on macOS M1 (to use Rune) clang 14 => but the make throws a bunch of warnings like:

./utdatabase.h:157:70: warning: performing pointer subtraction with a null pointer has undefined behavior [-Wnull-pointer-subtraction]
utInlineC uint32 utSym2ValidIndex(utSym Sym) {return utValidSym(Sym) - (utSym)0;}

It is an undefined behavior because when a null pointer is involved in pointer subtraction we are violating C standards, so it is crucial to refrain from conducting pointer arithmetic with null pointers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant