diff options
Diffstat (limited to 'SingleSource/Regression/C/gcc-c-torture/execute/builtins/lib/strchr.c')
-rw-r--r-- | SingleSource/Regression/C/gcc-c-torture/execute/builtins/lib/strchr.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/SingleSource/Regression/C/gcc-c-torture/execute/builtins/lib/strchr.c b/SingleSource/Regression/C/gcc-c-torture/execute/builtins/lib/strchr.c new file mode 100644 index 00000000..bee3d320 --- /dev/null +++ b/SingleSource/Regression/C/gcc-c-torture/execute/builtins/lib/strchr.c @@ -0,0 +1,28 @@ +extern void abort (void); +extern int inside_main; + +__attribute__ ((__noinline__)) +char * +strchr (const char *s, int c) +{ +#ifdef __OPTIMIZE__ + if (inside_main) + abort (); +#endif + + for (;;) + { + if (*s == c) + return (char *) s; + if (*s == 0) + return 0; + s++; + } +} + +__attribute__ ((__noinline__)) +char * +index (const char *s, int c) +{ + return strchr (s, c); +} |