Skip to content

Fix Index-64 conversion errors#1278

Open
ACSimon33 wants to merge 8 commits into
Reference-LAPACK:masterfrom
ACSimon33:index_64_conversion_errors
Open

Fix Index-64 conversion errors#1278
ACSimon33 wants to merge 8 commits into
Reference-LAPACK:masterfrom
ACSimon33:index_64_conversion_errors

Conversation

@ACSimon33
Copy link
Copy Markdown
Contributor

Description

Compiling with -Werror=conversion and -DBUILD_INDEX64 results in a lot of conversion warnings/errors. This MR fixes those by adding explicit conversions to the appropriate types or fixing wrong declarations. The conversion errors are mostly in the testing routines, but there are a few in the XBLAS-related routines as well.

The three types of conversion warnings are:

  • Error: Possible change of value in conversion from COMPLEX(8) to REAL(8) at (1) [-Werror=conversion]
  • Error: Possible change of value in conversion from INTEGER(8) to REAL(4) at (1) [-Werror=conversion]
  • Error: Possible change of value in conversion from REAL(4) to INTEGER(8) at (1) [-Werror=conversion]

Copilot AI review requested due to automatic review settings May 12, 2026 15:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request addresses build failures when compiling LAPACK with -DBUILD_INDEX64 and -Werror=conversion by removing implicit/narrowing conversions across testing code and a few computational/XBLAS-related routines.

Changes:

  • Add explicit REAL(...), INT(...), and CMPLX(...) conversions (and a few literal-kind adjustments) to eliminate conversion warnings under Index-64 builds.
  • Fix a few incorrect/misleading declarations that caused problematic implicit conversions (e.g., statement-function result types).
  • Remove unused intermediate arrays/loops in the *EBCHVXX testing routines.

Reviewed changes

