Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Add assignment operator to the TestBar test util class. #185

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hwinkler
Copy link
Contributor

@hwinkler hwinkler commented Jun 1, 2020

n.b. this change to test code introduces a lot of failures in the CUB unit tests.
I'm not submitting those fixes -- I've done a few but not all of them.

This change will identify all places in CUB code that attempts an assignment to uninitialized memory.
See https://github.com/NVlabs/cub/issues/184

Change:
I added a an assignment operator to the class, and I added a field named magic that I set to a certain value during construction. Only an object that has been constructed is likely to have that magic value properly set.

An assignment precondition is that the left-hand side is valid. The assignment operators I added assert that the magic member of the lhs has the correct value.

I added a an assignment operator to the class, and I added a field
named `magic` that I set to certain value during
construction. Only an object that has been constructed is likely to
have that magic value properly set.

An assignment precondition is that the left-hand side is valid.
The assignment operators I added assert that the `magic` member of
the lhs has the correct value.
@alliepiper alliepiper added this to the 1.11.1 milestone Oct 20, 2020
@alliepiper alliepiper added the triage Needs investigation and classification. label Oct 20, 2020
@alliepiper alliepiper changed the base branch from master to main October 21, 2020 13:30
@alliepiper alliepiper marked this pull request as draft October 23, 2020 21:30
@alliepiper
Copy link
Collaborator

Converting to draft to prevent merging since this PR's purpose is to detect errors, not fix them.

// Assignment operator
__host__ __device__ __forceinline__ TestBar& operator =(const TestBar& that)
{
assert (magic == MAGIC);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should probably be something other than assert - in a release build, asserts may be turned off, and we want to catch cases where miscompiles in -O3 lead to missed assignments as well. Perhaps it should use the CUB error reporting machinery.

@alliepiper alliepiper modified the milestones: 1.12.0, 1.13.0 Feb 8, 2021
@brycelelbach brycelelbach added the P2: nice to have Desired, but not necessary. label Mar 29, 2021
@alliepiper alliepiper modified the milestones: 1.13.0, 1.14.0 Jun 9, 2021
@alliepiper alliepiper modified the milestones: 1.14.0, 1.15.0 Aug 17, 2021
@alliepiper alliepiper removed this from the 1.15.0 milestone Oct 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P2: nice to have Desired, but not necessary. triage Needs investigation and classification.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants