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

Assumed length character implicit typing nonsense gives ICE

IanH
Honored Contributor II
254 Views

Inspired by a current c.l.f thread, I thought I'd torture the compiler...

[fortran]MODULE DontTryThisAtHomeKids
  IMPLICIT CHARACTER(*)(s)
CONTAINS
  CHARACTER(LEN(s)) FUNCTION reverse(s)
    FORALL (i=LEN(s):1:-1) reverse(i:i) = s(i:i)
  END FUNCTION reverse
END MODULE DontTryThisAtHomeKids
[/fortran]

As per the thread, I've clearly got no idea whether this is valid source or not, but...

[plain]>ifort /c /check:all /warn:all /standard-semantics "2013-01-09 implicit.f90"
Intel(R) Visual Fortran Compiler XE for applications running on IA-32, Version 13.0.1.119 Build 20121008
Copyright (C) 1985-2012 Intel Corporation.  All rights reserved.

2013-01-09 implicit.f90(4): warning #6717: This name has not been given an explicit type.  
  CHARACTER(LEN(s)) FUNCTION reverse(s)
----------------^
2013-01-09 implicit.f90(5): warning #6717: This name has not been given an explicit type.  
    FORALL (i=LEN(s):1:-1) reverse(i:i) = s(i:i)
------------^
2013-01-09 implicit.f90(1): catastrophic error: **Internal compiler error: internal abort** Please report this error alo
ng with the circumstances in which it occurred in a Software Problem Report.  Note: File and line given may not be expli
cit cause of this error.
compilation aborted for 2013-01-09 implicit.f90 (code 1)[/plain]

0 Kudos
4 Replies
Steven_L_Intel1
Employee
254 Views
Sigh - thanks....
0 Kudos
Steven_L_Intel1
Employee
254 Views
/check:bounds is what triggers the ICE. Without that the code compiles and even executes. The code you have doesn't reverse the string, but this works: [fortran] MODULE DontTryThisAtHomeKids IMPLICIT CHARACTER(*)(s) CONTAINS CHARACTER(LEN(s)) FUNCTION reverse(s) FORALL (i=LEN(s):1:-1) reverse(i:i) = s((len(s)-i+1):(len(s)-i+1)) END FUNCTION reverse END MODULE DontTryThisAtHomeKids program test use DontTryThisAtHomeKids character(7) string string = 'Reverse' print *, reverse(string) end [/fortran] However, it seems the IMPLICIT is also implicated, as the following doesn't get an error: [fortran] MODULE DontTryThisAtHomeKids !IMPLICIT CHARACTER(*)(s) CONTAINS FUNCTION reverse(s) result (r) character(*) S character(LEN(S)) R FORALL (i=LEN(s):1:-1) r(i:i) = s((len(s)-i+1):(len(s)-i+1)) END FUNCTION reverse END MODULE DontTryThisAtHomeKids [/fortran] Escalated as DPD200239962.
0 Kudos
Steven_L_Intel1
Employee
254 Views
And for what it's worth, this usage is legal as best as I can tell.
0 Kudos
Steven_L_Intel1
Employee
254 Views

This problem has been fixed for a release later this year.

0 Kudos
Reply