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 compare_and_swap call in bitmap #2

Merged
merged 1 commit into from
Jun 28, 2015
Merged

Conversation

mminutoli
Copy link

BFS was hanging here because the compare_and_swap template was comparing
old_val with the value of loc (the pointer it self).

Passing loc as first argument makes the compiler instantiate compare_and_swap
with T=int * but then the function call __sync_bool_compare_and_swap as:

__sync_bool_compare_and_swap(&x, old_val, new_val);

This means that the type of the first argument is int ** which is wrong.

There is one more issue still to address. The family of functions _sync*
works only with primitive types and templates in platform_atomics.h do not
address this issue.

old_val with the value of loc (the pointer it self).

Passing loc as first argument makes the compiler instantiate compare_and_swap
with T=int * but then the function call __sync_bool_compare_and_swap as:

__sync_bool_compare_and_swap(&x, old_val, new_val);

This means that the type of the first argument is int ** which is wrong.

There is one more issue still to address. The family of functions __sync_*
works only with primitive types and templates in platform_atomics.h do not
address this issue.
sbeamer added a commit that referenced this pull request Jun 28, 2015
Fix compare_and_swap call in bitmap
@sbeamer sbeamer merged commit 8dcad6b into sbeamer:master Jun 28, 2015
@sbeamer
Copy link
Owner

sbeamer commented Jun 28, 2015

Thanks!

This is definitely a bug and was due to me switching over to the newer platform_atomics.h API but using the older bitmap class. I'm sorry for any loss of productivity this caused.

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