Copilot reviewed 171 out of 171 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
TESTING/LIN/zebchvxx.f Remove unused DIFF array/loop to avoid unnecessary conversions.
TESTING/LIN/stsqr01.f Add explicit REAL(MAX(...)) scaling factors in residual computations.
TESTING/LIN/strt05.f Cast (N+1) factors to REAL in error-bound scaling.
TESTING/LIN/stpt05.f Cast (N+1) factors to REAL in error-bound scaling.
TESTING/LIN/stbt05.f Cast NZ factors to REAL in error-bound scaling.
TESTING/LIN/sqrt16.f Cast MAX(M,N) to REAL in residual normalization.
TESTING/LIN/sqrt12.f Replace ZERO with 0 in integer comparison.
TESTING/LIN/sqrt05.f Add explicit REAL(MAX(...)) scaling factors in residual computations.
TESTING/LIN/sqrt04.f Add explicit REAL(MAX(...)) scaling factors in residual computations.
TESTING/LIN/sptt05.f Cast NZ factors to REAL in error-bound scaling.
TESTING/LIN/sppt05.f Cast (N+1) factors to REAL in error-bound scaling.
TESTING/LIN/spot05.f Cast (N+1) factors to REAL in error-bound scaling.
TESTING/LIN/spbt05.f Cast NZ factors to REAL in error-bound scaling.
TESTING/LIN/sorhr_col02.f Add explicit REAL(MAX(...)) scaling factors in residual computations.
TESTING/LIN/sorhr_col01.f Add explicit REAL(MAX(...)) scaling factors in residual computations.
TESTING/LIN/slqt05.f Add explicit REAL(MAX(...)) scaling factors in residual computations.
TESTING/LIN/slqt04.f Add explicit REAL(MAX(...)) scaling factors in residual computations.
TESTING/LIN/slattr.f Cast diagonal indices and (N-2) to REAL to avoid implicit conversions.
TESTING/LIN/slattp.f Cast diagonal indices to REAL to avoid implicit conversions.
TESTING/LIN/slattb.f Cast diagonal indices to REAL to avoid implicit conversions.
TESTING/LIN/sgtt05.f Cast NZ factors to REAL in error-bound scaling.
TESTING/LIN/sget07.f Cast (N+1) factors to REAL in error-bound scaling.
TESTING/LIN/sgbt05.f Cast NZ factors to REAL in error-bound scaling.
TESTING/LIN/sdrvrf4.f Cast MAX(N,1) to REAL in normalization.
TESTING/LIN/sdrvrf3.f Cast MAX(M,N,1) to REAL in normalization.
TESTING/LIN/sdrvrf1.f Cast LDA to REAL when scaling SMALL/LARGE.
TESTING/LIN/schksy_rook.f Use integer literal 0 in integer comparisons.
TESTING/LIN/schksy_rk.f Use integer literal 0 in integer comparisons.
TESTING/LIN/schkps.f Cast N to REAL before CEILING rank calculation.
TESTING/LIN/schkeq.f Make (-1)**(I+J) multiplication explicit in REAL arithmetic.
TESTING/LIN/cunhr_col02.f Add explicit REAL(MAX(...)) scaling factors in residual computations.
TESTING/LIN/cunhr_col01.f Add explicit REAL(MAX(...)) scaling factors in residual computations.
TESTING/LIN/ctsqr01.f Add explicit REAL(MAX(...)) scaling factors in residual computations.
TESTING/LIN/ctrt05.f Cast (N+1) factors to REAL in error-bound scaling.
TESTING/LIN/ctpt05.f Cast (N+1) factors to REAL in error-bound scaling.
TESTING/LIN/ctbt05.f Cast NZ factors to REAL in error-bound scaling.
TESTING/LIN/cqrt16.f Cast MAX(M,N) to REAL in residual normalization.
TESTING/LIN/cqrt12.f Replace ZERO with 0 in integer comparison.
TESTING/LIN/cqrt05.f Add explicit REAL(MAX(...)) scaling factors; minor cleanup at EOF.
TESTING/LIN/cqrt04.f Add explicit REAL(MAX(...)) scaling factors; minor cleanup at EOF.
TESTING/LIN/cptt05.f Cast NZ factors to REAL in error-bound scaling.
TESTING/LIN/cppt05.f Cast (N+1) factors to REAL in error-bound scaling.
TESTING/LIN/cpot05.f Cast (N+1) factors to REAL in error-bound scaling.
TESTING/LIN/cpbt05.f Cast NZ factors to REAL in error-bound scaling.
TESTING/LIN/clqt05.f Add explicit REAL(MAX(...)) scaling factors in residual computations.
TESTING/LIN/clqt04.f Add explicit REAL(MAX(...)) scaling factors in residual computations.
TESTING/LIN/clattr.f Cast diagonal indices to CMPLX(REAL(...)); cast (N-2) to REAL.
TESTING/LIN/clattp.f Cast diagonal indices to CMPLX(REAL(...)).
TESTING/LIN/clattb.f Cast diagonal indices to CMPLX(REAL(...)).
TESTING/LIN/cgtt05.f Cast NZ factors to REAL in error-bound scaling.
TESTING/LIN/cget07.f Cast (N+1) factors to REAL in error-bound scaling.
TESTING/LIN/cgbt05.f Cast NZ factors to REAL in error-bound scaling.
TESTING/LIN/cebchvxx.f Remove unused DIFF array/loop to avoid unnecessary conversions.
TESTING/LIN/cdrvrf4.f Cast MAX(N,1) to REAL in normalization.
TESTING/LIN/cdrvrf3.f Cast MAX(M,N,1) to REAL in normalization.
TESTING/LIN/cdrvrf1.f Cast LDA to REAL when scaling SMALL/LARGE.
TESTING/LIN/cchksy_rook.f Use integer literal 0 in integer comparisons.
TESTING/LIN/cchksy_rk.f Use integer literal 0 in integer comparisons.
TESTING/LIN/cchkps.f Cast N to REAL before CEILING rank calculation.
TESTING/LIN/cchkhe_rook.f Use integer literal 0 in integer comparisons.
TESTING/LIN/cchkhe_rk.f Use integer literal 0 in integer comparisons.
TESTING/LIN/cchkeq.f Make (-1)**(I+J) multiplication explicit in REAL arithmetic.
TESTING/EIG/ssyt22.f Cast M to REAL in ULP scaling to avoid implicit conversions.
TESTING/EIG/ssyt21.f Cast N to REAL in ULP scaling; adjust result normalization.
TESTING/EIG/ssvdch.f Cast MAX(N/10,1) to REAL in tolerance computation.
TESTING/EIG/sstt22.f Cast M to REAL in ULP scaling.
TESTING/EIG/sstt21.f Cast N to REAL in ULP scaling.
TESTING/EIG/sspt21.f Cast N to REAL in ULP scaling.
TESTING/EIG/ssgt01.f Cast N to REAL in ULP scaling for residuals.
TESTING/EIG/ssbt21.f Cast N to REAL in ULP scaling.
TESTING/EIG/shst01.f Cast N to REAL in SMLNUM and residual normalization.
TESTING/EIG/sget54.f Cast 2*N to REAL in ULP scaling.
TESTING/EIG/sget51.f Cast N to REAL in ULP scaling.
TESTING/EIG/sget35.f Cast integer-valued generators to REAL for matrix fills.
TESTING/EIG/sget32.f Cast sign/ITVAL-generated integers to REAL for arithmetic.
TESTING/EIG/sget24.f Cast N to REAL in ULP scaling.
TESTING/EIG/sget10.f Cast M to REAL in EPS scaling.
TESTING/EIG/sdrvst2stg.f Cast N to REAL in norm setup and random index selection.
TESTING/EIG/sdrvst.f Cast N to REAL in norm setup and random index selection.
TESTING/EIG/sdrvsg2stg.f Cast N to REAL in norm setup and random index selection.
TESTING/EIG/sdrvsg.f Cast N to REAL in norm setup and random index selection.
TESTING/EIG/sdrvbd.f Cast MNMIN to REAL and cast (MNMIN-1) before SLARND scaling.
TESTING/EIG/sdrgvx.f Return workspace sizes as REAL(MAXWRK) under index64.
TESTING/EIG/sdrgsx.f Return workspace sizes as REAL(MAXWRK) under index64.
TESTING/EIG/sdrgev3.f Return workspace sizes as REAL(MAXWRK); cast N1 in magnitude setup.
TESTING/EIG/sdrgev.f Return workspace sizes as REAL(MAXWRK); cast N1 in magnitude setup.
TESTING/EIG/sdrges3.f Return workspace sizes as REAL(MAXWRK) under index64.
TESTING/EIG/sdrges.f Return workspace sizes as REAL(MAXWRK) under index64.
TESTING/EIG/sckcsd.f Cast M to REAL when scaling random index selection.
TESTING/EIG/schkst2stg.f Cast N to REAL in norm setup and test-constant formulas.
TESTING/EIG/schkst.f Cast N to REAL in norm setup and test-constant formulas.
TESTING/EIG/schksb2stg.f Cast N to REAL in norm setup.
TESTING/EIG/schksb.f Cast N to REAL in norm setup.
TESTING/EIG/schkhs.f Cast N to REAL in norm setup.
TESTING/EIG/schkgg.f Cast N1 to REAL in magnitude setup.
TESTING/EIG/schkdmd.f90 Use REAL(...,KIND=WP) in tolerances to avoid kind conversions.
TESTING/EIG/schkbd.f Cast MAX(M,N,1)/MAX(M,N) to REAL; cast before SLARND scaling.
TESTING/EIG/schkbb.f Cast MAX(M,N) to REAL in norm setup.
TESTING/EIG/cstt22.f Cast M to REAL in ULP scaling.
TESTING/EIG/cstt21.f Cast N to REAL in ULP scaling.
TESTING/EIG/csgt01.f Cast N to REAL in ULP scaling for residuals.
TESTING/EIG/chst01.f Cast N to REAL in SMLNUM and residual normalization.
TESTING/EIG/chpt21.f Cast N to REAL in ULP scaling.
TESTING/EIG/chet22.f Cast M to REAL in ULP scaling.
TESTING/EIG/chet21.f Cast N to REAL in ULP scaling and result normalization.
TESTING/EIG/chbt21.f Cast N to REAL in ULP scaling.
TESTING/EIG/cget54.f Cast 2*N to REAL in ULP scaling.
TESTING/EIG/cget51.f Cast N to REAL in ULP scaling.
TESTING/EIG/cget24.f Cast N to REAL in ULP scaling.
TESTING/EIG/cget10.f Cast M to REAL in EPS scaling.
TESTING/EIG/cdrvst2stg.f Cast N to REAL in norm setup and random index selection.
TESTING/EIG/cdrvst.f Cast N to REAL in norm setup and random index selection.
TESTING/EIG/cdrvsg2stg.f Cast N to REAL in norm setup and random index selection.
TESTING/EIG/cdrvsg.f Cast N to REAL in norm setup and random index selection.
TESTING/EIG/cdrvbd.f Cast (MNMIN-1) before SLARND scaling.
TESTING/EIG/cdrgvx.f Return complex WORK query sizes with explicit integer→real conversion.
TESTING/EIG/cdrgsx.f Return complex WORK query sizes with explicit integer→real conversion.
TESTING/EIG/cdrgev3.f Return complex WORK query sizes as CMPLX(REAL(MAXWRK)); cast N1.
TESTING/EIG/cdrgev.f Return complex WORK query sizes as CMPLX(REAL(MAXWRK)); cast N1.
TESTING/EIG/cdrges3.f Return complex WORK query sizes with explicit integer→real conversion.
TESTING/EIG/cdrges.f Return complex WORK query sizes with explicit integer→real conversion.
TESTING/EIG/cckcsd.f Cast M to REAL when scaling random index selection.
TESTING/EIG/cchkst2stg.f Cast N to REAL in norm setup and test-constant formulas.
TESTING/EIG/cchkst.f Cast N to REAL in norm setup and test-constant formulas.
TESTING/EIG/cchkhs.f Cast N to REAL in norm setup.
TESTING/EIG/cchkhb2stg.f Cast N to REAL in norm setup.
TESTING/EIG/cchkhb.f Cast N to REAL in norm setup.
TESTING/EIG/cchkgg.f Cast N1 to REAL in magnitude setup.
TESTING/EIG/cchkdmd.f90 Use REAL(...,KIND=WP) in tolerances to avoid kind conversions.
TESTING/EIG/cchkbd.f Cast MAX(M,N,1)/MAX(M,N) to REAL in norm setup.
TESTING/EIG/cchkbb.f Cast MAX(M,N) to REAL in norm setup.
SRC/zsyrfsx.f Make REF_TYPE assignment explicit with INT(...).
SRC/zporfsx.f Make REF_TYPE assignment explicit with INT(...).
SRC/zla_lin_berr.f Fix statement-function result type to avoid complex→real conversion issues.
SRC/zherfsx.f Make REF_TYPE assignment explicit with INT(...).
SRC/zgerfsx.f Make REF_TYPE assignment explicit with INT(...).
SRC/zgbrfsx.f Make REF_TYPE assignment explicit with INT(...).
SRC/ssyrfsx.f Make REF_TYPE/ITHRESH handling explicit with INT(...)/REAL(...).
SRC/sporfsx.f Make REF_TYPE/ITHRESH handling explicit with INT(...)/REAL(...).
SRC/sla_syamv.f Cast (N+1) to REAL for SAFE1 scaling.
SRC/sla_lin_berr.f Cast (NZ+1) to REAL for SAFE1 scaling.
SRC/sla_geamv.f Cast (N+1) to REAL for SAFE1 scaling.
SRC/sla_gbamv.f Cast (N+1) to REAL for SAFE1 scaling.
SRC/sgerfsx.f Make REF_TYPE/ITHRESH handling explicit with INT(...)/REAL(...).
SRC/sgbrfsx.f Make REF_TYPE/ITHRESH handling explicit with INT(...)/REAL(...).
SRC/dsyrfsx.f Make REF_TYPE assignment explicit with INT(...).
SRC/dporfsx.f Make REF_TYPE assignment explicit with INT(...).
SRC/dgerfsx.f Make REF_TYPE assignment explicit with INT(...).
SRC/dgbrfsx.f Make REF_TYPE assignment explicit with INT(...).
SRC/csyrfsx.f Make REF_TYPE/ITHRESH handling explicit with INT(...)/REAL(...).
SRC/cporfsx.f Make REF_TYPE/ITHRESH handling explicit with INT(...)/REAL(...).
SRC/cla_syamv.f Cast (N+1) to REAL for SAFE1 scaling.
SRC/cla_lin_berr.f Fix statement-function result type and cast (NZ+1) to REAL for scaling.
SRC/cla_heamv.f Cast (N+1) to REAL for SAFE1 scaling.
SRC/cla_geamv.f Cast (N+1) to REAL for SAFE1 scaling.
SRC/cla_gbamv.f Cast (N+1) to REAL for SAFE1 scaling.
SRC/cherfsx.f Make REF_TYPE/ITHRESH handling explicit with INT(...)/REAL(...).
SRC/cgerfsx.f Make REF_TYPE/ITHRESH handling explicit with INT(...)/REAL(...).
SRC/cgbrfsx.f Make REF_TYPE/ITHRESH handling explicit with INT(...)/REAL(...).
CBLAS/testing/c_zblat3.f Fix NULL integer comparison (0 vs 0.).
CBLAS/testing/c_zblat2.f Use double-precision literals in DCMPLX arguments.
CBLAS/testing/c_sblat3.f Cast integer-valued expressions to REAL in test matrix generation.
CBLAS/testing/c_sblat2.f Cast integer-valued expressions to REAL in test vector/matrix generation.
CBLAS/testing/c_sblat1.f Cast integer literals to REAL in test-vector initialization.
CBLAS/testing/c_cblat3.f Cast integer-valued expressions to REAL and fix NULL comparison.
CBLAS/testing/c_cblat2.f Cast integer-valued expressions to REAL in test matrix/vector generation.
BLAS/TESTING/sblat3.f Cast integer-valued expressions to REAL in test matrix generation.
BLAS/TESTING/sblat2.f Cast integer-valued expressions to REAL in test vector/matrix generation.
BLAS/TESTING/sblat1.f Cast integer literals to REAL in test-vector initialization.
BLAS/TESTING/cblat3.f Cast integer-valued expressions to REAL in test matrix generation.
BLAS/TESTING/cblat2.f Cast integer-valued expressions to REAL in test vector/matrix generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread TESTING/EIG/cdrges.f Outdated
Comment thread TESTING/EIG/cdrges.f
Comment thread TESTING/EIG/cdrges3.f Outdated
Comment thread TESTING/EIG/cdrges3.f
Comment thread TESTING/EIG/cdrgsx.f Outdated
Comment thread TESTING/EIG/cdrgsx.f
Comment thread TESTING/EIG/cdrgvx.f
Comment thread TESTING/EIG/cdrgvx.f
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

Successfully merging this pull request may close these issues.

2 participants