Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-pr86714.c
blob7fce903775166a4e0bea5bedb46e034fbed924d6
1 /*
2 pr86714.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #include <string.h>
9 #ifdef __SDCC
10 #pragma disable_warning 147
11 #endif
13 /* PR tree-optimization/86714 - tree-ssa-forwprop.c confused by too
14 long initializer
16 The excessively long initializer for a[0] is undefined but this
17 test verifies that the excess elements are not considered a part
18 of the value of the array as a matter of QoI. */
20 const char a[2][3] = { "1234", "xyz" };
21 char b[6];
23 void *pb = b;
25 void
26 testTortureExecute (void)
28 memcpy (b, a, 4);
29 memset (b + 4, 'a', 2);
31 if (b[0] != '1' || b[1] != '2' || b[2] != '3'
32 || b[3] != 'x' || b[4] != 'a' || b[5] != 'a')
33 ASSERT (0);
35 if (memcmp (pb, "123xaa", 6))
36 ASSERT (0);
38 return;