The Go frontend was accidentally lowering binary expressions with mismatched types. It would reject two integer constant expressions with mismatched types, but would then go on to try to see if the expressions had floating point constant values. Since all integer constants can be viewed as floating point constants in Go, this would let the binary expressions be lowered as a floating point expressions, despite the mismatched types. This patch fixes the problem. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r 5c9dac6bacc3 go/expressions.cc --- a/go/expressions.cc Fri Feb 17 11:58:53 2012 -0800 +++ b/go/expressions.cc Fri Feb 17 13:38:46 2012 -0800 @@ -5564,6 +5564,7 @@ && op != OPERATOR_RSHIFT) { // May be a type error--let it be diagnosed later. + return this; } else if (is_comparison) { @@ -5667,6 +5668,7 @@ && op != OPERATOR_RSHIFT) { // May be a type error--let it be diagnosed later. + return this; } else if (is_comparison) { @@ -5750,6 +5752,7 @@ && left_type->base() != right_type->base()) { // May be a type error--let it be diagnosed later. + return this; } else if (op == OPERATOR_EQEQ || op == OPERATOR_NOTEQ) {