This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

Carlos O'Donell <carlos at redhat dot com> changed:

           What    |Removed                     |Added
             Status|NEW                         |WAITING
                 CC|                            |carlos at redhat dot com

--- Comment #1 from Carlos O'Donell <carlos at redhat dot com> ---
The use of -fno-builtin-strcmp _does_ work, but just not in all the cases you
wanted. This is true of many such compiler options, particularly where the
implementation has made a choice for you. If strcmp internally just called
__builtin_strcmp you'd have no control over that, and it would be functionally
equivalent. It's only because of performance reasons that you see that choice
exposed in the strcmp macro, and may have some control over the ultimate
implementation used by your program. However, I think such choice is not

In general the C library and the compiler come together to form a singular
implementation of the C runtime, and while options like -fno-builtin-strcmp let
you control some aspects of that runtime, other choices are made for you by the
library developers to improve performance in the average case.

For example on x86 strncmp is implemented in terms of strcmp (not strncmp) and
therefore you have to know something about the details of the implementation to
use say -fno-builtin-strcmp even though you were calling strncmp.

In summary I don't think it is correct to have an expectation that strcmp
evaluates to anything but a function call to a library routine, or that
-fno-builtin-strcmp will have any effect there.

Exactly what use case do you have for needing the kind of control you're asking

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]