Skip to content

Don't collect constants from every assignment statement #2558

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

Merged
merged 3 commits into from
Aug 30, 2023

Conversation

Markoutte
Copy link
Collaborator

Description

Fixes #2527

The bug happens because constants are incorrectly collected on pre-process phase. An if-statement bytecode for longs and doubles has follow steps:

  1. Assign a local variable the result of applying cmp operation
  2. Compare the result corresponding to the original logic.

There's no check that an if-statement has cmp operation in an assignment statement, therefore it accepts any method call as well.

How to test

Manual tests

Example from the issue should generate 2 tests.

Self-check list

  • I've set the proper labels for my PR (at least, for category and component).
  • PR title and description are clear and intelligible.
  • I've added enough comments to my code, particularly in hard-to-understand areas.
  • The functionality I've repaired, changed or added is covered with automated tests.
  • Manual tests have been provided optionally.
  • The documentation for the functionality I've been working on is up-to-date.

@Markoutte Markoutte added comp-fuzzing Issue is related to the fuzzing ctg-bug-fix PR is fixing a bug labels Aug 28, 2023
@Vassiliy-Kudryashov Vassiliy-Kudryashov enabled auto-merge (squash) August 30, 2023 13:41
@Vassiliy-Kudryashov Vassiliy-Kudryashov enabled auto-merge (squash) August 30, 2023 14:13
@Vassiliy-Kudryashov Vassiliy-Kudryashov merged commit d8d5197 into main Aug 30, 2023
@Vassiliy-Kudryashov Vassiliy-Kudryashov deleted the pelevin/2527-fix-constants-collecting branch August 30, 2023 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-fuzzing Issue is related to the fuzzing ctg-bug-fix PR is fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fuzzing is stopped because of an error IllegalStateException: unknown type of value abc (class kotlin.String)
2 participants