diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/regression/Results/initializers | 2 | ||||
-rw-r--r-- | test/regression/initializers.c | 10 |
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; } |