diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2015-07-08 10:16:53 +0200 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2015-07-08 10:16:53 +0200 |
commit | 2b1c0aa69adafac185dd6c4e460d83517bcc8884 (patch) | |
tree | 00efb84c95bb3c75286dc0085e9c38b6cf5a25be /test/regression/bitfields1.c | |
parent | 24a08b236f6334f5c01e423fb564892e070b4bff (diff) | |
download | compcert-2b1c0aa69adafac185dd6c4e460d83517bcc8884.tar.gz compcert-2b1c0aa69adafac185dd6c4e460d83517bcc8884.zip |
Fix issue with bit fields of type _Bool
cparser/Bitfields.ml: when assigning to a bit field of type _Bool, the
right-hand side must be normalized to 0 or 1 via a cast to _Bool.
test/regression/bitfields{1,9}.c: add corresponding test cases.
Diffstat (limited to 'test/regression/bitfields1.c')
-rw-r--r-- | test/regression/bitfields1.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/regression/bitfields1.c b/test/regression/bitfields1.c index c6022dd1..5f6dfdd1 100644 --- a/test/regression/bitfields1.c +++ b/test/regression/bitfields1.c @@ -7,7 +7,7 @@ struct s { struct t { unsigned int c: 16; - unsigned int d: 1; + _Bool d: 1; short e: 8; }; @@ -29,7 +29,7 @@ int main() y.c = 12345; y.d = 0; y.e = 89; - res = f(&x, &y, 1); + res = f(&x, &y, 2); printf("x = {a = %d, b = %d }\n", x.a, x.b); printf("y = {c = %d, d = %d, e = %d }\n", y.c, y.d, y.e); |