summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr19967.c
blob: 68c7e1cb99c9929a16b757d9337ddd94844141c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* PR middle-end/19967
   These functions mentioned below are supposed to return char *.
   However, fold_builtin_... had bugs that caused the return types to
   be const char *.  */

/* { dg-do compile } */
/* { dg-options "-pedantic -std=c99" } */

char *strchr(const char *, int);
char *strrchr(const char *, int);
char *index(const char *, int);
char *rindex(const char *, int);
char *strpbrk(const char *, const char *);
char *strstr(const char *, const char *);
char *p;

void
f (void)
{
  p = strchr(__func__, 'f');
  p = strrchr(__func__, 'f');
  p = index(__func__, 'f');
  p = rindex(__func__, 'f');
  p = strpbrk(__func__, "f");
  p = strstr(__func__, "f");
}