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

elemental function result must not be allocatable #6

Closed
brietzke opened this issue Feb 16, 2015 · 9 comments
Closed

elemental function result must not be allocatable #6

brietzke opened this issue Feb 16, 2015 · 9 comments

Comments

@brietzke
Copy link

Dear Stefano,

I just came across the flap code and found it can not compile since not standard conforming:
the function set_extension is declared with the elemental prefix.
But the function result is defined as allocatable which appears to be forbidden according to the fortran-standard (e.g. recent draft of f2008,f2015). A function with an allocatable function result must not be declared elemental.

Also I found that in the case of a matching file-extension the set_extension function result is not getting allocated. Not sure about the intention here: but maybe in case of matching extension newfilename should be assigned the original filename, e.g. like:
if(...)
:
else
newfilename = filename
endif

I apreciate your work anyway.
cheers
Gilbert

@szaghi
Copy link
Owner

szaghi commented Feb 17, 2015

Dear Gilbert, thank you very much for your interest. I think your are right: this is just a typo that I made also in other codes... a too fast cut/paste. Indeed the set_extension should not be used inside FLAP, but your remark is correct. Later in the morning I will fix this bug.

Thank you again.

@szaghi
Copy link
Owner

szaghi commented Feb 17, 2015

Hi Gilbert,

I have just fixed the bug. That function is not used into FLAP, but in some other codes and, indeed, the case that extension match is yet never matched, thus it was a real bug never discovered.

Thank you very much.

See you soon,
Stefano

P.S. I have added as contributor into the wiki, I hope it is ok for you.

@szaghi szaghi closed this as completed Feb 17, 2015
@szaghi
Copy link
Owner

szaghi commented Feb 17, 2015

Hi Gilbert,

Which compiler are you using? On my Arch Linux only Intel Fortran can build FLAP: gfortran (4.9.2) is not able to handle deferred length character defined into a derived type thus the building fails. On the other hand, Intel has not recognized the erroneous elemental usage even in a fully paranoiac mode with all warnings, errors, debug checks, standard compliant checks... activated. How did you discover the elemental mistake?

See you soon.

@zbeekman
Copy link
Contributor

@brietzke I too am curious about which compiler you are using. See @szaghi ’s comment above.

@brietzke
Copy link
Author

ifort 15 and gfortran 4.9.2
ifort indicates the problem accoring to the standard - gfortran doesn't
... older version of ifort got this wrong as well

@brietzke
Copy link
Author

in the 2008 draft on page 314 it is written: http://www.j3-fortran.org/doc/year/10/10-007.pdf
"C1290 The result variable of an elemental function shall be scalar, shall not have the POINTER or ALLOCATABLE attribute, and shall not have a type parameter that is de ned by an expression that is not a constant expression."

@szaghi
Copy link
Owner

szaghi commented Feb 17, 2015

Hi gilbert, i know the standard. I was just curious why my intel does not
catch that error. The reason is that i have an older version (14.x). Thank
you very much.

Il giorno 20:50 mar 17/feb/2015 brietzke notifications@github.com ha
scritto:

in the 2008 draft on page 314 it is written:
http://www.j3-fortran.org/doc/year/10/10-007.pdf
"C1290 The result variable of an elemental function shall be scalar, shall
not have the POINTER or ALLOCATABLE attribute, and shall not have a type
parameter that is dened by an expression that is not a constant expression."


Reply to this email directly or view it on GitHub
#6 (comment).

@brietzke
Copy link
Author

ok.looked again on the code and dragged out the few dependencies from the
IRprecision, lib_string and lib_io_misc.
Like this one ends up with not much more than the actual FLAP-module. IMHO
it would make the tool more useful for others: single file, no unused code
parts.
what do you think?
cheers
gilbert

On Tue, Feb 17, 2015 at 8:59 PM, Stefano Zaghi notifications@github.com
wrote:

Hi gilbert, i know the standard. I was just curious why my intel does not
catch that error. The reason is that i have an older version (14.x). Thank
you very much.

Il giorno 20:50 mar 17/feb/2015 brietzke notifications@github.com ha
scritto:

in the 2008 draft on page 314 it is written:
http://www.j3-fortran.org/doc/year/10/10-007.pdf
"C1290 The result variable of an elemental function shall be scalar,
shall
not have the POINTER or ALLOCATABLE attribute, and shall not have a type
parameter that is dened by an expression that is not a constant
expression."


Reply to this email directly or view it on GitHub
#6 (comment).


Reply to this email directly or view it on GitHub
#6 (comment).

@szaghi
Copy link
Owner

szaghi commented Feb 18, 2015

Hi gilbert,

The dependency from IR_Precision is mandatory: all my codes use it, and I
will never change :-)

On the other hand, you are right that there are few dependencies on the
others modules. However, FLAP is just a subset of another code of mine that I
have considered helpful also standalone. If I include those dependencies into
the FLAP main module I will have the same code defined into more than one
place thus the maintaince will be cumbersome. Presently, I provide an easy
way to compile FLAP in a single library (both static and shared) so that
the end-user have to manage one file...

I am in dubt... however, I seriously consider your request.

Thank you very much.

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

No branches or pull requests

3 participants