Skip to content

Fixed format warnings in 64 bit integer builds. #700

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

Merged

Conversation

ACSimon33
Copy link
Contributor

Description

There were print format warnings when 64-bit integers are enabled. The fprintf statements were using "%d" or "%i" as integer conversion specifiers which are the ones for 32-bit integers. 64-bit are "%lld" (MacOS) or "%ld" (Linux):

/Users/simonm/git/lapack/CBLAS/src/cblas_xerbla.c:66:69: warning: format specifies type 'int' but the argument has type 'int64_t' (aka 'long long') [-Wformat]
      fprintf(stderr, "Parameter %d to routine %s was incorrect\n", info, rout);
                                 ~~                                 ^~~~
                                 %lld
1 warning generated.

I added the preprocessor defines CBLAS_IFMT and LAPACK_IFMT which use the correct specifier (platform independent via "inttypes.h"). We could also put #ifdefs around each fprintf statement which is a bit tedious IMHO.

Checklist

  • [N/A] The documentation has been updated.
  • [N/A] If the PR solves a specific issue, it is set to be closed on merge.

Copy link
Collaborator

@weslleyspereira weslleyspereira left a comment

Choose a reason for hiding this comment

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

Thanks!

@weslleyspereira weslleyspereira merged commit dcba2e2 into Reference-LAPACK:master Aug 11, 2022
@ACSimon33 ACSimon33 deleted the cblas_int64_warning_fix branch August 12, 2022 06:07
@julielangou julielangou added this to the LAPACK 3.11.0 milestone Nov 12, 2022
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.

4 participants