* [patch, fortran] PR107397 ICE in gfc_arith_plus, at fortran/arith.cc:654
@ 2022-12-17 17:12 Jerry D
2022-12-19 10:29 ` [committed] testsuite: Fix up pr107397.f90 test [PR107397] Jakub Jelinek
0 siblings, 1 reply; 3+ messages in thread
From: Jerry D @ 2022-12-17 17:12 UTC (permalink / raw)
To: gfortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 324 bytes --]
Hi all,
The attached patch fixes a regression and is a patch from Steve. I have
regression tested it and provided a test case. It is fairly simple and
I will commit under the "simple" rule in a little while.
Thanks Steve for Patch. Thanks Harald for helping me get back up to
speed on the git magic.
Regards,
Jerry
[-- Attachment #2: patch1.diff --]
[-- Type: text/x-patch, Size: 1117 bytes --]
diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc
index 0f9b2ced4c2..1562dc22bc6 100644
--- a/gcc/fortran/decl.cc
+++ b/gcc/fortran/decl.cc
@@ -2221,6 +2221,14 @@ add_init_expr_to_sym (const char *name, gfc_expr **initp, locus *var_locus)
sym->ts.f90_type = init->ts.f90_type;
}
+ /* Catch the case: type(t), parameter :: x = z'1'. */
+ if (sym->ts.type == BT_DERIVED && init->ts.type == BT_BOZ)
+ {
+ gfc_error ("Entity %qs at %L is incompatible with a BOZ "
+ "literal constant", name, &sym->declared_at);
+ return false;
+ }
+
/* Add initializer. Make sure we keep the ranks sane. */
if (sym->attr.dimension && init->rank == 0)
{
diff --git a/gcc/testsuite/gfortran.dg/pr107397.f90 b/gcc/testsuite/gfortran.dg/pr107397.f90
new file mode 100644
index 00000000000..4592a275e70
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr107397.f90
@@ -0,0 +1,9 @@
+!{ dg-do compile }
+!
+program p
+ type t
+ real :: a = 1.0
+ end type
+ type(t), parameter :: x = z'1' ! { dg-error "incompatible with BOZ" }
+ x%a = x%a + 2 ! { dg-error "has no IMPLICIT type"}
+end
^ permalink raw reply [flat|nested] 3+ messages in thread
* [committed] testsuite: Fix up pr107397.f90 test [PR107397]
2022-12-17 17:12 [patch, fortran] PR107397 ICE in gfc_arith_plus, at fortran/arith.cc:654 Jerry D
@ 2022-12-19 10:29 ` Jakub Jelinek
2022-12-20 2:07 ` Jerry D
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2022-12-19 10:29 UTC (permalink / raw)
To: Jerry D; +Cc: gfortran, gcc-patches
On Sat, Dec 17, 2022 at 09:12:43AM -0800, Jerry D via Gcc-patches wrote:
> The attached patch fixes a regression and is a patch from Steve. I have
> regression tested it and provided a test case. It is fairly simple and I
> will commit under the "simple" rule in a little while.
>
> Thanks Steve for Patch. Thanks Harald for helping me get back up to speed on
> the git magic.
The pr107397.f90 test FAILs for me, one problem was that the
added diagnostics has an indefinite article before BOZ, but
the test dg-error didn't. The other problem was that on the
other dg-error there was no space between the string and closing
}, so it was completely ignored and the error was an excess
error.
2022-12-19 Jakub Jelinek <jakub@redhat.com>
PR fortran/107397
* gfortran.dg/pr107397.f90: Adjust expected diagnostic wording and
add space between dg-error string and closing }.
--- gcc/testsuite/gfortran.dg/pr107397.f90.jj 2022-12-19 11:09:13.793166473 +0100
+++ gcc/testsuite/gfortran.dg/pr107397.f90 2022-12-19 11:23:02.981322107 +0100
@@ -4,6 +4,6 @@ program p
type t
real :: a = 1.0
end type
- type(t), parameter :: x = z'1' ! { dg-error "incompatible with BOZ" }
- x%a = x%a + 2 ! { dg-error "has no IMPLICIT type"}
+ type(t), parameter :: x = z'1' ! { dg-error "incompatible with a BOZ" }
+ x%a = x%a + 2 ! { dg-error "has no IMPLICIT type" }
end
Jakub
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [committed] testsuite: Fix up pr107397.f90 test [PR107397]
2022-12-19 10:29 ` [committed] testsuite: Fix up pr107397.f90 test [PR107397] Jakub Jelinek
@ 2022-12-20 2:07 ` Jerry D
0 siblings, 0 replies; 3+ messages in thread
From: Jerry D @ 2022-12-20 2:07 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gfortran, gcc-patches
On 12/19/22 2:29 AM, Jakub Jelinek wrote:
> On Sat, Dec 17, 2022 at 09:12:43AM -0800, Jerry D via Gcc-patches wrote:
>> The attached patch fixes a regression and is a patch from Steve. I have
>> regression tested it and provided a test case. It is fairly simple and I
>> will commit under the "simple" rule in a little while.
>>
>> Thanks Steve for Patch. Thanks Harald for helping me get back up to speed on
>> the git magic.
>
> The pr107397.f90 test FAILs for me, one problem was that the
> added diagnostics has an indefinite article before BOZ, but
> the test dg-error didn't. The other problem was that on the
> other dg-error there was no space between the string and closing
> }, so it was completely ignored and the error was an excess
> error.
>
> 2022-12-19 Jakub Jelinek <jakub@redhat.com>
>
> PR fortran/107397
> * gfortran.dg/pr107397.f90: Adjust expected diagnostic wording and
> add space between dg-error string and closing }.
=== snip ===
Thanks Jakub.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-20 2:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-17 17:12 [patch, fortran] PR107397 ICE in gfc_arith_plus, at fortran/arith.cc:654 Jerry D
2022-12-19 10:29 ` [committed] testsuite: Fix up pr107397.f90 test [PR107397] Jakub Jelinek
2022-12-20 2:07 ` Jerry D
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).