[build] Address warnings in gcc 11 and 12.

TEST=local builds
Bug: https://github.com/dart-lang/sdk/issues/50645
Change-Id: If6cd26620feff06abd449be0f7d1dd1e620b8411
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275841
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
diff --git a/runtime/vm/cpuinfo_linux.cc b/runtime/vm/cpuinfo_linux.cc
index 27cc16e..22e86cb 100644
--- a/runtime/vm/cpuinfo_linux.cc
+++ b/runtime/vm/cpuinfo_linux.cc
@@ -67,6 +67,7 @@
 bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) {
   if (method_ == kCpuInfoCpuId) {
     const char* field = CpuId::field(idx);
+    if (field == NULL) return false;
     bool contains = (strstr(field, search_string) != NULL);
     free(const_cast<char*>(field));
     return contains;
diff --git a/runtime/vm/image_snapshot.cc b/runtime/vm/image_snapshot.cc
index c11a5fa..912eb13 100644
--- a/runtime/vm/image_snapshot.cc
+++ b/runtime/vm/image_snapshot.cc
@@ -640,6 +640,7 @@
     case ProgramSection::BuildId:
       return kSnapshotBuildIdAsmSymbol;
   }
+  UNREACHABLE();
   return nullptr;
 }