Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
27306 Discussions

ICE on bad syntax for character literals

Harald1
Novice
153 Views

The following code compiles in fixed form, but has issues when treated as free form:

      integer, parameter :: ck = kind ("a")  ! default character kind
      print *, ck
      print *, ck_"a"   ! valid
      print *, ck _"a"  ! invalid, ICE
      print *, ck_ "a"  ! invalid, not detected
      print *, 1_"a"    ! valid
      print *, 1 _"a"   ! invalid, ICE
      print *, 1_ "a"   ! invalid, not detected
      end

 

% ifort ifort_bad_char_literal.f90 -fixed

--> OK.

% ifort ifort_bad_char_literal.f90
ifort_bad_char_literal.f90(4): error #5192: Lead underscore not allowed
      print *, ck _"a"  ! invalid, ICE
-------------------^
ifort_bad_char_literal.f90(4): error #5082: Syntax error, found CHAR_NAM_KIND_PARAM '' when expecting one of: :: ) ( , : * <END-OF-STATEMENT> ; . % (/ + - [ ] /) . ** / // ...
      print *, ck _"a"  ! invalid, ICE
------------------^
ifort_bad_char_literal.f90(7): error #5192: Lead underscore not allowed
      print *, 1 _"a"   ! invalid, ICE
------------------^
ifort_bad_char_literal.f90(7): error #5082: Syntax error, found CHAR_NAM_KIND_PARAM '' when expecting one of: :: ) , : * <END-OF-STATEMENT> ; . (/ + - ] /) ' ** / // > PRIVATE ...
      print *, 1 _"a"   ! invalid, ICE
-----------------^
ifort_bad_char_literal.f90: catastrophic error: **Internal compiler error: segmentation violation signal raised** Please report this error along with the circumstances in which it occurred in a Software Problem Report.  Note: File and line given may not be explicit cause of this error.
compilation aborted for ifort_bad_char_literal.f90 (code 1)

 

So I think there is accepted-invalid code, and there is an ICE-on-invalid, as indicated.

Thanks,

Harald

 

0 Kudos
0 Replies
Reply