public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-10362] Fortran: BOZ literal constants are not interoperable
@ 2021-12-27 20:04 Harald Anlauf
  0 siblings, 0 replies; only message in thread
From: Harald Anlauf @ 2021-12-27 20:04 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:715842b02f8828f28affdbb5e164013c172a3fb9

commit r10-10362-g715842b02f8828f28affdbb5e164013c172a3fb9
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.
    
    (cherry picked from commit ff0ad4b5e16b8828a6147ae2d5fec8068ef0778e)

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 6a5b842d5a1..eab12e93887 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -5194,6 +5194,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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-27 20:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-27 20:04 [gcc r10-10362] Fortran: BOZ literal constants are not interoperable Harald Anlauf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).