http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56711



             Bug #: 56711

           Summary: spectaculary bad code generated for __uint128_t

    Classification: Unclassified

           Product: gcc

           Version: 4.7.2

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: rtl-optimization

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: felix-...@fefe.de





Consider this function:



size_t scan_ulong(const char* src,unsigned long int* dest) {

  register const char *tmp=src;

  register unsigned long int l=0;

  register unsigned char c;

  while ((c=*tmp-'0')<10) {

    __uint128_t x=(__uint128_t)l*10+c;

    if ((unsigned long)x != x) break;

    l=(unsigned long)x;

    ++tmp;

  }

  if (tmp-src) *dest=l;

  return tmp-src;

}



I'm compiling this with gcc -Os -c test.c on an amd64-linux box.

The code gcc generates is 92 bytes long, the one from clang only 65.  What is

happening here?  What are all that code doing that gcc is generating there?

Reply via email to