diff options
author | Yohann Roussel <yroussel@google.com> | 2014-03-19 16:25:37 +0100 |
---|---|---|
committer | Yohann Roussel <yroussel@google.com> | 2014-03-20 15:13:33 +0100 |
commit | 4eceb95409e844fdc33c9c706e1dc307bfd40303 (patch) | |
tree | ee9f4f3fc79f757c79081c336bce4f1782c6ccd8 /jack-tests/tests/com/android/jack/flow | |
parent | 3d2402901b1a6462e2cf47a6fd09711f327961c3 (diff) | |
download | toolchain_jack-4eceb95409e844fdc33c9c706e1dc307bfd40303.zip toolchain_jack-4eceb95409e844fdc33c9c706e1dc307bfd40303.tar.gz toolchain_jack-4eceb95409e844fdc33c9c706e1dc307bfd40303.tar.bz2 |
Initial Jack import.
Change-Id: I953cf0a520195a7187d791b2885848ad0d5a9b43
Diffstat (limited to 'jack-tests/tests/com/android/jack/flow')
13 files changed, 834 insertions, 0 deletions
diff --git a/jack-tests/tests/com/android/jack/flow/cfg001/dx/Tests.java b/jack-tests/tests/com/android/jack/flow/cfg001/dx/Tests.java new file mode 100644 index 0000000..cc4a60d --- /dev/null +++ b/jack-tests/tests/com/android/jack/flow/cfg001/dx/Tests.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.flow.cfg001.dx; + +import com.android.jack.flow.cfg001.jack.LinkIterator; + +import org.junit.Test; + +public class Tests { + + @Test + public void test_001() { + new LinkIterator<Object>(10, 0); + } + + @Test + public void test_002() { + new LinkIterator<Object>(10, 0, 3); + } + + @Test + public void test_003() { + new LinkIterator<Object>(10, 0, (byte) 3); + } +} diff --git a/jack-tests/tests/com/android/jack/flow/cfg001/jack/LinkIterator.java b/jack-tests/tests/com/android/jack/flow/cfg001/jack/LinkIterator.java new file mode 100644 index 0000000..9ff3c03 --- /dev/null +++ b/jack-tests/tests/com/android/jack/flow/cfg001/jack/LinkIterator.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.flow.cfg001.jack; + + +public class LinkIterator<ET> { + int pos; + int link; + + public LinkIterator(int size, int location) { + if (location >= 0) { + } else { + throw new IndexOutOfBoundsException(); + } + } + + public LinkIterator(int size, int location, int unused) { + if (location >= 0 && location <= size) { + if(size == 0) { + location = 3; + } else { + location = 5; + } + } else { + throw new IndexOutOfBoundsException(); + } +} + + public LinkIterator(int size, int location, byte unused) { + if (location >= 0) { + if (location < size / 2) { + link = 0; + for (pos = -1; pos + 1 < location; pos++) { + link ++; + } + } else { + for (pos = size; pos >= location; pos--) { + link --; + } + } + } else { + throw new IndexOutOfBoundsException(); + } +} + +} diff --git a/jack-tests/tests/com/android/jack/flow/loop/dx/Tests.java b/jack-tests/tests/com/android/jack/flow/loop/dx/Tests.java new file mode 100644 index 0000000..0ffc613 --- /dev/null +++ b/jack-tests/tests/com/android/jack/flow/loop/dx/Tests.java @@ -0,0 +1,171 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.flow.loop.dx; + +import com.android.jack.flow.loop.jack.InfiniteLoop; +import com.android.jack.flow.loop.jack.LoopDoWhileBreak; +import com.android.jack.flow.loop.jack.LoopDoWhileContinue; +import com.android.jack.flow.loop.jack.LoopDoWhileLiteral; +import com.android.jack.flow.loop.jack.LoopForBreak; +import com.android.jack.flow.loop.jack.LoopForContinue; +import com.android.jack.flow.loop.jack.LoopWhileBreak; +import com.android.jack.flow.loop.jack.LoopWhileContinue; +import com.android.jack.flow.loop.jack.NoMoreStatementBug; + +import junit.framework.Assert; + +import org.junit.Test; + +public class Tests { + + @Test + public void loopForBreak() { + LoopForBreak l = new LoopForBreak(); + Assert.assertEquals(5, l.loop()); + } + @Test + public void loopForBreakWithLabel() { + LoopForBreak l = new LoopForBreak(); + Assert.assertEquals(5, l.loopWithLabel()); + } + @Test + public void loopForBreakWithUnusedLabel() { + LoopForBreak l = new LoopForBreak(); + Assert.assertEquals(10, l.loopWithUnusedLabel()); + } + @Test + public void loopDoWhileBreak() { + LoopDoWhileBreak l = new LoopDoWhileBreak(); + Assert.assertEquals(5, l.loop()); + } + @Test + public void loopDoWhileBreakWithLabel() { + LoopDoWhileBreak l = new LoopDoWhileBreak(); + Assert.assertEquals(5, l.loopWithLabel()); + } + @Test + public void loopDoWhileFalse() { + LoopDoWhileLiteral l = new LoopDoWhileLiteral(); + Assert.assertEquals(2, l.doWhileFalse()); + } + @Test + public void loopDoWhileTrue() { + LoopDoWhileLiteral l = new LoopDoWhileLiteral(); + Assert.assertEquals(128, l.doWhileTrue()); + } + @Test + public void loopDoWhileBreakWithUnusedLabel() { + LoopDoWhileBreak l = new LoopDoWhileBreak(); + Assert.assertEquals(10, l.loopWithUnusedLabel()); + } + @Test + public void loopWhileBreak() { + LoopWhileBreak l = new LoopWhileBreak(); + Assert.assertEquals(5, l.loop()); + } + @Test + public void loopWhileBreakWithLabel() { + LoopWhileBreak l = new LoopWhileBreak(); + Assert.assertEquals(5, l.loopWithLabel()); + } + @Test + public void loopWhileBreakWithUnusedLabel() { + LoopWhileBreak l = new LoopWhileBreak(); + Assert.assertEquals(10, l.loopWithUnusedLabel()); + } + @Test + public void loopWhileContinue() { + LoopWhileContinue l = new LoopWhileContinue(); + Assert.assertEquals(40, l.loop()); + } + @Test + public void loopWhileContinueWithLabel() { + LoopWhileContinue l = new LoopWhileContinue(); + Assert.assertEquals(40, l.loopWithLabel()); + } + @Test + public void loopWhileContinueWithUnusedLabel() { + LoopWhileContinue l = new LoopWhileContinue(); + Assert.assertEquals(45, l.loopWithUnusedLabel()); + } + @Test + public void loopForContinue() { + LoopForContinue l = new LoopForContinue(); + Assert.assertEquals(40, l.loop()); + } + @Test + public void loopForContinueWithLabel() { + LoopForContinue l = new LoopForContinue(); + Assert.assertEquals(40, l.loopWithLabel()); + } + + @Test + public void loopForContinueWithUnusedLabel() { + LoopForContinue l = new LoopForContinue(); + Assert.assertEquals(45, l.loopWithUnusedLabel()); + } + @Test + public void loopDoWhileContinue() { + LoopDoWhileContinue l = new LoopDoWhileContinue(); + Assert.assertEquals(40, l.loop()); + } + @Test + public void loopDoWhileContinueWithLabel() { + LoopDoWhileContinue l = new LoopDoWhileContinue(); + Assert.assertEquals(40, l.loopWithLabel()); + } + @Test + public void loopDoWhileContinueWithUnusedLabel() { + LoopDoWhileContinue l = new LoopDoWhileContinue(); + Assert.assertEquals(45, l.loopWithUnusedLabel()); + } + @Test + public void noMoreStatementBug() { + NoMoreStatementBug l = new NoMoreStatementBug(); + Assert.assertEquals(40, l.loop()); + } + + @Test + public void infiniteLoop001() { + Assert.assertEquals(5, InfiniteLoop.infiniteLoop001()); + } + + @Test + public void infiniteLoop002() { + Assert.assertEquals(5, InfiniteLoop.infiniteLoop002()); + } + + @Test + public void infiniteLoop003() { + Assert.assertEquals(5, InfiniteLoop.infiniteLoop003()); + } + + @Test + public void infiniteLoop004() { + Assert.assertEquals(5, InfiniteLoop.infiniteLoop004()); + } + + @Test + public void infiniteLoop005() { + Assert.assertEquals(5, InfiniteLoop.infiniteLoop005()); + } + + @Test + public void infiniteLoop006() { + Assert.assertEquals(5, InfiniteLoop.infiniteLoop006()); + } +} diff --git a/jack-tests/tests/com/android/jack/flow/loop/jack/InfiniteLoop.java b/jack-tests/tests/com/android/jack/flow/loop/jack/InfiniteLoop.java new file mode 100644 index 0000000..282b373 --- /dev/null +++ b/jack-tests/tests/com/android/jack/flow/loop/jack/InfiniteLoop.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.flow.loop.jack; + +public class InfiniteLoop { + + public static final boolean TRUE = true; + + public static int infiniteLoop001() { + for (int i = 0;; i++) { + if (i == 5) { + return i; + } + } + } + + public static int infiniteLoop002() { + for (int i = 0; false || TRUE; i++) { + if (i == 5) { + return i; + } + } + } + + public static int infiniteLoop003() { + int i = 0; + while(false || TRUE) { + if (i == 5) { + return i; + } + i++; + } + } + + public static int infiniteLoop004() { + int i = 0; + while(true) { + if (i == 5) { + return i; + } + i++; + } + } + + public static int infiniteLoop005() { + int i = 0; + do { + if (i == 5) { + return i; + } + i++; + } while(true); + } + + public static int infiniteLoop006() { + int i = 0; + do { + if (i == 5) { + return i; + } + i++; + } while(false || TRUE); + } +}
\ No newline at end of file diff --git a/jack-tests/tests/com/android/jack/flow/loop/jack/LoopDoWhileBreak.java b/jack-tests/tests/com/android/jack/flow/loop/jack/LoopDoWhileBreak.java new file mode 100644 index 0000000..5cf0097 --- /dev/null +++ b/jack-tests/tests/com/android/jack/flow/loop/jack/LoopDoWhileBreak.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.flow.loop.jack; + +public class LoopDoWhileBreak { + + public int loop() { + int a = 0; + int i = 0; + do { + a = a + 1; + if (a == 5) + break; + i = i + 1; + } while ( i < 10 ); + return a; + } + + public int loopWithLabel() { + int a = 0; + int i = 0; + label: + do { + a = a + 1; + do { + if (a == 5) + break label; + } while (a < 0); + i = i + 1; + } while ( i < 10 ); + return a; + } + + public int loopWithUnusedLabel() { + int a = 0; + int i = 0; + label: + do { + a = a + 1; + do { + if (a == 5) + break; + } while (a < 0); + i = i + 1; + } while ( i < 10 ); + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/flow/loop/jack/LoopDoWhileContinue.java b/jack-tests/tests/com/android/jack/flow/loop/jack/LoopDoWhileContinue.java new file mode 100644 index 0000000..7531318 --- /dev/null +++ b/jack-tests/tests/com/android/jack/flow/loop/jack/LoopDoWhileContinue.java @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.flow.loop.jack; + +public class LoopDoWhileContinue { + + public int loop() { + int a = 0; + int i = 0; + do { + i = i + 1; + if (i == 5) + continue; + a = a + i; + } while ( i < 9 ); + return a; + } + + public int loopWithLabel() { + int a = 0; + int i = 0; + label: + do { + i = i + 1; + do { + if (i == 5) + continue label; + } + while (i<0); + a = a + i; + } while ( i < 9 ); + return a; + } + + public int loopWithUnusedLabel() { + int a = 0; + int i = 0; + label: + do { + i = i + 1; + do { + if (i == 5) + continue; + } + while (i<0); + a = a + i; + } while ( i < 9 ); + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/flow/loop/jack/LoopDoWhileLiteral.java b/jack-tests/tests/com/android/jack/flow/loop/jack/LoopDoWhileLiteral.java new file mode 100644 index 0000000..0b3524c --- /dev/null +++ b/jack-tests/tests/com/android/jack/flow/loop/jack/LoopDoWhileLiteral.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.flow.loop.jack; + +public class LoopDoWhileLiteral { + + public int doWhileFalse() { + int a = 1; + do { + a = a * 2; + } while (false); + return a; + } + + public int doWhileTrue() { + int a = 1; + do { + a = a * 2; + if (a >= 128) { + return a; + } + } while (true); + } + +} diff --git a/jack-tests/tests/com/android/jack/flow/loop/jack/LoopForBreak.java b/jack-tests/tests/com/android/jack/flow/loop/jack/LoopForBreak.java new file mode 100644 index 0000000..da368fd --- /dev/null +++ b/jack-tests/tests/com/android/jack/flow/loop/jack/LoopForBreak.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.flow.loop.jack; + +public class LoopForBreak { + + public int loop() { + int a = 0; + for (int i = 0; i < 10; i = i + 1) { + a = a + 1; + if (a == 5) + break; + } + return a; + } + + public int loopWithLabel() { + int a = 0; + label: + for (int i = 0; i < 10; i = i + 1) { + a = a + 1; + for (int j = 0; j < 1; j = j + 1) { + if (a == 5) + break label; + } + } + return a; + } + + public int loopWithUnusedLabel() { + int a = 0; + label: + for (int i = 0; i < 10; i = i + 1) { + a = a + 1; + for (int j = 0; j < 1; j = j + 1) { + if (a == 5) + break; + } + } + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/flow/loop/jack/LoopForContinue.java b/jack-tests/tests/com/android/jack/flow/loop/jack/LoopForContinue.java new file mode 100644 index 0000000..57d5e56 --- /dev/null +++ b/jack-tests/tests/com/android/jack/flow/loop/jack/LoopForContinue.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.flow.loop.jack; + +public class LoopForContinue { + + public int loop() { + int a = 0; + for (int i = 0; i < 10; i = i + 1) { + if (i == 5) + continue; + a = a + i; + } + return a; + } + + public int loopWithLabel() { + int a = 0; + label: + for (int i = 0; i < 10; i = i + 1) { + for (int j = 0; j<1; j = j + 1) { + if (i == 5) + continue label; + } + a = a + i; + } + return a; + } + + public int loopWithUnusedLabel() { + int a = 0; + label: + for (int i = 0; i < 10; i = i + 1) { + for (int j = 0; j<1; j = j + 1) { + if (i == 5) + continue; + } + a = a + i; + } + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/flow/loop/jack/LoopInInit.java b/jack-tests/tests/com/android/jack/flow/loop/jack/LoopInInit.java new file mode 100644 index 0000000..08d311c --- /dev/null +++ b/jack-tests/tests/com/android/jack/flow/loop/jack/LoopInInit.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.flow.loop.jack; + +public class LoopInInit { + { + for (int i = 1; i < 1; ); + do {} while (false); + int i = 5; + while(i == 5) { + break; + } + + } +} diff --git a/jack-tests/tests/com/android/jack/flow/loop/jack/LoopWhileBreak.java b/jack-tests/tests/com/android/jack/flow/loop/jack/LoopWhileBreak.java new file mode 100644 index 0000000..421952e --- /dev/null +++ b/jack-tests/tests/com/android/jack/flow/loop/jack/LoopWhileBreak.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.flow.loop.jack; + +public class LoopWhileBreak { + + public int loop() { + int a = 0; + int i = 0; + while ( i < 10 ) { + a = a + 1; + if (a == 5) + break; + i = i + 1; + } + return a; + } + + public int loopWithLabel() { + int a = 0; + int i = 0; + label: + while ( i < 10 ) { + a = a + 1; + boolean bool = true; + while (bool) { + if (a == 5) + break label; + bool = false; + } + i = i + 1; + } + return a; + } + + public int loopWithUnusedLabel() { + int a = 0; + int i = 0; + label: + while ( i < 10 ) { + a = a + 1; + boolean bool = true; + while (bool) { + bool = false; + if (a == 5) + break; + } + i = i + 1; + } + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/flow/loop/jack/LoopWhileContinue.java b/jack-tests/tests/com/android/jack/flow/loop/jack/LoopWhileContinue.java new file mode 100644 index 0000000..743f403 --- /dev/null +++ b/jack-tests/tests/com/android/jack/flow/loop/jack/LoopWhileContinue.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.flow.loop.jack; + +public class LoopWhileContinue { + + public int loop() { + int a = 0; + int i = 0; + while ( i < 9 ) { + i = i + 1; + if (i == 5) + continue; + a = a + i; + } + return a; + } + + public int loopWithLabel() { + int a = 0; + int i = 0; + label: + while ( i < 9 ) { + i = i + 1; + boolean bool = true; + while(bool) { + if (i == 5) + continue label; + bool = false; + } + a = a + i; + } + return a; + } + + public int loopWithUnusedLabel() { + int a = 0; + int i = 0; + label: + while ( i < 9 ) { + i = i + 1; + boolean bool = true; + while(bool) { + bool = false; + if (i == 5) + continue; + } + a = a + i; + } + return a; + } +} diff --git a/jack-tests/tests/com/android/jack/flow/loop/jack/NoMoreStatementBug.java b/jack-tests/tests/com/android/jack/flow/loop/jack/NoMoreStatementBug.java new file mode 100644 index 0000000..d103875 --- /dev/null +++ b/jack-tests/tests/com/android/jack/flow/loop/jack/NoMoreStatementBug.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.jack.flow.loop.jack; + +public class NoMoreStatementBug { + + public int loop() { + int a = 0; + label: { + for (int i = 0; i < 10; i = i + 1) { + if (i == 5) + continue; + a = a + i; + } + return a; + } + } +} |