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

Initializing character variables: "No source code available"

gacwest
Beginner
997 Views
This one's got me stumped. Thanks for the help.

In this F90 code, why do I get an "no source code available" error at 'ch = bk' for:

[fortran]  program main

  character :: bk = "z"
character :: ch ch = bk print*, 'ch: ', ch stop end[/fortran]


but this works fine:

[fortran]  program main
  
  character, parameter :: bk = "z"
  character :: ch
  
  ch = bk
  
  print*, 'ch: ', ch
  
  stop
  end [/fortran]


I get the same error for this:

[fortran]  program main
  
  character :: bk
  character :: ch
  
  bk = "z"
  ch = "x"

  ch = bk
  
  print*, 'ch: ', ch
  
  stop
  end [/fortran]
Thanks.

gac
0 Kudos
8 Replies
Steven_L_Intel1
Employee
997 Views
I just tried your first program and saw no problems. Which exact compiler version are you using?
0 Kudos
gacwest
Beginner
997 Views
Thanks for the reply.

I'm running Professional 11.1 from MS Visual Studio 2008.

gac
0 Kudos
gacwest
Beginner
997 Views
I've discovered that I only get the "no source code" error if I set a breakpoint at the 'ch = bk' statement and, then, "stepinto" it with f11.

If I allow the code to run through the statement without a breakpoint, I don't get the error.

With the 'parameter' form of the declaration, I don't get the error whether a breakpoint is set or not.

Very odd.

Thanks.

gac
0 Kudos
Steven_L_Intel1
Employee
997 Views
Thanks for the clarification, though when I asked for the exact version, I meant like 11.1.060.

In any event, what you are doing is stepping into the "memcpy" routine that is called when the source is a variable. (Under optimization, this would be removed.) There's no source for that so you get the message. You should use "step over" instead, unless you know you want to step into one of your routines. Even then, it's possible that some library routines may be called before your routine is called.

With the PARAMETER version, no memcpy routine is called, even with optimization disabled, so there's nothing being stepped into.
0 Kudos
gacwest
Beginner
997 Views
Thanks very much.

How do I find the version? I can get thebuildby running ifort.

0 Kudos
Steven_L_Intel1
Employee
997 Views
If you're using the command line, the ifort command will give it to you by default. For example:

Intel Visual Fortran Compiler Professional for applications running on IA-32,
Version 11.1 Build 20100203 Package ID: w_cprof_p_11.1.060
Copyright (C) 1985-2010 Intel Corporation. All rights reserved.

In Visual Studio, Tools > Options > Intel Visual Fortran > Compilers and see what the "Selected Compiler" is.
0 Kudos
gacwest
Beginner
997 Views
Thanks.

Intel Visual Fortran Compiler Professional for applications running on IA-32, Version 11.1 Package ID: w_cprof_p_11.1.035
0 Kudos
Steven_L_Intel1
Employee
997 Views
Ok. While it's not relevant to the issue you have here (this is not a compiler bug), I do recommend that you keep current with the compiler.
0 Kudos
Reply