4 #define CONST_CAST(type) const_cast<type>
6 #define CONST_CAST(type)
9 /* PR analyzer/95007. */
13 char *s
= CONST_CAST(char *)("foo");
14 s
[0] = 'g'; /* { dg-warning "write to string literal" } */
21 // Technically irrelevant for C++ as fpermissive will warn about invalid conversion.
22 memcpy (CONST_CAST(char *)("abc"), "def", 3); /* { dg-warning "write to string literal" } */
27 static char * __attribute__((noinline
))
28 called_by_test_3 (void)
35 char *s
= called_by_test_3 ();
36 s
[1] = 'a'; /* { dg-warning "write to string literal" } */
39 static char * __attribute__((noinline
))
40 called_by_test_4 (int flag
)
50 char *s
= called_by_test_4 (0);
51 s
[1] = 'z'; /* { dg-warning "write to string literal" } */
54 static char * __attribute__((noinline
))
55 called_by_test_5 (int flag
)
63 void test_5 (int flag
)
65 char *s
= called_by_test_5 (flag
);
66 s
[1] = 'z'; /* We miss this one, unless we disable state merging. */