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

--- Comment #4 from Martin Sebor <msebor at gmail dot com> ---
I understand. The current semantics of __builtin__xxx_chk are to:

a) check the constraints of the xxx function at compile time, and
b) diagnose constraint violations detected in (a) and call __xxx_chk, or
c) expand xxx inline if constraints are satisfied

I'm suggesting that it would be useful to change the semantics in (c):

c) if constraints are satisfied, then if -fbuiltin is used, expand xxx inline,
or
d) if -fno-builtin is used, call xxx

I.e., reduce the effects of the __builtin__xxx_chk intrinsics to just checking
the constraints, and (when -fno-builtin is used) make it possible to customize
the implementation within those constraints.

This would let freestanding implementations use the __builtin__xxx_chk
intrinsics and also provide their own semantics for the xxx functions within
the constraints specified by the language.

(PS I belatedly realized that my mention of a freestanding sprintf using '$' to
introduce a freestanding format directive didn't make sense as it would violate
the function's constraint. Please diregard that part.)

Reply via email to