view gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcmp.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

extern void abort (void);
extern int inside_main;

__attribute__ ((__noinline__))
int
strcmp (const char *s1, const char *s2)
{
#ifdef __OPTIMIZE__
  if (inside_main)
    abort ();
#endif

  while (*s1 != 0 && *s1 == *s2)
    s1++, s2++;

  if (*s1 == 0 || *s2 == 0)
    return (unsigned char) *s1 - (unsigned char) *s2;
  return *s1 - *s2;
}