Skip to content

regex_macros: Fix valgrind errors #13980

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

Closed
wants to merge 1 commit into from

Conversation

alexcrichton
Copy link
Member

While speedier to not perform initialization, these calls to mem::init() are
causing valgrind errors when using compiled macros.

Closes #13969

While speedier to not perform initialization, these calls to mem::init() are
causing valgrind errors when using compiled macros.

Closes rust-lang#13969
@sfackler
Copy link
Member

sfackler commented May 6, 2014

Is Valgrind just not smart enough to figure out that the fields have actually been initialized by the time they're read, or is there actually a logic problem here?

@alexcrichton
Copy link
Member Author

I suspect there is an actual logic problem (I'd be surprised if valgrind had a false positive here), but I also have not taken the time to investigate the errors to figure out why it may be a logic problem.

@sfackler
Copy link
Member

sfackler commented May 6, 2014

cc @BurntSushi

@gereeter
Copy link
Contributor

gereeter commented May 8, 2014

It is actually reading uninitialised data, but this is deliberate and not a logic error. See the cited source for more details.

Interestingly, RE2, which uses the same trick, has the following code:

// Don't need to zero the memory, but do so anyway
// to appease Valgrind.
if (valgrind_) {
  for (int i = 0; i < max_size; i++) {
    dense_[i] = 0xababababU;
    sparse_to_dense_[i] = 0xababababU;
  }
}

Additionally, it should be more efficient if you initialize sparse to !0 instead of 0, as this will make the membership test fail on the first condition instead of the second.

@alexcrichton
Copy link
Member Author

Sounds like this needs some more investigation.

@alexcrichton alexcrichton deleted the issue-13969 branch May 8, 2014 18:11
@thestinger
Copy link
Contributor

Reading uninitialized data is valid behaviour as long as the code is able to handle the results of reads varying each time.

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 13, 2023
…kril

Fix checkOnSave to check config patching not always working

This early return was missed in the initial PR, so if we aren't patching the `completion_addCallArgumentSnippets` `completion_addCallParenthesis` configs we won't be patching the checkOnSave ones...
bors pushed a commit to rust-lang-ci/rust that referenced this pull request Jan 28, 2025
Rerunning the PR checks when a PR is synchronized (new commits added, or
force-pushed) seems to remove the changelog checks from the UI while
keeping the PR mergeable from the maintainer's interface.

This PR reruns the cheap changelog check when a PR is synchronized.

changelog: none

r? @flip1995
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.

Valgrind errors on regex! macro usage
4 participants