[COMMITTED 061/144] gccrs: Fix v0-mangle1.rs test when run with ASAN

arthur.cohen@embecosm.com arthur.cohen@embecosm.com
Wed Mar 19 14:43:42 GMT 2025


From: Owen Avery <powerboat9.gamer@gmail.com>

gcc/rust/ChangeLog:

	* util/rust-canonical-path.h
	(CanonicalPath::CanonicalPath): Properly initialize crate_num
	with copy constructor.

gcc/testsuite/ChangeLog:

	* rust/compile/v0-mangle1.rs: Make v0-mangle test more crate_num
	agnostic.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
---
 gcc/rust/util/rust-canonical-path.h      | 4 +++-
 gcc/testsuite/rust/compile/v0-mangle1.rs | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/rust/util/rust-canonical-path.h b/gcc/rust/util/rust-canonical-path.h
index af151c2db69..4d8f9542c8b 100644
--- a/gcc/rust/util/rust-canonical-path.h
+++ b/gcc/rust/util/rust-canonical-path.h
@@ -46,7 +46,9 @@ namespace Resolver {
 class CanonicalPath
 {
 public:
-  CanonicalPath (const CanonicalPath &other) : segs (other.segs) {}
+  CanonicalPath (const CanonicalPath &other)
+    : segs (other.segs), crate_num (other.crate_num)
+  {}
 
   CanonicalPath &operator= (const CanonicalPath &other)
   {
diff --git a/gcc/testsuite/rust/compile/v0-mangle1.rs b/gcc/testsuite/rust/compile/v0-mangle1.rs
index a34f1a70112..04c546e351a 100644
--- a/gcc/testsuite/rust/compile/v0-mangle1.rs
+++ b/gcc/testsuite/rust/compile/v0-mangle1.rs
@@ -36,7 +36,7 @@ fn main() {
     // cf. rustc 1.72.0: _RNvNtCshIBIgX6Bzox_10v0_mangle18module_a3bar
     module_a::bar();
 
-    // { dg-final { scan-assembler "_R.*NvNtNtC10v0_mangle18module_a8module_b3baz" } }
+    // { dg-final { scan-assembler "_R.*NvNtNtC.*10v0_mangle18module_a8module_b3baz" } }
     // cf. rustc 1.72.0: _RNvNtNtCshIBIgX6Bzox_10v0_mangle18module_a8module_b3baz
     module_a::module_b::baz();
 
-- 
2.45.2



More information about the Gcc-rust mailing list