[gcc r12-6101] Fortran: BOZ literal constants are not interoperable
Harald Anlauf
anlauf@gcc.gnu.org
Wed Dec 22 19:09:13 GMT 2021
https://gcc.gnu.org/g:ff0ad4b5e16b8828a6147ae2d5fec8068ef0778e
commit r12-6101-gff0ad4b5e16b8828a6147ae2d5fec8068ef0778e
Author: Harald Anlauf <anlauf@gmx.de>
Date: Mon Dec 20 22:12:33 2021 +0100
Fortran: BOZ literal constants are not interoperable
gcc/fortran/ChangeLog:
PR fortran/103778
* check.c (is_c_interoperable): A BOZ literal constant is not
interoperable.
gcc/testsuite/ChangeLog:
PR fortran/103778
* gfortran.dg/illegal_boz_arg_3.f90: New test.
Diff:
---
gcc/fortran/check.c | 6 ++++++
gcc/testsuite/gfortran.dg/illegal_boz_arg_3.f90 | 7 +++++++
2 files changed, 13 insertions(+)
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 625473c90d1..b4db9337e9f 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -5185,6 +5185,12 @@ is_c_interoperable (gfc_expr *expr, const char **msg, bool c_loc, bool c_f_ptr)
return false;
}
+ if (expr->ts.type == BT_BOZ)
+ {
+ *msg = "BOZ literal constant";
+ return false;
+ }
+
if (expr->ts.type == BT_CLASS)
{
*msg = "Expression is polymorphic";
diff --git a/gcc/testsuite/gfortran.dg/illegal_boz_arg_3.f90 b/gcc/testsuite/gfortran.dg/illegal_boz_arg_3.f90
new file mode 100644
index 00000000000..59fefa90971
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/illegal_boz_arg_3.f90
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR fortran/103778
+
+program p
+ use iso_c_binding, only : c_sizeof
+ integer, parameter :: a = c_sizeof(z'1') ! { dg-error "cannot appear" }
+end
More information about the Gcc-cvs
mailing list