public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/96686] New: MIN/MAX should reject character arguments of different kind rather than ICE
@ 2020-08-18 18:02 anlauf at gcc dot gnu.org
2020-08-18 18:07 ` [Bug fortran/96686] " kargl at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-08-18 18:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96686
Bug ID: 96686
Summary: MIN/MAX should reject character arguments of different
kind rather than ICE
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: anlauf at gcc dot gnu.org
Target Milestone: ---
We current fail on this:
program p
implicit none
character(kind=1) :: c1 = "1"
character(kind=4) :: c4 = 4_"4"
print *, min (c1, c4)
end program p
min_max_char.f90:5:16:
5 | print *, min (c1, c4)
| 1
internal compiler error: Cannot convert 'CHARACTER(1)' to 'CHARACTER(0,4)' at
(1)
0x69ee19 gfc_report_diagnostic
../../gcc-trunk/gcc/fortran/error.c:782
0x6a0592 gfc_internal_error(char const*, ...)
../../gcc-trunk/gcc/fortran/error.c:1402
0x6bfb68 gfc_convert_type_warn(gfc_expr*, gfc_typespec*, int, int, bool)
../../gcc-trunk/gcc/fortran/intrinsic.c:5350
0x6c8385 gfc_resolve_minmax
../../gcc-trunk/gcc/fortran/iresolve.c:1621
0x6b4391 resolve_intrinsic
../../gcc-trunk/gcc/fortran/intrinsic.c:4501
0x6b4391 do_simplify
../../gcc-trunk/gcc/fortran/intrinsic.c:4671
0x6bedda gfc_intrinsic_func_interface(gfc_expr*, int)
../../gcc-trunk/gcc/fortran/intrinsic.c:5013
0x70e17b resolve_unknown_f
../../gcc-trunk/gcc/fortran/resolve.c:2919
0x70e17b resolve_function
../../gcc-trunk/gcc/fortran/resolve.c:3277
0x70e17b gfc_resolve_expr(gfc_expr*)
../../gcc-trunk/gcc/fortran/resolve.c:7094
0x714e84 gfc_resolve_expr(gfc_expr*)
../../gcc-trunk/gcc/fortran/resolve.c:7061
0x714e84 gfc_resolve_code(gfc_code*, gfc_namespace*)
../../gcc-trunk/gcc/fortran/resolve.c:11799
0x71e09f gfc_resolve_blocks(gfc_code*, gfc_namespace*)
../../gcc-trunk/gcc/fortran/resolve.c:10826
0x713c58 gfc_resolve_code(gfc_code*, gfc_namespace*)
../../gcc-trunk/gcc/fortran/resolve.c:11789
0x71650d resolve_codes
../../gcc-trunk/gcc/fortran/resolve.c:17334
0x7165de gfc_resolve(gfc_namespace*)
../../gcc-trunk/gcc/fortran/resolve.c:17369
0x6fe4b5 resolve_all_program_units
../../gcc-trunk/gcc/fortran/parse.c:6286
0x6fe4b5 gfc_parse_file()
../../gcc-trunk/gcc/fortran/parse.c:6538
0x74b3af gfc_be_parse_file
../../gcc-trunk/gcc/fortran/f95-lang.c:212
Proposed solution: since MIN/MAX with character arguments are not legacy stuff,
there is no good reason to provide a GNU extension. We should simply reject
this always, as in:
gfc-11 min_max_char.f90 -std=f2018
min_max_char.f90:5:20:
5 | print *, min (c1, c4)
| 1
Error: GNU Extension: Different type kinds at (1)
although it should simply say: Different type kinds. No reference to any
GNU Extension.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/96686] MIN/MAX should reject character arguments of different kind rather than ICE
2020-08-18 18:02 [Bug fortran/96686] New: MIN/MAX should reject character arguments of different kind rather than ICE anlauf at gcc dot gnu.org
@ 2020-08-18 18:07 ` kargl at gcc dot gnu.org
2020-08-18 19:47 ` anlauf at gcc dot gnu.org
2020-08-18 20:09 ` anlauf at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2020-08-18 18:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96686
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2020-08-18
CC| |kargl at gcc dot gnu.org
--- Comment #1 from kargl at gcc dot gnu.org ---
Yep, I agree that this should simply be rejected. I looked at your other patch
for min/max, and think it can be committed. If you want to update that patch
to include the fix for this PR consider it pre-approved (provided regression
testing passes).
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/96686] MIN/MAX should reject character arguments of different kind rather than ICE
2020-08-18 18:02 [Bug fortran/96686] New: MIN/MAX should reject character arguments of different kind rather than ICE anlauf at gcc dot gnu.org
2020-08-18 18:07 ` [Bug fortran/96686] " kargl at gcc dot gnu.org
@ 2020-08-18 19:47 ` anlauf at gcc dot gnu.org
2020-08-18 20:09 ` anlauf at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-08-18 19:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96686
--- Comment #2 from anlauf at gcc dot gnu.org ---
(In reply to kargl from comment #1)
> Yep, I agree that this should simply be rejected. I looked at your other
> patch for min/max, and think it can be committed. If you want to update
> that patch to include the fix for this PR consider it pre-approved (provided
> regression testing passes).
The addition:
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 74e5e448760..65b46cd3f85 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -3693,6 +3693,11 @@ check_rest (bt type, int kind, gfc_actual_arglist
*arglist)
{
if (x->ts.type == type)
{
+ if (x->ts.type == BT_CHARACTER)
+ {
+ gfc_error ("Different character kinds at %L", &x->where);
+ return false;
+ }
if (!gfc_notify_std (GFC_STD_GNU, "Different type "
"kinds at %L", &x->where))
return false;
does the job and regtests fine.
Will commit together with the other PR, and with a new testcase for this one.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/96686] MIN/MAX should reject character arguments of different kind rather than ICE
2020-08-18 18:02 [Bug fortran/96686] New: MIN/MAX should reject character arguments of different kind rather than ICE anlauf at gcc dot gnu.org
2020-08-18 18:07 ` [Bug fortran/96686] " kargl at gcc dot gnu.org
2020-08-18 19:47 ` anlauf at gcc dot gnu.org
@ 2020-08-18 20:09 ` anlauf at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-08-18 20:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96686
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #3 from anlauf at gcc dot gnu.org ---
Fixed by r11-2746-g3c04bd60e56da399a441f73ebb687b5039b9cf3f
(see PR96613 comment#9).
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-18 20:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18 18:02 [Bug fortran/96686] New: MIN/MAX should reject character arguments of different kind rather than ICE anlauf at gcc dot gnu.org
2020-08-18 18:07 ` [Bug fortran/96686] " kargl at gcc dot gnu.org
2020-08-18 19:47 ` anlauf at gcc dot gnu.org
2020-08-18 20:09 ` anlauf at gcc dot gnu.org
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).