Hello world,

I have just committed the attached patch as obvious - just recognize
that an UNSIGNED is an error in a complex part.

Fix an ICE with UNSIGNED in match_sym_complex_part.

gcc/fortran/ChangeLog:

        PR fortran/117225
        * primary.cc (match_sym_complex_part): An UNSIGNED in
        a complex part is an error.

gcc/testsuite/ChangeLog:

        PR fortran/117225
        * gfortran.dg/unsigned_38.f90: New test.
diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc
index c11359a559b..e114bf1375f 100644
--- a/gcc/fortran/primary.cc
+++ b/gcc/fortran/primary.cc
@@ -1471,6 +1471,9 @@ match_sym_complex_part (gfc_expr **result)
 	goto error;
       break;
 
+    case BT_UNSIGNED:
+      goto error;
+
     default:
       gfc_internal_error ("gfc_match_sym_complex_part(): Bad type");
     }
diff --git a/gcc/testsuite/gfortran.dg/unsigned_38.f90 b/gcc/testsuite/gfortran.dg/unsigned_38.f90
new file mode 100644
index 00000000000..0d169ac92d3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/unsigned_38.f90
@@ -0,0 +1,6 @@
+! { dg-do compile }
+! { dg-options "-funsigned" }
+program main
+  unsigned, parameter :: u = 7u
+  print *,mod(-(u+1u),u)
+end program main

Reply via email to