GithubHelp home page GithubHelp logo

urbanjost / m_strings Goto Github PK

View Code? Open in Web Editor NEW
22.0 2.0 3.0 41.41 MB

Fortran string manipulations

License: The Unlicense

Fortran 99.30% Makefile 0.66% Shell 0.04%
fortran string-manipulation strings fpm fortran-package-manager

m_strings's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

m_strings's Issues

Error when building with fpm

I just included M_strings as a dependency in my project. On doing fpm run, I get the following error in M_strings. This is wwith gfortran version 8.3.0 .

build/dependencies/M_strings/src/M_strings.F90:8854:35:

 real,parameter    :: XMAXREAL=real(huge(1))
                                   1
Warning: Change of value in conversion from ‘INTEGER(4)’ to ‘REAL(4)’ at (1) [-Wconversion]
build/dependencies/M_strings/src/M_strings.F90:6711:50:

 integer                      :: matrix(0:len_trim(a), 0:len_trim(b))
                                                  1
Error: Dummy argument ‘a’ not allowed in expression at (1)
compilation terminated due to -fmax-errors=1.

Compilation error: str_local not defined

Had the following compilation error (see below) which I've been able to fix by replacing str_local on lines 2877 and 2879 with str.
Not sure if this was the original intention for this function but it seems to work since str is not optional.

gfortran -std=f2008 -fimplicit-none -J./mod/ -O3  -c ./external/M_strings/M_strings.f90 -o obj/M_strings.o
./external/M_strings/M_strings.f90:2877:41:

 2877 |          string=string//left_local//trim(str_local(i))//right_local//sep_local
      |                                         1
Error: Function 'str_local' at (1) has no IMPLICIT type
./external/M_strings/M_strings.f90:2877:41:

 2877 |          string=string//left_local//trim(str_local(i))//right_local//sep_local
      |                                         1
Error: Reference to impure function 'str_local' at (1) within a PURE procedure
./external/M_strings/M_strings.f90:2879:36:

 2879 |          string=string//left_local//str_local(i)//right_local//sep_local
      |                                    1
Error: Function 'str_local' at (1) has no IMPLICIT type
./external/M_strings/M_strings.f90:2879:36:

 2879 |          string=string//left_local//str_local(i)//right_local//sep_local
      |                                    1
Error: Reference to impure function 'str_local' at (1) within a PURE procedure
make: *** [make.include:60: obj/M_strings.o] Error 1
make: *** Waiting for unfinished jobs....

fpm test error

Here is the log:

<ERROR>*cmd_run*:package error:Key fortran is not allowed in package file
STOP 1

OS: Arch Linux
Fortran compiler: gfortran 12.2.1

Build error: Error: Invalid type-spec (./src/M_strings.f90:9602:34)

UPDATED: Found a couple of other similar issues and it appears this is a gfortran and Apple Silicon M1 CPU (arm64) problem - so nothing directly / specifically to do with the M_strings.f90. For reference see:

If you wan to close this issue that is fine - hopefully it will be useful anyway in case another person finds the same problem.

ORGINAL REPORT BELOW:

Hi

I am new to Fortran - so apologies in advance if this is some newbie error!

I was trying to build fpm-search that depends on M_strings. It was failing to build due to a problem with M_strings.

I have re-downloaded M_strings by cloning the repo directly, and following the instructions in the 'Readme.md' for the gfortran complier.

In the src sub-directory, I run make clean and then make F90=gfortran gfortran. Below is a copy of the output:

% make F90=gfortran gfortran

gfortran -g -O -Wall -std=f2018 -Wextra -Wno-maybe-uninitialized -Wno-uninitialized -finit-local-zero -c M_strings.f90
M_strings.f90:9602:34:

 9602 |       type is (real(kind=real128));     write(line(istart:),'(1pg0)') generic
      |                                  1
Error: Invalid type-spec at (1)
M_strings.f90:9659:34:

 9659 |       type is (real(kind=real128));     write(line(istart:),'("[",*(1pg0,1x))') generic
      |                                  1
Error: Invalid type-spec at (1)
M_strings.f90:3601:49:

 3601 |    forall(i=1:len(string)) array(i) = string(i:i)
      |                                                 1
Warning: Fortran 2018 obsolescent feature: FORALL construct at (1)
M_strings.f90:3587:52:

 3587 |    forall( i = 1:size(array)) string(i:i) = array(i)
      |                                                    1
Warning: Fortran 2018 obsolescent feature: FORALL construct at (1)
make: *** [M_strings.o] Error 1

I also tried to build with fpm build (after running make clean first - if that makes any difference!). The output then is as below:

% fpm build

 + mkdir -p build/dependencies
Initialized empty Git repository in /Users/simon/scratch/fortran/fpm-search/build/dependencies/M_strings/build/dependencies/M_msg/.git/
remote: Enumerating objects: 102, done.
remote: Counting objects: 100% (102/102), done.
remote: Compressing objects: 100% (78/78), done.
remote: Total 102 (delta 41), reused 55 (delta 23), pack-reused 0
Receiving objects: 100% (102/102), 270.10 KiB | 1.73 MiB/s, done.
Resolving deltas: 100% (41/41), done.
From https://github.com/urbanjost/M_msg
 * branch            HEAD       -> FETCH_HEAD
 + mkdir -p build/gfortran_2A42023B310FA28D/M_strings
 + gfortran -c ././src/M_strings.f90 -Wall -Wextra -Wimplicit-interface -fPIC -fmax-errors=1 -g -fcheck=bounds -fcheck=array-temps -fbacktrace -fcoarray=single -J build/gfortran_2A42023B310FA28D/M_strings -I build/gfortran_2A42023B310FA28D/M_strings  -o build/gfortran_2A42023B310FA28D/M_strings/src_M_strings.f90.o
././src/M_strings.f90:9602:34:

 9602 |       type is (real(kind=real128));     write(line(istart:),'(1pg0)') generic
      |                                  1
Error: Invalid type-spec at (1)
compilation terminated due to -fmax-errors=1.
 <ERROR> Compilation failed for object "src_M_strings.f90.o"
STOP 1

The error using both approaches look like the same issue, but that's is about as far as my wisdom on the matter goes!

Is it a source code problem - or user error?

The build is being done on a Apple Mac mini (Apple Silicon M1 - arm64) version 11.5.2 (Big Sur) using gfortran installed from brew - version info below:

% gfortran -v

Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/opt/homebrew/Cellar/gcc/11.2.0/libexec/gcc/aarch64-apple-darwin20/11.1.0/lto-wrapper
Target: aarch64-apple-darwin20
Configured with: ../configure --prefix=/opt/homebrew/Cellar/gcc/11.2.0 --libdir=/opt/homebrew/Cellar/gcc/11.2.0/lib/gcc/11 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-11 --with-gmp=/opt/homebrew/opt/gmp --with-mpfr=/opt/homebrew/opt/mpfr --with-mpc=/opt/homebrew/opt/libmpc --with-isl=/opt/homebrew/opt/isl --with-zstd=/opt/homebrew/opt/zstd --with-pkgversion='Homebrew GCC 11.2.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --build=aarch64-apple-darwin20 --with-system-zlib --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (Homebrew GCC 11.2.0)

Thanks

Simon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.