forked from cil-project/cil
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from goblint/alignas_support
Respect C11 `_Alignas(...)` for computing alignments
- Loading branch information
Showing
3 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <stdalign.h> | ||
|
||
struct testalign { | ||
int f1; | ||
} __attribute__((__aligned__(16))); | ||
|
||
struct testalign2 { | ||
_Alignas(16) int f1; | ||
}; | ||
|
||
struct testalign3 { | ||
_Alignas(long double) int f1; | ||
}; | ||
|
||
|
||
int main() { | ||
struct testalign a; | ||
char static_assertion_failure_1[(__alignof__ (a) == 16) ? 1 : -1]; | ||
|
||
struct testalign2 b; | ||
char static_assertion_failure_2[(__alignof__ (b) == 16) ? 1 : -1]; | ||
|
||
struct testalign3 c; | ||
char static_assertion_failure_3[(__alignof__ (c) == __alignof__ (long double)) ? 1 : -1]; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters