pw_presubmit: Fix quick gcc build

Change-Id: Ibe5fa35a513247a62b1cd5d0f65c2fec7eec6fa4
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/35480
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
diff --git a/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py b/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
index 5aba4a3..7a25669 100755
--- a/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
+++ b/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
@@ -91,7 +91,14 @@
 @filter_paths(endswith=_BUILD_EXTENSIONS)
 def gn_quick_build_check(ctx: PresubmitContext):
     build.gn_gen(ctx.root, ctx.output_dir)
-    build.ninja(ctx.output_dir, f'host_{_HOST_COMPILER}_size_optimized',
+
+    # TODO(pwbug/255): Switch to optimized GCC builds when this is fixed.
+    # See comment in _at_all_optimization_levels() above for details.
+    optimization_level = 'size_optimized'
+    if _HOST_COMPILER == 'gcc':
+        optimization_level = 'debug'
+
+    build.ninja(ctx.output_dir, f'host_{_HOST_COMPILER}_{optimization_level}',
                 'stm32f429i_size_optimized', 'python.tests', 'python.lint')