2

I am trying to an old CPMD-3.11.1 version on Ubuntu 14.04 with gfortran compiler.

While running the Makefile I am facing this error:

Error: Unclassifiable statement at (1) ./timec.f:10.28: but WITHOUT ANY WARRANTY; without even the implied warranty of 1 Error: Unclassifiable statement at (1) ./timec.f:11.4: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1 Error: Non-numeric character in statement label at (1) ./timec.f:11.4: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1 Error: Unclassifiable statement at (1) ./timec.f:12.4: Lesser General Public License for more details. 1 Error: Non-numeric character in statement label at (1) ./timec.f:12.4: Lesser General Public License for more details. 1 Error: Unclassifiable statement at (1) ./timec.f:14.4: You should have received a copy of the GNU Lesser General Public 1 Error: Non-numeric character in statement label at (1) ./timec.f:14.4: You should have received a copy of the GNU Lesser General Public 1 Error: Unclassifiable statement at (1) Fatal Error: Error count reached limit of 25. make: *** [timec.o] Error 1 

I have noticed that it is not reading the statement part so I am deleting statement part for each .f file created but it is very time consuming.

Is there any other option to install an old Fortran code with the updated gfortran compiler.

1
  • You must show us your code. The error message is not enough. Commented Sep 18, 2015 at 9:13

2 Answers 2

5

This output is due to GCC's C preprocessor (and I think this behavior was introduced somewhat recently).

If you are creating your .f files from .F by explicitly calling cpp and use the -C flag, the output file contains a license disclaimer and possible other information in C comments. For example, running

% echo "end" | cpp -C -P 

produces the output:

/* Copyright (C) 1991-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* This header is separate from features.h so that the compiler can include it implicitly at the start of every compilation. It must not itself include <features.h> or any other header that includes <features.h> because the implicit include comes before any feature test macros that may be defined in a source file before it first explicitly includes a system header. GCC knows the name of this header in order to preinclude it. */ /* glibc's intent is to support the IEC 559 math functionality, real and complex. If the GCC (4.9 and later) predefined macros specifying compiler intent are available, use them to determine whether the overall intent is to support these features; otherwise, presume an older compiler has intent to support these features and define these macros by default. */ /* wchar_t uses ISO/IEC 10646 (2nd ed., published 2011-03-15) / Unicode 6.0. */ /* We do not support C11 <threads.h>. */ end 

with gcc 5.2. The exact output from your version may differ but will still be problematic. This output is not valid Fortran and is not compilable. To get output that a Fortran compiler can process you need at least to omit -C and add -P. A common other flag used is -traditional. If your makefile defines CPP, edit it to remove the -C flag.

For example if you see something like:

CPP = cpp -C -P -traditional 

edit it to look like:

CPP = cpp -P -traditional 

After you fix this you can clean your source tree and let make regenerate the processed Fortran and it should not contain the C-style comments.

Sign up to request clarification or add additional context in comments.

Comments

2

That looks like a GPL licence in the code which generally should be a comment rather than somewhere that the compiler will think it's valid source code.

You need to first check the code to see what sort of comment it is, such as a line beginning with c or * (Fortran 77 style) or something strange like C-style block comments (/* */).

If the latter, use the -cpp option to gfortran (or call the file timec.F which, from very stretched memory, automatically calls the preprocessor).

1 Comment

+the error appears to show the entire line so it must be some sort of block comment. If its just this one file you could simply add a c to every line. Less headache in the long run than messing with a preprocessor.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.