diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2014-05-08 07:52:46 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2014-05-08 07:52:46 +0000 |
commit | 329b44b4864eeefb5f935282c3fe6c025bc1c8bc (patch) | |
tree | 7d155623b113cd85c309cb9dde6f4d72feed650c /test/regression/initializers.c | |
parent | b4200796aab1ec26288a1376c7dd99c0927b5ee9 (diff) | |
download | compcert-329b44b4864eeefb5f935282c3fe6c025bc1c8bc.tar.gz compcert-329b44b4864eeefb5f935282c3fe6c025bc1c8bc.zip |
Fixed regression on initializers of the form T x[N] = "literal";
where T is a typedef for a character type.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2488 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test/regression/initializers.c')
-rw-r--r-- | test/regression/initializers.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/regression/initializers.c b/test/regression/initializers.c index 938795a4..35247933 100644 --- a/test/regression/initializers.c +++ b/test/regression/initializers.c @@ -57,6 +57,10 @@ char * x22 = &(x10.u.y); /* Initializer can refer to ident just declared */ struct list { int hd; struct list * tl; } x23 = { sizeof(x23), &x23 }; +/* Watch out for aliases of char types */ +typedef unsigned char byte; +byte x24[] = "/*B*/"; + static void print_chars(char * s, int sz) { int i; @@ -120,6 +124,9 @@ int main() printf("x22 error\n"); printf("x23 = { hd = %d, tl = %s }\n", x23.hd, x23.tl == &x23 ? "ok" : "ERROR"); + printf("x24[%d] = { ", (int) sizeof(x24)); + print_chars((char *) x24, sizeof(x24)); + printf("}\n"); return 0; } |