public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-9402] Fortran: reject BOZ type argument to SIZEOF(). Date: Sun, 19 Dec 2021 20:05:02 +0000 (GMT) [thread overview] Message-ID: <20211219200502.8D6463858400@sourceware.org> (raw) https://gcc.gnu.org/g:4f9ad140c6c2ca51b591f44f7579cc3b81356291 commit r11-9402-g4f9ad140c6c2ca51b591f44f7579cc3b81356291 Author: Harald Anlauf <anlauf@gmx.de> Date: Sat Dec 18 23:21:35 2021 +0100 Fortran: reject BOZ type argument to SIZEOF(). gcc/fortran/ChangeLog: PR fortran/103412 * check.c (gfc_check_sizeof): Reject BOZ type argument. gcc/testsuite/ChangeLog: PR fortran/103412 * gfortran.dg/illegal_boz_arg_2.f90: New test. (cherry picked from commit fd74a2ee40456a1d1621e88738f8e57536194080) Diff: --- gcc/fortran/check.c | 3 +++ gcc/testsuite/gfortran.dg/illegal_boz_arg_2.f90 | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 7b4b5916d07..8cd894d48d8 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -5151,6 +5151,9 @@ gfc_check_sizeof (gfc_expr *arg) return false; } + if (illegal_boz_arg (arg)) + return false; + /* TYPE(*) is acceptable if and only if it uses an array descriptor. */ if (arg->ts.type == BT_ASSUMED && (arg->symtree->n.sym->as == NULL diff --git a/gcc/testsuite/gfortran.dg/illegal_boz_arg_2.f90 b/gcc/testsuite/gfortran.dg/illegal_boz_arg_2.f90 new file mode 100644 index 00000000000..3e5f6b6d1d4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/illegal_boz_arg_2.f90 @@ -0,0 +1,6 @@ +! { dg-do compile } +! PR fortran/103412 + +program p + integer, parameter :: a = sizeof(z'1') ! { dg-error "cannot be an actual" } +end
reply other threads:[~2021-12-19 20:05 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211219200502.8D6463858400@sourceware.org \ --to=anlauf@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).