[Bug fortran/83316] ICE: minval/maxval and characters
dominiq at lps dot ens.fr
gcc-bugzilla@gcc.gnu.org
Thu Dec 7 23:09:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83316
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-12-07
CC| |tkoenig at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
AFAICS gfc_convert_constant does not handle BT_CHARACTER. The problem comes
from the comparison 'minval(s) /= b' and 'maxval(s) /= e'. Note that the
following variant works:
program tminmaxval
implicit none
character(len=*), parameter :: b = "a"
character(len=*), parameter :: e = "c"
character(len=*), parameter :: s(3) = (/"a", "b", "c"/)
character(:), allocatable :: c
c = minval(s)
if (c /= b) then
write(*,*) "minval(s) = ", minval(s)
end if
c = maxval(s)
if (c /= e) then
write(*,*) "maxval(s) = ", maxval(s)
end if
end program tminmaxval
Backtrace
* frame #0: 0x00000001000cc64e
f951`gfc_convert_constant(e=0x0000000143819af0, type=BT_CHARACTER, kind=1) at
simplify.c:7068
frame #1: 0x000000010004b3f3
f951`::do_simplify(specific=0x0000000142dd5c80, e=0x0000000145000bf0) at
intrinsic.c:4412
frame #2: 0x0000000100056319
f951`gfc_intrinsic_func_interface(expr=0x0000000145000bf0,
error_flag=<unavailable>) at intrinsic.c:4666
frame #3: 0x000000010003c8b4 f951`gfc_simplify_expr(p=0x0000000145000bf0,
type=0) at expr.c:1867
frame #4: 0x000000010003c773 f951`gfc_simplify_expr(gfc_expr*, int) at
expr.c:1053
frame #5: 0x000000010003c750 f951`gfc_simplify_expr(p=0x00000001450007a0,
type=0)
frame #6: 0x00000001000b2a2a f951`gfc_resolve_expr(e=0x00000001450007a0) at
resolve.c:4203
frame #7: 0x00000001000ba549 f951`gfc_resolve_blocks(b=0x0000000145000560,
ns=0x000000014406f400) at resolve.c:10044
frame #8: 0x00000001000a9b3a f951`gfc_resolve_code(code=<unavailable>,
ns=<unavailable>) at resolve.c:11110
frame #9: 0x00000001000acea5 f951`::resolve_codes(ns=0x000000014406f400) at
resolve.c:16496
frame #10: 0x00000001000acf81 f951`gfc_resolve(ns=0x000000014406f400) at
resolve.c:16531
frame #11: 0x0000000100099980 f951`gfc_parse_file() [inlined]
resolve_all_program_units(gfc_global_ns_list=0x000000014406f400) at
parse.c:6031
frame #12: 0x0000000100099933 f951`gfc_parse_file()
frame #13: 0x00000001000e31ec f951`::gfc_be_parse_file() at f95-lang.c:204
frame #14: 0x0000000100b7a61a f951`::compile_file() at toplev.c:455
frame #15: 0x00000001011fc5a4 f951`toplev::main(int, char**) at
toplev.c:2059
frame #16: 0x00000001011fc0b2 f951`toplev::main(this=0x00007ffeefbff24e,
argc=<unavailable>, argv=<unavailable>)
frame #17: 0x00000001011fe0ae f951`main(argc=2, argv=0x00007ffeefbff288) at
main.c:39
More information about the Gcc-bugs
mailing list