Skip to content

3.12.1 Warning: type of ‘lsame_’ does not match original declaration #1104

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

Open
codemasters-svg opened this issue Feb 3, 2025 · 1 comment

Comments

@codemasters-svg
Copy link

With GCC 11.3.0

[100%] Built target lapacke_64_obj
[100%] Linking C shared library ../lib/liblapacke.so
/MyPkgBuild/lapack/src/lapack/LAPACKE/include/lapack.h:138:16: warning: type of ‘lsame_’ does not match original declaration [-Wlto-type-mismatch]
  138 | lapack_logical LAPACK_lsame_base( const char* ca,  const char* cb
      |                ^
/MyPkgBuild/lapack/src/lapack/LAPACKE/include/lapack.h:138:16: note: return value type mismatch
  138 | lapack_logical LAPACK_lsame_base( const char* ca,  const char* cb
      |                ^
/MyPkgBuild/lapack/src/lapack/LAPACKE/include/lapack.h:138:16: note: type ‘int32_t’ should match type ‘int64_t’
/MyPkgBuild/lapack/src/lapack/LAPACKE/include/lapack.h:138:16: note: ‘lsame_’ was previously declared here
/MyPkgBuild/lapack/src/lapack/LAPACKE/include/lapack.h:138:16: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
[100%] Built target lapacke

Build command:

build() {
  cmake -B build -S $pkgbase \
    -DCMAKE_SKIP_RPATH=ON \
    -DBUILD_SHARED_LIBS=ON \
    -DBUILD_TESTING=OFF \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_Fortran_COMPILER=/usr/bin/gfortran-11 \
    -DLAPACKE_WITH_TMG=ON \
    -DCBLAS=ON
  cmake --build build

  cmake -B build64 -S $pkgbase \
    -DCMAKE_SKIP_RPATH=ON \
    -DBUILD_SHARED_LIBS=ON \
    -DBUILD_TESTING=OFF \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_Fortran_COMPILER=/usr/bin/gfortran-11 \
    -DLAPACKE_WITH_TMG=ON \
    -DCBLAS=ON \
    -DBUILD_INDEX64=ON
  cmake --build build64
}
@martin-frbg
Copy link
Collaborator

This comes about because LAPACKE/include/lapack.h has the prototypes for LSAME after the ifdefs surrounding the exact type of lapack_logical (so it either returns an int32 or int64) but before the ifdef that defines the API_SUFFIX macros for adding the optional _64 postfix to the symbol name. (And accordingly only LAPACK_GLOBAL(lsame...) rather than LAPACK_GLOBAL_SUFFIX(lsame...) .)
This makes it look like somebody was undecided whether there should be a single LSAME handling string comparisons in both 32-bit and 64-bit index cases, or separate LSAME and LSAME_64 like for all other LAPACK functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants