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

Incorrect result when an empty bitset intersects with itself #121

Closed
notify-bibi opened this issue Sep 19, 2024 · 4 comments
Closed

Incorrect result when an empty bitset intersects with itself #121

notify-bibi opened this issue Sep 19, 2024 · 4 comments
Labels
type: bug A general bug

Comments

@notify-bibi
Copy link

notify-bibi commented Sep 19, 2024

📝 Overall Description

assert check failed

🎯 Expected Behavior

  public void testSizedEmptyBitVectorDontIntersectsItself() {
    BitVector a = new BitVector(1024);
    assertFalse(a.intersects(a));
  }

🐛 Current Behavior

    @Override
    public boolean intersects(IBitSet set) {
        if (this.isEmpty() || set.isEmpty()) { // added empty check
            return false;
        }
        if (this == set) {
            return true;
        }
        if (!(set instanceof SparseBitSet)) {
            return super.intersects(set);
        }
        SparseBitSet other = (SparseBitSet) set;
        return iterateBlocks(this, other, new IntersectsAction(this));
    }

🔄 Reproducible Example

No response

⚙️ Tai-e Arguments

🔍 Click here to see Tai-e Options
{{The content of 'output/options.yml' file}}
🔍 Click here to see Tai-e Analysis Plan
{{The content of 'output/tai-e-plan.yml' file}}

📜 Tai-e Log

🔍 Click here to see Tai-e Log
{{The content of 'output/tai-e.log' file}}

ℹ️ Additional Information

No response

@notify-bibi notify-bibi added the type: bug A general bug label Sep 19, 2024
@notify-bibi
Copy link
Author

notify-bibi commented Sep 19, 2024

check also this api: public boolean SparseBitSet#contains(IBitSet set)

@zhangt2333
Copy link
Member

Thanks for writing this issue in Chinese, it makes it very easy for a few of us developers to read. However, Tai-e is a project with an international focus, and we aim to keep our community discussions in as widely accessible a language as possible, which is English. This helps us share our open-source progress with interested individuals from all over the world. Kindly consider using English for communication in the future. We appreciate your understanding. Thank you.


It seems that there is no class named BitVector in Tai-e. Please verify that you're submitting the issue to the correct project.

@zhangt2333 zhangt2333 changed the title intersects 非预期返回值 Non-expected return value of method intersects Sep 21, 2024
@zhangt2333 zhangt2333 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 21, 2024
@notify-bibi
Copy link
Author

The intersects method in src/main/java/pascal/taie/util/collection/SparseBitSet.java

@zhangt2333 zhangt2333 reopened this Sep 21, 2024
@zhangt2333
Copy link
Member

zhangt2333 commented Sep 21, 2024

Fixed by 9eb966e.Thanks. ♥️

@zhangt2333 zhangt2333 changed the title Non-expected return value of method intersects Incorrect result when an empty bitset intersects with itself Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants