diff options
author | Faisal Abbas <faisal.abbas@elastica.co> | 2022-10-03 19:32:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-03 19:32:30 +0100 |
commit | 5a87f5f469bb214da2ace06c5a24775044c608fc (patch) | |
tree | 0e14dbb9bcff1f5b4b79b44455bbe4dd0c9951f2 | |
parent | 9b1ba11b0b2f873b85dfc7643fe778e974e874b8 (diff) | |
download | gcc-5a87f5f469bb214da2ace06c5a24775044c608fc.zip gcc-5a87f5f469bb214da2ace06c5a24775044c608fc.tar.gz gcc-5a87f5f469bb214da2ace06c5a24775044c608fc.tar.bz2 |
testing: try loop in const function
Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
-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; +} |