https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66725
Bug ID: 66725 Summary: Issue with silent conversion int to char, struggling in gfc_widechar_to_char Product: gcc Version: 5.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: gerhard.steinmetz.fort...@t-online.de Target Milestone: --- Sometimes a silent conversion from integer to character occurs where it should not IMO, but should give an explicit error instead. If this integer value n is too "large" (n > 255 or n < -255), an ICE occurs (gfc_widechar_to_char). This happens for several io statements and several specifiers. An integer value at this place is wrong anyway. Required is e.g. a scalar-default-char-expr. Maybe wrong caret position is an aftereffect. $ cat z_iostmt_status_257.f90 program p open (1, status=257) end $ gfortran -g -Wall -fcheck=all -fno-frontend-optimize z_iostmt_status_257.f90 f951: internal compiler error: in gfc_widechar_to_char, at fortran/scanner.c:197 --- $ cat z_iostmt_status_100.f90 program p open (1, status=100) ! wrong data type !<<< end $ gfortran -g -Wall -fcheck=all -fno-frontend-optimize z_iostmt_status_100.f90 z_iostmt_status_100.f90:2:48: open (1, status=100) ! wrong data type !<<< 1 Error: STATUS specifier in OPEN statement at (1) has invalid value 'd' --- $ cat z_iostmt_asynchronous_999.f90 program p write (1, asynchronous=999) end $ gfortran z_iostmt_asynchronous_999.f90 f951: internal compiler error: in gfc_widechar_to_char, at fortran/scanner.c:197 --- $ cat z_iostmt_asynchronous_104.f90 program p write (1, asynchronous=104) ! wrong data type !<<< end $ gfortran z_iostmt_asynchronous_104.f90 z_iostmt_asynchronous_104.f90:2:55: write (1, asynchronous=104) ! wrong data type !<<< 1 Error: ASYNCHRONOUS specifier in WRITE statement at (1) has invalid value 'h'