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

Fix LNOT #1570

Merged
merged 1 commit into from
Oct 27, 2020
Merged

Fix LNOT #1570

merged 1 commit into from
Oct 27, 2020

Conversation

mmisono
Copy link
Collaborator

@mmisono mmisono commented Oct 23, 2020

CreateUint() expects bit size, not byte size. This fixes the following
error.

% sudo ./src/bpftrace -e 'BEGIN { !(int32)0 }'
bpftrace: /home/ubuntu/work/bpftrace/src/types.cpp:251: bpftrace::SizedType bpftrace::CreateInteger(size_t, bool): Assertion `bits == 0 || bits == 8 || bits == 16 || bits == 32 || bits == 64' failed.
zsh: abort      sudo ./src/bpftrace -e 'BEGIN { !(int32)0 }'
Checklist
  • Language changes are updated in docs/reference_guide.md
  • User-visible and non-trivial changes updated in CHANGELOG.md
  • The new behaviour is covered by tests

}
else
{
unop.type = CreateUInt(8 * type.size);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we just return a fixed size int here? Logical not should give a boolean so u64 might be better?

But not sure hwo much that will break.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure but with #1532, there is a chance that bytecode size becomes smaller?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. I Wouldn't mind keeping this PR as is an investigate it further in #1532 & friends

CreateUint() expects bit size, not byte size. This fixes the following
error.

```
% sudo ./src/bpftrace -e 'BEGIN { !(int32)0 }'
bpftrace: /home/ubuntu/work/bpftrace/src/types.cpp:251: bpftrace::SizedType bpftrace::CreateInteger(size_t, bool): Assertion `bits == 0 || bits == 8 || bits == 16 || bits == 32 || bits == 64' failed.
zsh: abort      sudo ./src/bpftrace -e 'BEGIN { !(int32)0 }'
```
@mmisono
Copy link
Collaborator Author

mmisono commented Oct 26, 2020

rebased

@fbs fbs merged commit 0c8c682 into bpftrace:master Oct 27, 2020
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

Successfully merging this pull request may close these issues.

2 participants