Skip to content

Ensure standard-conformance and eliminate warnings #752

@rouson

Description

@rouson

Description

I propose adopting the following two practices to fpm's portability and robustness:

  • Standard conformance and
  • Treat warnings as errors.

This issue was inspired by my attempt to build fpm-0.6.0.F90 with the Cray Fortran compiler version 13.0.1. The result is an internal compiler error (ICE). In my experience, the most common cause of an ICE is non-conforming code.

The Numerical Algorithms Group (NAG) Fortran Compiler is widely considered the best compiler for checking standard conformance so I then tried building with NAG's compiler using the command nagfor -fpp fpm-0.6.0.F90, where the -fpp invokes NAG's Fortran preprocessor. The result below contains a long list of warnings and compiler messages about questionable code followed by what appear to be four ICEs with NAG. As time permits, I'll investigate whether I can address these and submit related pull requests.

NAG Fortran Compiler Release 7.1(Hanzomon) Build 7113
Warning: fpm-0.6.0.F90, line 1116: C_ASSOCIATED explicitly imported into FPM_STRINGS but not used
Warning: fpm-0.6.0.F90, line 1116: C_INT explicitly imported into FPM_STRINGS but not used
Warning: fpm-0.6.0.F90, line 1116: C_NULL_CHAR explicitly imported into FPM_STRINGS but not used
Warning: fpm-0.6.0.F90, line 1116: INPUT_UNIT explicitly imported into FPM_STRINGS (as STDIN) but not used
Warning: fpm-0.6.0.F90, line 1116: OUTPUT_UNIT explicitly imported into FPM_STRINGS (as STDOUT) but not used
Questionable: fpm-0.6.0.F90, line 1186: Comment begins with the OpenMP sentinel but the -openmp option was not used
Questionable: fpm-0.6.0.F90, line 3386: Variable LENGTH set but never referenced
Warning: fpm-0.6.0.F90, line 4794: Unused dummy variable WHERE
Warning: fpm-0.6.0.F90, line 4952: REAL128 explicitly imported into PRINT_GENERIC but not used
Warning: fpm-0.6.0.F90, line 5019: REAL128 explicitly imported into PRINT_GENERIC but not used
Questionable: fpm-0.6.0.F90, line 5578: Variable IFOK set but never referenced
Warning: fpm-0.6.0.F90, line 7748: INPUT_UNIT explicitly imported into FPM_ERROR (as STDIN) but not used
Warning: fpm-0.6.0.F90, line 7748: OUTPUT_UNIT explicitly imported into FPM_ERROR (as STDOUT) but not used
Questionable: fpm-0.6.0.F90, line 8620: Variable LENGTH set but never referenced
Warning: fpm-0.6.0.F90, line 8747: FPM_STOP explicitly imported into FPM_ENVIRONMENT but not used
Warning: fpm-0.6.0.F90, line 8747: INPUT_UNIT explicitly imported into FPM_ENVIRONMENT (as STDIN) but not used
Warning: fpm-0.6.0.F90, line 8747: OUTPUT_UNIT explicitly imported into FPM_ENVIRONMENT (as STDOUT) but not used
Warning: fpm-0.6.0.F90, line 9158: SYNTAX_ERROR explicitly imported into FPM_VERSIONING but not used
Questionable: fpm-0.6.0.F90, line 9785: Variable R set but never referenced
Warning: fpm-0.6.0.F90, line 10423: C_ASSOCIATED explicitly imported into FPM_FILESYSTEM but not used
Warning: fpm-0.6.0.F90, line 10423: C_CHAR explicitly imported into FPM_FILESYSTEM but not used
Warning: fpm-0.6.0.F90, line 10423: C_F_POINTER explicitly imported into FPM_FILESYSTEM but not used
Warning: fpm-0.6.0.F90, line 10423: C_INT explicitly imported into FPM_FILESYSTEM but not used
Warning: fpm-0.6.0.F90, line 10423: C_NULL_CHAR explicitly imported into FPM_FILESYSTEM but not used
Warning: fpm-0.6.0.F90, line 10423: C_PTR explicitly imported into FPM_FILESYSTEM but not used
Warning: fpm-0.6.0.F90, line 10423: INPUT_UNIT explicitly imported into FPM_FILESYSTEM (as STDIN) but not used
Warning: fpm-0.6.0.F90, line 10423: REPLACE explicitly imported into FPM_FILESYSTEM but not used
Warning: fpm-0.6.0.F90, line 10521: TOML_DATE explicitly imported into TOMLF_UTILS but not used
Warning: fpm-0.6.0.F90, line 10521: TOML_DATETIME explicitly imported into TOMLF_UTILS but not used
Warning: fpm-0.6.0.F90, line 10521: TOML_TIME explicitly imported into TOMLF_UTILS but not used
Warning: fpm-0.6.0.F90, line 11128: Unused local variable STAT
Warning: fpm-0.6.0.F90, line 11990: Unused local variable FLAGS
Warning: fpm-0.6.0.F90, line 12662: FNV_1A explicitly imported into FPM_COMMAND_LINE but not used
Warning: fpm-0.6.0.F90, line 12662: INPUT_UNIT explicitly imported into FPM_COMMAND_LINE (as STDIN) but not used
Warning: fpm-0.6.0.F90, line 12662: LOWER explicitly imported into FPM_COMMAND_LINE but not used
Warning: fpm-0.6.0.F90, line 13212: Unused dummy variable ERROR
Warning: fpm-0.6.0.F90, line 13459: TOML_VISITOR explicitly imported into TOMLF_TYPE_KEYVAL but not used
Warning: fpm-0.6.0.F90, line 14305: TOML_VISITOR explicitly imported into TOMLF_TYPE_TABLE but not used
Warning: fpm-0.6.0.F90, line 14504: TOML_VISITOR explicitly imported into TOMLF_TYPE_ARRAY but not used
Warning: fpm-0.6.0.F90, line 15761: ADD_ARRAY explicitly imported into TOMLF_BUILD_KEYVAL but not used
Warning: fpm-0.6.0.F90, line 15761: ADD_KEYVAL explicitly imported into TOMLF_BUILD_KEYVAL but not used
Warning: fpm-0.6.0.F90, line 15761: ADD_TABLE explicitly imported into TOMLF_BUILD_KEYVAL but not used
Warning: fpm-0.6.0.F90, line 15761: LEN explicitly imported into TOMLF_BUILD_KEYVAL but not used
Warning: fpm-0.6.0.F90, line 15761: NEW_ARRAY explicitly imported into TOMLF_BUILD_KEYVAL but not used
Warning: fpm-0.6.0.F90, line 15761: NEW_KEYVAL explicitly imported into TOMLF_BUILD_KEYVAL but not used
Warning: fpm-0.6.0.F90, line 15761: NEW_TABLE explicitly imported into TOMLF_BUILD_KEYVAL but not used
Warning: fpm-0.6.0.F90, line 15761: TOML_ARRAY explicitly imported into TOMLF_BUILD_KEYVAL but not used
Warning: fpm-0.6.0.F90, line 15761: TOML_RAW_TO_TIMESTAMP explicitly imported into TOMLF_BUILD_KEYVAL but not used
Warning: fpm-0.6.0.F90, line 15761: TOML_TABLE explicitly imported into TOMLF_BUILD_KEYVAL but not used
Warning: fpm-0.6.0.F90, line 15761: TOML_VALUE explicitly imported into TOMLF_BUILD_KEYVAL but not used
Warning: fpm-0.6.0.F90, line 15878: TFC explicitly imported into TOMLF_BUILD_MERGE but not used
Warning: fpm-0.6.0.F90, line 17393: LEN explicitly imported into TOMLF_BUILD_TABLE but not used
Warning: fpm-0.6.0.F90, line 17393: NEW_ARRAY explicitly imported into TOMLF_BUILD_TABLE but not used
Warning: fpm-0.6.0.F90, line 17393: NEW_KEYVAL explicitly imported into TOMLF_BUILD_TABLE but not used
Warning: fpm-0.6.0.F90, line 17393: NEW_TABLE explicitly imported into TOMLF_BUILD_TABLE but not used
Warning: fpm-0.6.0.F90, line 17393: TFI explicitly imported into TOMLF_BUILD_TABLE but not used
Warning: fpm-0.6.0.F90, line 17393: TFR explicitly imported into TOMLF_BUILD_TABLE but not used
Warning: fpm-0.6.0.F90, line 18079: ADD_ARRAY explicitly imported into TOMLF_BUILD_ARRAY but not used
Warning: fpm-0.6.0.F90, line 18079: ADD_TABLE explicitly imported into TOMLF_BUILD_ARRAY but not used
Warning: fpm-0.6.0.F90, line 18079: NEW_ARRAY explicitly imported into TOMLF_BUILD_ARRAY but not used
Warning: fpm-0.6.0.F90, line 18079: NEW_KEYVAL explicitly imported into TOMLF_BUILD_ARRAY but not used
Warning: fpm-0.6.0.F90, line 18079: NEW_TABLE explicitly imported into TOMLF_BUILD_ARRAY but not used
Warning: fpm-0.6.0.F90, line 18079: TFI explicitly imported into TOMLF_BUILD_ARRAY but not used
Warning: fpm-0.6.0.F90, line 18079: TFR explicitly imported into TOMLF_BUILD_ARRAY but not used
Warning: fpm-0.6.0.F90, line 18079: TOML_RAW_TO_BOOL explicitly imported into TOMLF_BUILD_ARRAY but not used
Warning: fpm-0.6.0.F90, line 18079: TOML_RAW_TO_FLOAT explicitly imported into TOMLF_BUILD_ARRAY but not used
Warning: fpm-0.6.0.F90, line 18079: TOML_RAW_TO_INTEGER explicitly imported into TOMLF_BUILD_ARRAY but not used
Warning: fpm-0.6.0.F90, line 18079: TOML_RAW_TO_STRING explicitly imported into TOMLF_BUILD_ARRAY but not used
Warning: fpm-0.6.0.F90, line 18079: TOML_RAW_TO_TIMESTAMP explicitly imported into TOMLF_BUILD_ARRAY but not used
Warning: fpm-0.6.0.F90, line 18489: TOML_NEWLINE explicitly imported into TOMLF_DE but not used
Warning: fpm-0.6.0.F90, line 18800: FATAL_ERROR explicitly imported into FPM_MANIFEST_INSTALL but not used
Warning: fpm-0.6.0.F90, line 18800: TOML_STAT explicitly imported into FPM_MANIFEST_INSTALL but not used
Warning: fpm-0.6.0.F90, line 18942: TOML_STAT explicitly imported into FPM_MANIFEST_LIBRARY but not used
Warning: fpm-0.6.0.F90, line 19553: TOML_STAT explicitly imported into FPM_MANIFEST_EXECUTABLE but not used
Warning: fpm-0.6.0.F90, line 19731: DEPENDENCY_CONFIG_T explicitly imported into FPM_MANIFEST_EXAMPLE but not used
Warning: fpm-0.6.0.F90, line 19731: TOML_STAT explicitly imported into FPM_MANIFEST_EXAMPLE but not used
Warning: fpm-0.6.0.F90, line 19909: DEPENDENCY_CONFIG_T explicitly imported into FPM_MANIFEST_TEST but not used
Warning: fpm-0.6.0.F90, line 19909: TOML_STAT explicitly imported into FPM_MANIFEST_TEST but not used
Warning: fpm-0.6.0.F90, line 20555: BUILD_CONFIG_T explicitly imported into FPM_MANIFEST but not used
Warning: fpm-0.6.0.F90, line 20555: FILE_NOT_FOUND_ERROR explicitly imported into FPM_MANIFEST but not used
Warning: fpm-0.6.0.F90, line 21260: FILEWRITE explicitly imported into FPM_CMD_NEW but not used
Warning: fpm-0.6.0.F90, line 21260: OS_LINUX explicitly imported into FPM_CMD_NEW but not used
Warning: fpm-0.6.0.F90, line 21260: OS_MACOS explicitly imported into FPM_CMD_NEW but not used
Warning: fpm-0.6.0.F90, line 21260: OS_WINDOWS explicitly imported into FPM_CMD_NEW but not used
Warning: fpm-0.6.0.F90, line 21593: Unused dummy variable ROOT
Warning: fpm-0.6.0.F90, line 21636: Unused dummy variable ERROR
Warning: fpm-0.6.0.F90, line 22074: STRING_T explicitly imported into FPM_DEPENDENCY but not used
Warning: fpm-0.6.0.F90, line 23133: Unused local variable POST
Warning: fpm-0.6.0.F90, line 23135: FATAL_ERROR explicitly imported into FPM_SOURCE_PARSING but not used
Warning: fpm-0.6.0.F90, line 23135: FPM_SCOPE_APP explicitly imported into FPM_SOURCE_PARSING but not used
Warning: fpm-0.6.0.F90, line 23135: FPM_SCOPE_DEP explicitly imported into FPM_SOURCE_PARSING but not used
Warning: fpm-0.6.0.F90, line 23135: FPM_SCOPE_LIB explicitly imported into FPM_SOURCE_PARSING but not used
Warning: fpm-0.6.0.F90, line 23135: FPM_SCOPE_TEST explicitly imported into FPM_SOURCE_PARSING but not used
Warning: fpm-0.6.0.F90, line 23135: FPM_SCOPE_UNKNOWN explicitly imported into FPM_SOURCE_PARSING but not used
Warning: fpm-0.6.0.F90, line 23135: STRING_CAT explicitly imported into FPM_SOURCE_PARSING but not used
Extension(NAG): fpm-0.6.0.F90, line 23589: Line longer than 132 characters
Warning: fpm-0.6.0.F90, line 24236: OUTPUT_UNIT explicitly imported into FPM_BACKEND_OUTPUT (as STDOUT) but not used
Warning: fpm-0.6.0.F90, line 24837: INPUT_UNIT explicitly imported into FPM_BACKEND (as STDIN) but not used
Warning: fpm-0.6.0.F90, line 24837: JOIN_PATH explicitly imported into FPM_BACKEND but not used
Warning: fpm-0.6.0.F90, line 24837: OUTPUT_UNIT explicitly imported into FPM_BACKEND (as STDOUT) but not used
Warning: fpm-0.6.0.F90, line 24837: RUN explicitly imported into FPM_BACKEND but not used
Warning: fpm-0.6.0.F90, line 25386: C_ASSOCIATED explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: C_CHAR explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: C_F_POINTER explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: C_INT explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: C_NULL_CHAR explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: C_PTR explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: FATAL_ERROR explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: FNV_1A explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: FPM_INSTALL_SETTINGS explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: FPM_NEW_SETTINGS explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: FPM_SCOPE_DEP explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: FPM_SCOPE_UNKNOWN explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: FPM_TARGET_ARCHIVE explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: FPM_TEST_SETTINGS explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: GET_ENV explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: MKDIR explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: NUMBER_OF_ROWS explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: RESOLVE_MODULE_DEPENDENCIES explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25386: RESOLVE_TARGET_LINKING explicitly imported into FPM but not used
Warning: fpm-0.6.0.F90, line 25468: Unused local variable DIR
Warning: fpm-0.6.0.F90, line 25468: Unused local variable LIB
Warning: fpm-0.6.0.F90, line 25496: Unused local variable LIB
Warning: fpm-0.6.0.F90, line 25496: Unused dummy variable MODEL
Warning: fpm-0.6.0.F90, line 25496: Unused dummy variable PACKAGE
Warning: fpm-0.6.0.F90, line 25548: JOIN_PATH explicitly imported into FPM_CMD_INSTALL but not used
Warning: fpm-0.6.0.F90, line 25548: LIST_FILES explicitly imported into FPM_CMD_INSTALL but not used
Warning: fpm-0.6.0.F90, line 25548: RESIZE explicitly imported into FPM_CMD_INSTALL but not used
Questionable: fpm-0.6.0.F90, line 4423: Intrinsic function CMPLX with double precision argument and no KIND= argument returns single precision result
Extension(F2018): fpm-0.6.0.F90, line 7745: Stop-code is not constant
Questionable: fpm-0.6.0.F90, line 16477: Last statement of DO loop body is an unconditional EXIT statement
Questionable: fpm-0.6.0.F90, line 16526: Last statement of DO loop body is an unconditional EXIT statement
Questionable: fpm-0.6.0.F90, line 18196: Last statement of DO loop body is an unconditional RETURN statement
Questionable: fpm-0.6.0.F90, line 18362: Last statement of DO loop body is an unconditional EXIT statement
Questionable: fpm-0.6.0.F90, line 18764: CONTINUE statement with no label inside DO loop - did you mean CYCLE?
Questionable: fpm-0.6.0.F90, line 18897: CONTINUE statement with no label inside DO loop - did you mean CYCLE?
Questionable: fpm-0.6.0.F90, line 19062: CONTINUE statement with no label inside DO loop - did you mean CYCLE?
Questionable: fpm-0.6.0.F90, line 19489: CONTINUE statement with no label inside DO loop - did you mean CYCLE?
Questionable: fpm-0.6.0.F90, line 19667: CONTINUE statement with no label inside DO loop - did you mean CYCLE?
Questionable: fpm-0.6.0.F90, line 19845: CONTINUE statement with no label inside DO loop - did you mean CYCLE?
Questionable: fpm-0.6.0.F90, line 20217: CONTINUE statement with no label inside DO loop - did you mean CYCLE?
[NAG Fortran Compiler normal termination, 141 warnings]
fpm-0.6.0.F90:11842:39: error: member reference type 'struct fpm_command_line_DT_fpm_build_settings' is not a pointer; did you mean to use '.'?
install_settings_->fpm_build_settings_->fpm_cmd_settings_.working_dir_.addr = (Char *)0;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
                                      .
fpm-0.6.0.F90:11842:77: error: expression is not assignable
install_settings_->fpm_build_settings_->fpm_cmd_settings_.working_dir_.addr = (Char *)0;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
fpm-0.6.0.F90:11842:39: error: member reference type 'struct fpm_command_line_DT_fpm_build_settings' is not a pointer; did you mean to use '.'?
install_settings_->fpm_build_settings_->fpm_cmd_settings_.verbose_ = 1;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
                                      .
fpm-0.6.0.F90:11842:68: error: expression is not assignable
install_settings_->fpm_build_settings_->fpm_cmd_settings_.verbose_ = 1;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
4 errors generated.

Possible Solution

  1. Eliminate warnings.
  2. Report ICEs to compiler vendors.
  3. Ensure standard conformance.

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions