diff --git a/Library/Homebrew/brewkit.rb b/Library/Homebrew/brewkit.rb
index 34eb28c95b6a3f1fcd43ce94ca1264d692f00ebe..451911143d78aa43ebed6fd388627f6f41aa38a1 100644
--- a/Library/Homebrew/brewkit.rb
+++ b/Library/Homebrew/brewkit.rb
@@ -110,6 +110,7 @@ module HomebrewEnvExtension
       self['CC']='gcc-4.0'
       self['CXX']='g++-4.0'
       remove_from_cflags '-march=core2'
+      self.O3
     end
     remove_from_cflags '-msse4.1'
     remove_from_cflags '-msse4.2'
@@ -119,6 +120,12 @@ module HomebrewEnvExtension
     remove_from_cflags '-O4'
     append_to_cflags '-O3'
   end
+  def gcc_4_2
+    # Sometimes you want to downgrade from LLVM to GCC 4.2
+    self['CC']="gcc-4.2"
+    self['CXX']="g++-4.2"
+    self.O3
+  end
   def osx_10_4
     self['MACOSX_DEPLOYMENT_TARGET']=nil
     remove_from_cflags(/ ?-mmacosx-version-min=10\.\d/)
diff --git a/Library/Homebrew/unittest.rb b/Library/Homebrew/unittest.rb
index 082306069edc75ee9bd1707371f3978c8a33984a..0968e8f5ff6d1e73c9a3817fcf23569c91ca05e2 100755
--- a/Library/Homebrew/unittest.rb
+++ b/Library/Homebrew/unittest.rb
@@ -607,6 +607,19 @@ class BeerTasting <Test::Unit::TestCase
     end
     @fixture_data
   end
+  
+  def test_ENV_options
+    ENV.gcc_4_0_1
+    ENV.gcc_4_2
+    ENV.O3
+    ENV.minimal_optimization
+    ENV.no_optimization
+    ENV.libxml2
+    ENV.x11
+    ENV.enable_warnings
+    assert !ENV.cc.empty?
+    assert !ENV.cxx.empty?
+  end
 end
 
 __END__