Skip to content

warnings from a failed flang build trial #1115

@jalvesz

Description

@jalvesz

Description

I tried to build stdlib with flang 21.1.8 from a conda installation on windows with the following cmake options:

cmake -B build -G Ninja -DBUILD_TESTING=on -DCMAKE_MAXIMUM_RANK:String=4 -DCMAKE_BUILD_TYPE=Release -DCMAKE_Fortran_COMPILER=flang -DCMAKE_C_COMPILER=clang-cl -DWITH_XDP=off -DWITH_QP=off

installation procedure: https://fortran-lang.discourse.group/t/building-flang/10697/14

I got some warnings and errors that I thought are worth noting even if flang is not yet fully production ready:

Deprecation and unsafe Windows functions

[146/2261] Building C object src\system\CMakeFiles\fortran_stdlib_system.dir\stdlib_system.c.obj
C:\\...\fortran_lang\stdlib\src\system\stdlib_system.c(51,17): warning: 'strerror' is deprecated: This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]
   51 |     char* err = strerror(errno);
      |                 ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\string.h(177,16): note: 'strerror' has been explicitly marked deprecated here
  177 | _Check_return_ _CRT_INSECURE_DEPRECATE(strerror_s)
      |                ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\include\vcruntime.h(355,55): note: expanded from macro '_CRT_INSECURE_DEPRECATE'
  355 |         #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
      |                                                       ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\include\vcruntime.h(345,47): note: expanded from macro '_CRT_DEPRECATE_TEXT'
  345 | #define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
      |                                               ^
1 warning generated.
[152/2261] Building C object src\system\CMakeFiles\fortran_stdlib_system.dir\stdlib_system_subprocess.c.obj
C:\\...\fortran_lang\stdlib\src\system\stdlib_system_subprocess.c(50,20): warning: 'fopen' is deprecated: This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [-Wdeprecated-declarations]     
   50 |         stdin_fp = fopen(stdin_file, "w");
      |                    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdio.h(212,20): note: 'fopen' has been explicitly marked deprecated here
  212 |     _Check_return_ _CRT_INSECURE_DEPRECATE(fopen_s)
      |                    ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\include\vcruntime.h(355,55): note: expanded from macro '_CRT_INSECURE_DEPRECATE'
  355 |         #define _CRT_INSECURE_DEPRECATE(_Replacement) _CRT_DEPRECATE_TEXT(    \
      |                                                       ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\include\vcruntime.h(345,47): note: expanded from macro '_CRT_DEPRECATE_TEXT'
  345 | #define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
      |                                               ^
1 warning generated.

Warnings:

[144/2261] Building Fortran object src\system\CMakeFiles\fortran_stdlib_system.dir\stdlib_system.F90.obj
C:\\...\\fortran_lang\\stdlib\\src\\system\\stdlib_system.F90:1248:16: portability: Reference to generic function 'state_type' (resolving to specific 'new_state_nowhere') is ambiguous with a structure constructor of the same name [-Wambiguous-structure-constructor]
          err0 = state_type(STDLIB_SUCCESS,path,' not deleted: file does n&

Ambiguous contructors

[262/2261] Building Fortran object src\stringlist\CMakeFiles\fortran_stdlib_stringlist.dir\stdlib_stringlist_type.f90.obj
C:\\...\\fortran_lang\\stdlib\\src\\stringlist\\stdlib_stringlist_type.f90:152:21: warning: Function result is never defined [-Wundefined-function-result]
        pure function new_stringlist()
                      ^^^^^^^^^^^^^^
C:\\...\\fortran_lang\\stdlib\\src\\stringlist\\stdlib_stringlist_type.f90:169:33: portability: Reference to generic function 'stringlist_type' (resolving to specific 'new_stringlist_sarray') is ambiguous with a structure constructor of the same name [-Wambiguous-structure-constructor]    
          new_stringlist_carray = stringlist_type( sarray )
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^
C:\\...\\fortran_lang\\stdlib\\src\\stringlist\\stdlib_stringlist_type.f90:179:33: portability: Reference to generic function 'stringlist_type' (resolving to specific 'new_stringlist') is ambiguous with a structure constructor of the same name [-Wambiguous-structure-constructor]
          new_stringlist_sarray = stringlist_type()

Underflow

Could be replace by ieee_nan ?

Building Fortran object src\lapack\CMakeFiles\fortran_stdlib_lapack.dir\stdlib_lapack_auxiliary.f90.obj
C:\\...\\fortran_lang\\stdlib\\build\\src\\lapack\\stdlib_lapack_auxiliary.f90:26:23: warning: underflow on division [-Wfolding-exception]
                small = one / huge(zero)
                        ^^^^^^^^^^^^^^^^
C:\\...\\fortran_lang\\stdlib\\build\\src\\lapack\\stdlib_lapack_auxiliary.f90:75:23: warning: underflow on division [-Wfolding-exception]
                small = one / huge(zero)

Cascade of errors on LAPACK

There was a very large cascade of errors, ilp and other kind parameters not being found, which seems like it coudn't find them given the hierarchy of files in between the parameters definition and their usage within the submodules. Also errors regarding the some pure procedures interface. These errors seem to be most likely due to flangs current limitations. I tried to mimick this issue with a MWE, but if everything is in a single file, then it manages, so it might be related with the multi-file architecture.

error: Semantic errors in src\lapack\CMakeFiles\fortran_stdlib_lapack.dir\stdlib_lapack_eigv_gen2.f90-pp.f90
C:\\...\\fortran_lang\\stdlib\\build\\src\\lapack\\stdlib_lapack_eigv_gen2.f90:5281:39: error: Parameter 'ilp' not found
             equivalence        ( ci( 1_ilp, 1_ilp ), civ( 1_ilp ) ),( cr(&

C:\\...\\fortran_lang\\stdlib\\build\\src\\lapack\\stdlib_lapack_eigv_svd_drivers2.f90:13562:43: error: No explicit type declared for 'dp'
             rwork( 3_ilp ) = real( n2,KIND=dp)

C:\\...\\fortran_lang\\stdlib\\build\\src\\lapack\\stdlib_lapack_eigv_svd_drivers2.f90:13538:18: warning: Reference to the procedure 'stdlib_zlascl' has an implicit interface that is distinct from another reference: incompatible dummy argument #5: incompatible dummy data object types: REAL(4) vs REAL(8) [-Wincompatible-implicit-interfaces]
                   call stdlib_zlascl( 'G',0_ilp,0_ilp, sva(p), one, m, 1_&
                   ^
C:\\...\\fortran_lang\\stdlib\\build\\src\\lapack\\stdlib_lapack_eigv_svd_drivers2.f90:3784:15: previous reference to 'stdlib_zlascl'  
                call stdlib_zlascl( 'G', 0_ilp, 0_ilp, anrm, smlnum, m, n,&
                ^
C:\\...\\fortran_lang\\stdlib\\build\\src\\lapack\\stdlib_lapack_eigv_svd_drivers2.f90:13538:18: error: Procedure 'stdlib_zlascl' referenced in pure subprogram 'stdlib_zgesvj' must be pure too
                   call stdlib_zlascl( 'G',0_ilp,0_ilp, sva(p), one, m, 1_&

Expected Behaviour

full working build was not expected as flang is still under active development but it does provide useful checks.

Version of stdlib

v0.8.1

Platform and Architecture

Windows

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    compiler: flangSpecific to classic flang compiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions