Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation with NAG #753

Merged
merged 4 commits into from
Sep 19, 2022
Merged

Fix compilation with NAG #753

merged 4 commits into from
Sep 19, 2022

Conversation

awvwgk
Copy link
Member

@awvwgk awvwgk commented Sep 15, 2022

Requires

See #752 for original NAG report, tracked in #754

@awvwgk
Copy link
Member Author

awvwgk commented Sep 15, 2022

Test compilation still fails at namelist IO:

cli_test.f90                           failed.
[   5%]Compiling...
NAG Fortran Compiler Release 7.1(Hanzomon) Build 7111
Warning: test/cli_test/cli_test.f90, line 196: Unused dummy variable NAME
Warning: test/cli_test/cli_test.f90, line 250: CMD_BUILD explicitly imported into PARSE but not used
Warning: test/cli_test/cli_test.f90, line 250: CMD_CLEAN explicitly imported into PARSE but not used
Warning: test/cli_test/cli_test.f90, line 250: CMD_INSTALL explicitly imported into PARSE but not used
Warning: test/cli_test/cli_test.f90, line 250: CMD_NEW explicitly imported into PARSE but not used
Warning: test/cli_test/cli_test.f90, line 250: CMD_RUN explicitly imported into PARSE but not used
[NAG Fortran Compiler normal termination, 6 warnings]
test/cli_test/cli_test.f90: In function ‘main_IP_parse’:
test/cli_test/cli_test.f90:246:39: error: ‘host’ undeclared (first use in this function); did you mean ‘cosl’?
 write(lun,nml=act_cli,delim='quote')
                                       ^
                                       cosl
test/cli_test/cli_test.f90:246:39: note: each undeclared identifier is reported only once for each function it appears in

Neither the symbol host nor cosl are present in the current scope or any scope of the file.

@awvwgk
Copy link
Member Author

awvwgk commented Sep 15, 2022

Runtime error for

fpm run --compiler nagfor -- build
...
Runtime Error: ./src/fpm_sources.f90, line 74: Reference to OPTIONAL argument RECURSE which is not PRESENT
Program terminated by fatal error
./src/fpm_sources.f90, line 74: Error occurred in FPM_SOURCES:ADD_SOURCES_FROM_DIR
./src/fpm.f90, line 131: Called by FPM:BUILD_MODEL
./src/fpm.f90, line 296: Called by FPM:CMD_BUILD
app/main.f90, line 72: Called by MAIN

triggered by this line

call list_files(directory, file_names,recurse=merge(recurse,.true.,present(recurse)))

@awvwgk
Copy link
Member Author

awvwgk commented Sep 15, 2022

Runtime error due to integer overflow when calculating the file hash

fpm run --compiler nagfor -- build
...
Runtime Error: ./src/fpm_strings.f90, line 198: INTEGER(int64) overflow for 16777619 * 36342609442804091
Program terminated by fatal error
./src/fpm_strings.f90, line 198: Error occurred in FPM_STRINGS:FNV_1A_CHAR
./src/fpm_strings.f90, line 212: Called by FPM_STRINGS:FNV_1A_STRING_T
./src/fpm_source_parsing.f90, line 483: Called by FPM_SOURCE_PARSING:PARSE_C_SOURCE
./src/fpm_sources.f90, line 41: Called by FPM_SOURCES:PARSE_SOURCE
./src/fpm_sources.f90, line 99: Called by FPM_SOURCES:ADD_SOURCES_FROM_DIR
./src/fpm.f90, line 131: Called by FPM:BUILD_MODEL
./src/fpm.f90, line 296: Called by FPM:CMD_BUILD
app/main.f90, line 72: Called by MAIN

I think we actually want an overflow and wrap around here since we are using a signed integer to store a byte sequence.

@awvwgk awvwgk marked this pull request as draft September 15, 2022 08:35
- excludes alias, dangling, and intovf checks
@awvwgk
Copy link
Member Author

awvwgk commented Sep 15, 2022

The issue with the integer overflow is an additional check for signed integer overflows. Running in release mode works, except for an error when compiling fpm itself

fpm run --profile release --compiler nagfor -- run
Project is up to date
 Warning: Module test_filesystem in test/fpm_test/test_filesystem.f90 is a duplicate
 Warning: Module test_installer in test/fpm_test/test_installer.f90 is a duplicate
 Warning: Module test_toml in test/fpm_test/test_toml.f90 is a duplicate
 Warning: Module testsuite in test/fpm_test/testsuite.f90 is a duplicate
 Warning: Module test_backend in test/fpm_test/test_backend.f90 is a duplicate
 Warning: Module test_manifest in test/fpm_test/test_manifest.f90 is a duplicate
 Warning: Module test_module_dependencies in test/fpm_test/test_module_dependencies.f90 is a duplicate
 Warning: Module test_package_dependencies in test/fpm_test/test_package_dependencies.f90 is a duplicate
 Warning: Module test_source_parsing in test/fpm_test/test_source_parsing.f90 is a duplicate
 Warning: Module test_versioning in test/fpm_test/test_versioning.f90 is a duplicate
<ERROR>*build_model*:Error: One or more duplicate module names found.
STOP: 1

Looks like the NAG compiled binary fails to correctly resolve the module names.

@awvwgk awvwgk marked this pull request as ready for review September 15, 2022 12:08
@awvwgk
Copy link
Member Author

awvwgk commented Sep 15, 2022

I think this is ready for review now, I collected the unresolved issues in #754 in case anyone wants to have a look at those.

@awvwgk awvwgk requested a review from rouson September 15, 2022 12:10
Copy link
Contributor

@rouson rouson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for submitting this @awvwgk !

@awvwgk awvwgk merged commit 1a8a96b into fortran-lang:main Sep 19, 2022
@awvwgk awvwgk deleted the nag branch September 19, 2022 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants