Skip to content

Commit

Permalink
gccrs: Fix scan-gimple testcases on LE platforms.
Browse files Browse the repository at this point in the history
gcc/testsuite/ChangeLog:

	* rust/compile/macros/builtin/eager1.rs: Switch to scan-assembler directive as the
	GIMPLE dump does not contain strings on LE.
	* rust/compile/macros/builtin/recurse2.rs: Likewise.
  • Loading branch information
CohenArthur authored and philberty committed Jan 10, 2025
1 parent 828b935 commit 65ef110
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gcc/testsuite/rust/compile/macros/builtin/eager1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ macro_rules! b {
}

fn main() {
// { dg-final { scan-tree-dump-times {"test1canary"} 1 gimple } }
// { dg-final { scan-assembler {"test1canary"} } }
let _ = concat!(a!(), 1, b!());
// should not error
concat!(a!(), true, b!(),);
Expand Down
26 changes: 24 additions & 2 deletions gcc/testsuite/rust/compile/macros/builtin/recurse2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,29 @@ macro_rules! a {
};
}

extern "C" {
fn printf(fmt: *const i8, ...);
}

fn print_ptr(s: &str) {
unsafe {
printf("%p\n\0" as *const str as *const i8, s as *const str);
}
}

fn print_str(s: &str) {
unsafe {
printf(
"%s\n\0" as *const str as *const i8,
s as *const str as *const i8,
);
}
}

// { dg-final { scan-assembler {"abheyho"} } }
static S: &str = concat!("a", 'b', a!(), a!(b c d e f a!()), '\0');

fn main() {
// { dg-final { scan-tree-dump-times {"abheyho"} 1 gimple } }
let _ = concat!("a", 'b', a!(), a!(b c d e f a!()), '\0');
print_ptr(S);
print_str(S);
}

0 comments on commit 65ef110

Please sign in to comment.