Skip to content

Map doesn't work without concrete #1228

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 2 commits into from
Oct 26, 2022
Merged

Map doesn't work without concrete #1228

merged 2 commits into from
Oct 26, 2022

Conversation

CaelmBleidd
Copy link
Member

@CaelmBleidd CaelmBleidd commented Oct 25, 2022

Description

At some moment we discovered that maps do not work as they suppose: sometimes concrete could fix it (for example, when a map was not a parameter), sometimes could not. This request fixes two particular problems: error in type indices for select operation and possible aliasing between nested arrays.

A problem with aliasing could be seen while debugging org.utbot.examples.collections.Maps#putInMapFromParameters. Without this fix it doesn't work for an empty map: touched and values might have the same address, and if we make two put operations, the second one will cause a problem -- memory update for keys will rewrite values as well, and we'll have wrong result values. With one put or with a map that was created during the execution everything worked fine (after the fix with types)

Fixes #436

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Automated Testing

org.utbot.examples.collections.Maps#createMapWithEnum
org.utbot.examples.collections.Maps#createMapWithString
org.utbot.examples.collections.Maps#containsKeyAndPuts
org.utbot.examples.collections.Maps#putInMapFromParameters
org.utbot.examples.collections.Maps#mapPutAndGet

Manual Scenario

Didn't check manually.

Checklist:

  • The change followed the style guidelines of the UTBot project
  • Self-review of the code is passed
  • The change contains enough commentaries, particularly in hard-to-understand areas
  • New documentation is provided or existed one is altered
  • No new warnings
  • New tests have been added
  • All tests pass locally with my changes

Fixes:
* aliasing between nested arrays of UtHashMap and its fields
* unsat for get operation from Map
@CaelmBleidd CaelmBleidd force-pushed the caelmbleidd/map_fixes branch 3 times, most recently from a648d4e to 410c58d Compare October 26, 2022 05:56
@CaelmBleidd CaelmBleidd force-pushed the caelmbleidd/map_fixes branch from 827f0d4 to 43d1dd3 Compare October 26, 2022 07:12
@CaelmBleidd CaelmBleidd force-pushed the caelmbleidd/map_fixes branch from 43d1dd3 to 03ffb84 Compare October 26, 2022 07:24
@CaelmBleidd CaelmBleidd merged commit dff228f into main Oct 26, 2022
@CaelmBleidd CaelmBleidd deleted the caelmbleidd/map_fixes branch October 26, 2022 08:21
@alisevych alisevych changed the title Map don't work without concrete Map doesn't work without concrete Oct 26, 2022
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.

HashMap with Enum as key - test generation fails
3 participants