diff mbox series

[fortran] Fix ICE with use of INT32 et al from ISO_FORTRAN_ENV

Message ID 4d1e1b2d-cf52-4ae7-91f5-43eb01cc310c@netcologne.de
State New
Headers show
Series [fortran] Fix ICE with use of INT32 et al from ISO_FORTRAN_ENV | expand

Commit Message

Thomas Koenig Oct. 17, 2024, 7:52 p.m. UTC
Hello world,

The attached patch fixes an ICE when an UNSIGNED-specific constant
is used from ISO_FORTRAN_ENV.  The error message is not particularly
great, it is

Error: Unsigned: The symbol 'uint32', referenced at (1), is not in the 
selected standard

but it is better than an ICE.

OK for trunk?

Best regards

	Thomas

gcc/fortran/ChangeLog:

         * error.cc (notify_std_msg): Handle GFC_STD_UNSIGNED.

gcc/testsuite/ChangeLog:

         * gfortran.dg/unsigned_37.f90: New test.

Comments

Jerry D Oct. 17, 2024, 8:56 p.m. UTC | #1
On 10/17/24 12:52 PM, Thomas Koenig wrote:
> Hello world,
> 
> The attached patch fixes an ICE when an UNSIGNED-specific constant
> is used from ISO_FORTRAN_ENV.  The error message is not particularly
> great, it is
> 
> Error: Unsigned: The symbol 'uint32', referenced at (1), is not in the 
> selected standard
> 
> but it is better than an ICE.
> 
> OK for trunk?

Looks good to me, yes OK.

Jerry

> 
> Best regards
> 
>      Thomas
> 
> gcc/fortran/ChangeLog:
> 
>          * error.cc (notify_std_msg): Handle GFC_STD_UNSIGNED.
> 
> gcc/testsuite/ChangeLog:
> 
>          * gfortran.dg/unsigned_37.f90: New test.
diff mbox series

Patch

diff --git a/gcc/fortran/error.cc b/gcc/fortran/error.cc
index d184ffd878a..afe2e49e499 100644
--- a/gcc/fortran/error.cc
+++ b/gcc/fortran/error.cc
@@ -362,6 +362,8 @@  notify_std_msg(int std)
     return _("Obsolescent feature:");
   else if (std & GFC_STD_F95_DEL)
     return _("Deleted feature:");
+  else if (std & GFC_STD_UNSIGNED)
+    return _("Unsigned:");
   else
     gcc_unreachable ();
 }
diff --git a/gcc/testsuite/gfortran.dg/unsigned_37.f90 b/gcc/testsuite/gfortran.dg/unsigned_37.f90
new file mode 100644
index 00000000000..b11f214336a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/unsigned_37.f90
@@ -0,0 +1,4 @@ 
+! { dg-do compile }
+program main
+  use iso_fortran_env, only : uint32 ! { dg-error "not in the selected standard" }
+end program main