Skip several analyzer socket tests on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / write-to-const-1.c
blobc74442af267b1751481cddb75430659817bfeb9f
1 /* PR middle-end/90404 */
3 const int c1 = 20; /* { dg-message "declared here" } */
4 int test_1 (void)
6 *((int*) &c1) = 10; /* { dg-warning "write to 'const' object 'c1'" } */
7 return c1;
10 /* Example of writing to a subregion (an element within a const array). */
12 const int c2[10] = {}; /* { dg-message "declared here" } */
13 int test_2 (void)
15 ((int*) &c2)[5] = 10; /* { dg-warning "write to 'const' object 'c2'" } */
16 return c2[5];
19 const char s3[] = "012.45"; /* { dg-message "declared here" } */
20 int test_3 (void)
22 char *p = __builtin_strchr (s3, '.');
23 *p = 0; /* { dg-warning "write to 'const' object 's3'" } */
25 if (__builtin_strlen (p) != 3)
26 __builtin_abort ();
28 return s3[3] == 0;