aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@college-de-france.fr>2021-09-15 10:47:14 +0200
committerXavier Leroy <xavier.leroy@college-de-france.fr>2021-09-15 10:47:14 +0200
commit8eaff6bf3933f2213ae85584009e05123c40fa65 (patch)
treee15bee84894cb5c4591265b5ed07e9de3e162e54 /test
parent4ba1b9e4165cda40e06fca3b563b7561a6cffc70 (diff)
downloadcompcert-kvx-8eaff6bf3933f2213ae85584009e05123c40fa65.tar.gz
compcert-kvx-8eaff6bf3933f2213ae85584009e05123c40fa65.zip
clightgen: handle empty names given to padding bit fields
In the Clight AST, padding bit fields (such as `int : 6;`) in composite declarations are given an ident that corresponds to the empty string. Previously, clightgen would give name `_` to this ident, but this is not valid Coq. This commit gives name `empty_ident` to the empty ident. This name does not start with an underscore, so it cannot conflict with the names for regular idents, which all start with `_`.
Diffstat (limited to 'test')
-rw-r--r--test/clightgen/bitfields.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/clightgen/bitfields.c b/test/clightgen/bitfields.c
new file mode 100644
index 00000000..34f6a686
--- /dev/null
+++ b/test/clightgen/bitfields.c
@@ -0,0 +1,13 @@
+struct s {
+ int a: 10;
+ char : 6;
+ _Bool b : 1;
+ int : 0;
+ short c: 7;
+};
+
+int f(void)
+{
+ struct s x = { -1, 1, 2 };
+ return x.a + x.b + x.c;
+}