3 // Copyright 2018 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 // Issue 26495: gccgo produces incorrect order of evaluation
8 // for expressions involving &&, || subexpressions.
14 func checkorder(order int) {
16 panic("FAIL: wrong evaluation order")
21 func A() bool { checkorder(1); return true }
22 func B() bool { checkorder(2); return true }
23 func C() bool { checkorder(5); return false }
24 func D() bool { panic("FAIL: D should not be called") }
25 func E() int { checkorder(3); return 0 }
26 func F() int { checkorder(0); return 0 }
27 func G(bool) int { checkorder(9); return 0 }
28 func H(int, bool, int) int { checkorder(7); return 0 }
29 func I(int) bool { checkorder(8); return true }
30 func J() int { checkorder(4); return 0 }
31 func K() int { checkorder(6); return 0 }
32 func L() int { checkorder(10); return 0 }
35 _ = F() + G(A() && B() && I(E()+H(J(), C() && D(), K()))) + L()