]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix an ICE with UNSIGNED in match_sym_complex_part.
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sat, 19 Oct 2024 08:26:17 +0000 (10:26 +0200)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sat, 19 Oct 2024 08:26:17 +0000 (10:26 +0200)
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.

gcc/fortran/primary.cc
gcc/testsuite/gfortran.dg/unsigned_38.f90 [new file with mode: 0644]

index c11359a559b21d87a07dad94e446b541686f5de6..e114bf1375f095db8da5af6f4983d62028895550 100644 (file)
@@ -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 (file)
index 0000000..0d169ac
--- /dev/null
@@ -0,0 +1,6 @@
+! { dg-do compile }
+! { dg-options "-funsigned" }
+program main
+  unsigned, parameter :: u = 7u
+  print *,mod(-(u+1u),u)
+end program main