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

Compiler warning of undefined behaviour: pointer arithmetics on null pointers #28

Open
ghoffart opened this issue Apr 16, 2022 · 0 comments

Comments

@ghoffart
Copy link

When building ptunnel-ng on macOS 12.3.1/x86_64, there are warnings output:

./autogen.sh
[…]
[…]
test -z "" || rm -f
rm -f *.o
make[1]: Nothing to be done for `clean-am'.
-> make -j4 all
Making all in src
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
  CC       ptunnel_ng-options.o
  CC       ptunnel_ng-challenge.o
  CC       ptunnel_ng-md5.o
  CC       ptunnel_ng-utils.o
md5.c:164:18: warning: performing pointer subtraction with a null pointer has undefined behavior [-Wnull-pointer-subtraction]
            if (!((data - (const md5_byte_t *)0) & 3)) {
                        ^ ~~~~~~~~~~~~~~~~~~~~~
  CC       ptunnel_ng-pkt.o
  CC       ptunnel_ng-pdesc.o
1 warning generated.
  CC       ptunnel_ng-ptunnel.o
  CCLD     ptunnel-ng
make[1]: Nothing to be done for `all-am'.

Compiler:

configure:3992: checking for C compiler version
configure:4001: gcc --version >&5
Apple clang version 13.1.6 (clang-1316.0.21.2.3)
Target: x86_64-apple-darwin21.4.0
Thread model: posix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants