[PATCH 1/4] Add mkoffload for Intel MIC

Bernd Schmidt bschmidt@redhat.com
Mon Sep 28 12:33:00 GMT 2015


On 09/28/2015 02:00 PM, Jakub Jelinek wrote:
> On Mon, Sep 28, 2015 at 01:27:32PM +0200, Bernd Schmidt wrote:
>>> I've removed obstack_ptr_grow for arrays with known sizes after this review:
>>> https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02210.html
>>
>> That's unfortunate, I think that made the code less future-proof. IMO we
>> should revert to the obstack method especially if Thomas -v patch goes in.
>
> Why?  If the number of arguments is bound by a small constant, using
> automatic fixed size array is certainly more efficient, and I really don't
> see it as less readable or maintainable.

The code becomes harder to modify, with more room for error, and you no 
longer have consistency in how you build argv arrays within the same 
file. The obstack method is pretty much foolproof and doesn't even 
remotely allow for the possibility of a buffer overflow, and adding new 
arguments, even conditionally, is entirely trivial. Efficiency is really 
not an issue for building arguments compared to the cost of executing 
another binary.


Bernd



More information about the Gcc-patches mailing list