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

memalign report mistake #139

Closed
jiqimaogou opened this issue Feb 21, 2020 · 2 comments
Closed

memalign report mistake #139

jiqimaogou opened this issue Feb 21, 2020 · 2 comments

Comments

@jiqimaogou
Copy link

jiqimaogou commented Feb 21, 2020

#define ALIGNED_MALLOC(ptr, type, size)    {  ptr = (type *)memalign(16, sizeof(type) * size); }


    ALIGNED_MALLOC(p_test, float, 100 + 1);

    for (int i = 0; i <= 100; i++)
    {
        p_test[i] = pow(xxx);
    }

2020-02-21 11:25:53.210 4297-4297/? I/wrap.sh: WRITE of size 4 at 0x0040000401d0 thread T18
2020-02-21 11:25:53.265 4297-4297/? I/wrap.sh: 0x0040000401d1 is located 0 bytes to the right of 401-byte region [0x004000040040,0x0040000401d1)

why is 401 byte not 404 byte

@jiqimaogou
Copy link
Author

it my wrong, macro wrong.

@DanielKristofKiss
Copy link
Member

an extra parentheses around the macro argument will do the trick, so closing the ticket.
#define ALIGNED_MALLOC(ptr, type, size) { ptr = (type *)memalign(16, sizeof(type) * (size)); }

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

No branches or pull requests

2 participants