diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-10-06 10:06:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-06 10:06:57 +0000 |
commit | 40f8c333fe94906eedf792cfd1c74ea52e74caab (patch) | |
tree | 25f875466841dd87319e41af5499b3c46f37a7ba | |
parent | 82971d968b02eedf8e21bda681a27c9e5a3547fe (diff) | |
parent | 5a87f5f469bb214da2ace06c5a24775044c608fc (diff) | |
download | gcc-40f8c333fe94906eedf792cfd1c74ea52e74caab.zip gcc-40f8c333fe94906eedf792cfd1c74ea52e74caab.tar.gz gcc-40f8c333fe94906eedf792cfd1c74ea52e74caab.tar.bz2 |
Merge #1554
1554: testing: try loop in const function r=philberty a=abbasfaisal
Co-authored-by: Faisal Abbas <faisal.abbas@elastica.co>
-rw-r--r-- | gcc/testsuite/rust/compile/const9.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/const9.rs b/gcc/testsuite/rust/compile/const9.rs new file mode 100644 index 0000000..e71a62a --- /dev/null +++ b/gcc/testsuite/rust/compile/const9.rs @@ -0,0 +1,18 @@ +// { dg-options "-w -O0 -fdump-tree-gimple" } +const fn test(mut x: i32) -> i32 { + loop { + if x == 10 { + break; + } + + x = x + 1; + } + return x; +} + +const X: i32 = test(0); + +fn main() { + // { dg-final { scan-tree-dump-times {x = 10} 1 gimple } } + let x = X; +} |