]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
fortran, openmp: Add default: clause in order to avoid -Wmaybe-uninitialized warning
authorJakub Jelinek <jakub@redhat.com>
Fri, 19 Dec 2025 22:10:36 +0000 (23:10 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 19 Dec 2025 22:10:36 +0000 (23:10 +0100)
While the enum has only 4 enumerators and all of them are listed, in theory values
with the enum type could contain other values and so without default:
-Wmaybe-uninitialized warning for the s variable can happen.

2025-12-19  Jakub Jelinek  <jakub@redhat.com>

* dump-parse-tree.cc (show_omp_clauses): Add default: with
gcc_unreachable () to avoid spurious -Wmaybe-uninitialized warnings.

gcc/fortran/dump-parse-tree.cc

index b081bbfc135a18f0aa9ea96d5fe7d64e9b30ecb0..1580a7ee666c282c4e084c380c3c6555d38358a2 100644 (file)
@@ -1994,7 +1994,9 @@ show_omp_clauses (gfc_omp_clauses *omp_clauses)
        case OMP_DEVICE_TYPE_HOST: s = "host"; break;
        case OMP_DEVICE_TYPE_NOHOST: s = "nohost"; break;
        case OMP_DEVICE_TYPE_ANY: s = "any"; break;
-       case OMP_DEVICE_TYPE_UNSET: gcc_unreachable ();
+       case OMP_DEVICE_TYPE_UNSET:
+       default:
+         gcc_unreachable ();
        }
       fputs (" DEVICE_TYPE(", dumpfile);
       fputs (s, dumpfile);