2

I'm trying to put some data in a fortran file in the form of a string(about 15000 characters long), and received the error when compiled with intel fortran:

catastrophic error: Token too long, max is 7194. Last token on line -4611686018407622524

Does anyone know how to deal with it?

The compiler version is 13.0.0. The same file can be compiled with IBM xlf fortran compiler and gfortran without problem.

The fortran file is here

vaultah
  • 44,105
  • 12
  • 114
  • 143
xslittlegrass
  • 4,826
  • 4
  • 26
  • 32
  • 2
    In that file you have ~600 double precision numbers... Why don't you store those as `real(8)` and convert them to strings when required? – Alexander Vogt Oct 12 '13 at 18:56

2 Answers2

1

The compiler's tokenizer seems to have a maximum acceptable length for tokens ; the string you wrote has too many characters. Try cutting the string in two parts (in two variables) and concatenate them.

damienfrancois
  • 52,978
  • 9
  • 96
  • 110
  • what the "tokens" mean? The length of string? – xslittlegrass Oct 12 '13 at 18:52
  • See the response to [that question](http://stackoverflow.com/questions/14954721/what-is-the-difference-between-token-and-lexeme) Basically, the first step a compiler needs to take is to transform a sequence of characters into a sequence of tokens. For instance 'abc = 12' consists in 3 tokens 'abc', '=', '12'. In your case, rather than having 2 chars in the right hand side token, you have more than 7194, which the compiler was not designed to handle. – damienfrancois Oct 12 '13 at 19:01
0

It is a limitation of the Intel Fortran Compiler and still present in the current version 14.0. I had posted about it in the Intel forums but cannot find it with their search function.

In my program I had to change from a large character constant initialized in the type declaration to a variable and multiple assign statements.

Johny Bergmann
  • 444
  • 3
  • 6