[Bug string/20736] New: string2.h strcmp macro gratuitously adds __builtin_

acsawdey at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Tue Oct 25 19:14:00 GMT 2016


https://sourceware.org/bugzilla/show_bug.cgi?id=20736

            Bug ID: 20736
           Summary: string2.h strcmp macro gratuitously adds __builtin_
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: string
          Assignee: unassigned at sourceware dot org
          Reporter: acsawdey at gcc dot gnu.org
                CC: sjmunroe at us dot ibm.com
  Target Milestone: ---

In string/bits/string2.h the macro defined for strcmp(s1, s2) expands to calls
to __builtin_strcmp. The analogous macro for strncmp expands to calls to
strncmp.

This becomes an issue if the user specifies -fno-builtin-strcmp to gcc which
now does not work because the macro has transformed strcmp to __builtin_strcmp.
The behavior with gcc is as expected with strncmp and also (for example)
memcmp.

Actually since strncmp calls strcmp instead if one arg is a const string
shorter than n, in that case the user's attempt to disable builtin expansion
will also not work.

If strcmp expanded in terms of strcmp not __builtin_strcmp, this could be
avoided.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list