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

Preprocessor failure with gfortran in xml_routines.f90 in 7.0 #9

Open
zao opened this issue Jan 24, 2022 · 4 comments
Open

Preprocessor failure with gfortran in xml_routines.f90 in 7.0 #9

zao opened this issue Jan 24, 2022 · 4 comments

Comments

@zao
Copy link

zao commented Jan 24, 2022

The macros in xml_routines.f90 use the stringification feature #x of the preprocessor which is not available in the "traditional" cpp mode that the GNU toolchain uses to preprocess code.

This leads to several compilation failures like the following as the # is emitted verbatim into the resulting source file:

xml_routines.f90:96:31:

   96 |     _NE(general_info)
      |                               1
Error: Syntax error in argument list at (1)

Manual expansion of the macros that use # (splitting the longer ones into multiple lines due to line lengths) compiles properly.

This is building via EasyBuild and its foss/2021b and intel/2021b toolchains, Intel seems unaffected.

@dceresoli
Copy link
Owner

Can you try now? I fixed and uploaded new tar.gz files to the release.

@zao
Copy link
Author

zao commented Jan 27, 2022

Please note that the preprocessing unconditionally removed these conditional statements:

#if defined(__OMP) 
    integer, external :: omp_get_max
    nthreads = omp_get_max()
#endif    

I'll give it a try, I just have to unbreak my build recipes first as modifying the release tarballs in-place caused the checksum protection to (rightfully) alert.

@zao
Copy link
Author

zao commented Jan 27, 2022

The generated source file does not compile here as several lines are too long, assuming this is some 135 character Fortran limit that the/our QE build process doesn't specify a flag for?

xml_routines.f90:167:127:

  167 |       call XML_NewElement(xmlf, "q_gipaw")
      |                                                                                                                               1
Error: Unterminated character constant beginning at (1)
xml_routines.f90:168:129:

  168 |         call XML_AddCharacters(xmlf, (q_gipaw*tpiba))
      |                                                                                                                                 1
Error: Unterminated character constant beginning at (1)
xml_routines.f90:172:132:

  172 |       call XML_NewElement(xmlf, "filfield"); call XML_AddCharacters(xmlf, trim((filfield))); call XML_EndElement(xmlf, "filfield");
      |                                                                                                                                    1
Error: Syntax error in argument list at (1)
xml_routines.f90:184:132:

  184 |         call XML_AddAttribute(xmlf, "size", (nat))
      |                                                                                                                                    1
Error: Syntax error in argument list at (1)
xml_routines.f90:189:132:

  189 |       call XML_NewElement(xmlf, "hfi_output_unit"); call XML_AddCharacters(xmlf, trim((hfi_output_unit))); call XML_EndElement(xmlf, "hfi_output_unit");
      |                                                                                                                                    1
Error: Syntax error in argument list at (1)
xml_routines.f90:191:132:

  191 |         call XML_AddAttribute(xmlf, "size", (nat))
      |                                                                                                                                    1
Error: Syntax error in argument list at (1)
xml_routines.f90:196:132:

  196 |     call XML_EndElement(xmlf, "input")
      |                                                                                                                                    1
Error: Unterminated character constant beginning at (1)

In my manual preprocessing, I had to manually line-wrap the output of _OUTS and _OUTV to make it short enough for the compiler to accept it.

@dceresoli
Copy link
Owner

Dear Lars, tomorrow I'll try to fix both issues. Thank you for pointing out!

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

2 participants