https://gcc.gnu.org/g:67356e61bd58ed17e4d5e67624a17a39e592fb5d

commit r16-6303-g67356e61bd58ed17e4d5e67624a17a39e592fb5d
Author: Jakub Jelinek <[email protected]>
Date:   Fri Dec 19 23:10:36 2025 +0100

    fortran, openmp: Add default: clause in order to avoid 
-Wmaybe-uninitialized warning
    
    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  <[email protected]>
    
            * dump-parse-tree.cc (show_omp_clauses): Add default: with
            gcc_unreachable () to avoid spurious -Wmaybe-uninitialized warnings.

Diff:
---
 gcc/fortran/dump-parse-tree.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc
index b081bbfc135a..1580a7ee666c 100644
--- a/gcc/fortran/dump-parse-tree.cc
+++ b/gcc/fortran/dump-parse-tree.cc
@@ -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);

Reply via email to