cmd/go: preserve CC for TestScript child processes

Change-Id: I58fb051fb03abc601d95956f5e95af5fcf814617
Reviewed-on: https://go-review.googlesource.com/c/158838
Reviewed-by: Than McIntosh <thanm@google.com>
diff --git a/libgo/go/cmd/go/script_test.go b/libgo/go/cmd/go/script_test.go
index 1acc61f..3002db7 100644
--- a/libgo/go/cmd/go/script_test.go
+++ b/libgo/go/cmd/go/script_test.go
@@ -83,13 +83,12 @@
 }
 
 var extraEnvKeys = []string{
-	"SYSTEMROOT",      // must be preserved on Windows to find DLLs; golang.org/issue/25210
-	"LD_LIBRARY_PATH", // must be preserved on Unix systems to find shared libraries
-
-	// For gccgo testing.
-	"GO_TESTING_GOTOOLS",
-	"GCCGO",
-	"GCCGOTOOLDIR",
+	"SYSTEMROOT",         // must be preserved on Windows to find DLLs; golang.org/issue/25210
+	"LD_LIBRARY_PATH",    // must be preserved on Unix systems to find shared libraries
+	"CC",                 // don't lose user settings when invoking cgo
+	"GO_TESTING_GOTOOLS", // for gccgo testing
+	"GCCGO",              // for gccgo testing
+	"GCCGOTOOLDIR",       // for gccgo testing
 }
 
 // setup sets up the test execution temporary directory and environment.