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

#pragma pack(1) doesn't issue a compilation warning #676

Open
speedy-h opened this issue Jan 17, 2023 · 1 comment
Open

#pragma pack(1) doesn't issue a compilation warning #676

speedy-h opened this issue Jan 17, 2023 · 1 comment
Assignees
Labels
bug Something isn't working CHERI C semantics clang Clang C/C++ frontend issues

Comments

@speedy-h
Copy link

#pragma pack(push, 1) should produce a -Wcheri-capability-misuse warning due to pointer alignment, but currently doesn't. I think the behaviour should be similar to __attribute__((packed))

/* Pack structures to reduce required space */
/* Pragma */
#pragma pack(push, 1)
typedef struct {
    int iValue;
    const char *pszKey;
} stPragma_t;
#pragma pack(pop)

/* Attribute */
typedef struct {
    int iValue;
    const char *pszKey;
} __attribute__((packed)) stAttribute_t;
@arichardson arichardson self-assigned this Jan 17, 2023
@arichardson arichardson added bug Something isn't working clang Clang C/C++ frontend issues CHERI C semantics labels Jan 17, 2023
@arichardson
Copy link
Member

arichardson commented Jan 17, 2023

I have some local changes to fix this that I'll try to clean up in the coming days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CHERI C semantics clang Clang C/C++ frontend issues
Projects
None yet
Development

No branches or pull requests

2 participants