summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2014-05-18 07:22:02 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2014-05-18 07:22:02 +0000
commit9cb3b2cd5ce322cecf9ef7c9b10296c6057b0ddb (patch)
tree091b320eaa924b880cd56da222a21b812d038f58 /test
parent132541ce2fa2a910a4241da6955805c5734781f5 (diff)
Another corner case for string literal initializers: char * x[] = { "lit" }
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2498 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test')
-rw-r--r--test/regression/Results/initializers2
-rw-r--r--test/regression/initializers.c10
2 files changed, 12 insertions, 0 deletions
diff --git a/test/regression/Results/initializers b/test/regression/Results/initializers
index 5956fd9..18339f7 100644
--- a/test/regression/Results/initializers
+++ b/test/regression/Results/initializers
@@ -23,3 +23,5 @@ x21 = { 'H', 'e', 'l', 'l', 'o', '!', 0, 0, 0, 0, }
x22 ok
x23 = { hd = 8, tl = ok }
x24[6] = { '/', '*', 'B', '*', '/', 0, }
+x25[4] = { "/tmp" }
+x26[6] = { 'w', 'o', 'r', 'l', 'd', 0, }
diff --git a/test/regression/initializers.c b/test/regression/initializers.c
index 3524793..31f7373 100644
--- a/test/regression/initializers.c
+++ b/test/regression/initializers.c
@@ -61,6 +61,12 @@ struct list { int hd; struct list * tl; } x23 = { sizeof(x23), &x23 };
typedef unsigned char byte;
byte x24[] = "/*B*/";
+/* Another tricky case with string literals */
+char * x25[] = { "/tmp" };
+
+/* One more */
+char x26[] = { "world" };
+
static void print_chars(char * s, int sz)
{
int i;
@@ -127,6 +133,10 @@ int main()
printf("x24[%d] = { ", (int) sizeof(x24));
print_chars((char *) x24, sizeof(x24));
printf("}\n");
+ printf("x25[%d] = { \"%s\" }\n", (int) sizeof(x25), x25[0]);
+ printf("x26[%d] = { ", (int) sizeof(x26));
+ print_chars(x26, sizeof(x26));
+ printf("}\n");
return 0;
}