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

clang warning logical vs bitwise #3

Closed
bluhm opened this issue Aug 23, 2017 · 3 comments
Closed

clang warning logical vs bitwise #3

bluhm opened this issue Aug 23, 2017 · 3 comments

Comments

@bluhm
Copy link

bluhm commented Aug 23, 2017

When compiling List-MoreUtils-XS 0.423 with clang I get this warning:

cc -c  -I.  -DNO_LOCALE_NUMERIC -DNO_LOCALE_COLLATE -fno-strict-aliasing -pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2 -I/usr/local/include -O2    -DVERSION=\"0.423\"  -DXS_VERSION=\"0.423\" -DPIC -fPIC  "-I/usr/libdata/perl5/amd64-openbsd/CORE"   XS.c
XS.xs:282:21: warning: logical not is only applied to the left hand side of this
      bitwise operator [-Wlogical-not-parentheses]
                if (!(PadnameFLAGS(name_sv)) & SVf_OK)
                    ^                        ~
XS.xs:282:21: note: add parentheses after the '!' to evaluate the bitwise
      operator first
                if (!(PadnameFLAGS(name_sv)) & SVf_OK)
                    ^
                     (                               )
XS.xs:282:21: note: add parentheses around left hand side expression to silence
      this warning
                if (!(PadnameFLAGS(name_sv)) & SVf_OK)
                    ^
                    (                       )
1 warning generated.

The code does not look correct. PadnameFLAGS is a bit field with
presumably some bits set. After logical not the value is 0 and the
condition is never true.

@rehsack
Copy link
Member

rehsack commented Aug 23, 2017

I took the code (as comment above shows) from Padwalker. I would appreciate when you open a ticket in RT since I forget Github issues regulary - but thanks for pointing that out, I take a deep look and will report.

@bluhm
Copy link
Author

bluhm commented Aug 23, 2017

Created a Ticket in RT
https://rt.cpan.org/Public/Bug/Display.html?id=122883

@rehsack
Copy link
Member

rehsack commented Aug 23, 2017

Thank you very much. I'm closing this here now.

@rehsack rehsack closed this as completed Aug 23, 2017
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

2 participants