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

libgmath: fix incorrect memset of double array #2005

Merged
merged 2 commits into from
Dec 10, 2021

Conversation

nilason
Copy link
Contributor

@nilason nilason commented Dec 7, 2021

Fixes the following compiler (clang 12) warning:

la.c:93:34: warning: 'memset' call operates on objects of type 'doublereal' (aka 'double') while the size is based on a different type 'doublereal *' (aka 'double *') [-Wsizeof-pointer-memaccess]
    memset(A->vals, 0, sizeof(A->vals));
           ~~~~~~~            ~~~^~~~
la.c:93:34: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
    memset(A->vals, 0, sizeof(A->vals));
                              ~~~^~~~

@nilason nilason requested a review from metzm December 7, 2021 13:51
@nilason nilason added the C Related code is in C label Dec 7, 2021
@neteler neteler added this to the 8.0.0 milestone Dec 8, 2021
@nilason nilason merged commit 2808fe4 into OSGeo:main Dec 10, 2021
@nilason
Copy link
Contributor Author

nilason commented Dec 10, 2021

Thanks @marisn !

Again, could someone backport this please.

neteler pushed a commit that referenced this pull request Dec 10, 2021
Addresses a -Wsizeof-pointer-memaccess compiler warning.
@nilason nilason deleted the fix_memset_error branch February 14, 2022 08:52
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Oct 26, 2022
Addresses a -Wsizeof-pointer-memaccess compiler warning.
ninsbl pushed a commit to ninsbl/grass that referenced this pull request Feb 17, 2023
Addresses a -Wsizeof-pointer-memaccess compiler warning.
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
Addresses a -Wsizeof-pointer-memaccess compiler warning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants