[vm] Adjust MSAN compile flags to match google3 to reproduce MSAN error in the regexp interpreter.

TEST=msan
Bug: b/489355669
Change-Id: I3ade526a67e5e7d95c8d8862eb92924337057d94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/485240
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
This commit is contained in:
Ryan Macnak
2026-03-04 13:45:22 -08:00
committed by Commit Queue
parent 848738508c
commit b52575161d
3 changed files with 20 additions and 6 deletions
+10 -1
View File
@@ -156,7 +156,16 @@ config("compiler") {
ldflags += [ "-fsanitize=leak" ]
}
if (is_msan) {
cflags += [ "-fsanitize=memory" ]
cflags += [
"-fsanitize=memory",
# Matching the google3 settings. Whether MSAN reports a use of an
# uninitialized value is sensitive to inlining.
"-mllvm",
"-inline-instr-cost=20",
"-mllvm",
"-inline-memaccess-cost=20",
]
ldflags += [ "-fsanitize=memory" ]
}
if (is_tsan) {
@@ -0,0 +1,9 @@
// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Regression test for b/489355669
main() {
print(new RegExp(r"[^a-df-z\s]+", caseSensitive: false).firstMatch("900s"));
}
+1 -5
View File
@@ -175,7 +175,7 @@ class InterpreterRegisters {
InterpreterRegisters(int total_register_count,
RegisterT* output_registers,
int output_register_count)
: registers_(total_register_count, 0),
: registers_(total_register_count, kNoMatchValue),
output_registers_(output_registers),
total_register_count_(total_register_count),
output_register_count_(output_register_count) {
@@ -186,10 +186,6 @@ class InterpreterRegisters {
SBXCHECK_GE(total_register_count, output_register_count);
SBXCHECK_LE(total_register_count, RegExpMacroAssembler::kMaxRegisterCount);
DCHECK_NOT_NULL(output_registers);
// Initialize the output register region to -1 signifying 'no match'.
std::memset(registers_.data(), kNoMatchValue,
output_register_count * sizeof(RegisterT));
USE(total_register_count_);
}