New parameters to control stringop expansion libcall strategy
Xinliang David Li
davidxl@google.com
Thu Aug 8 00:29:00 GMT 2013
On Wed, Aug 7, 2013 at 5:23 PM, Joseph S. Myers <joseph@codesourcery.com> wrote:
> On Wed, 7 Aug 2013, Xinliang David Li wrote:
>
>> Index: config/i386/stringop.def
>> ===================================================================
>> --- config/i386/stringop.def (revision 0)
>> +++ config/i386/stringop.def (revision 0)
>> @@ -0,0 +1,42 @@
>> +/* Definitions for option handling for IA-32.
>> + Copyright (C) 2013 Free Software Foundation, Inc.
>> +
>> +This file is part of GCC.
>> +
>> +GCC is free software; you can redistribute it and/or modify
>> +it under the terms of the GNU General Public License as published by
>> +the Free Software Foundation; either version 3, or (at your option)
>> +any later version.
>> +
>> +GCC is distributed in the hope that it will be useful,
>> +but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> +GNU General Public License for more details.
>> +
>> +Under Section 7 of GPL version 3, you are granted additional
>> +permissions described in the GCC Runtime Library Exception, version
>> +3.1, as published by the Free Software Foundation.
>
> Why the exception? This should only be used on the host, not the target.
Sorry, I copied the boiler-plate header from i386.h -- is it wrong there too?
>
>> + do
>> + {
>> + int mins, maxs;
>> + stringop_alg alg;
>> + char alg_name[128];
>> + char align[16];
>> +
>> + next_range_str = strchr (curr_range_str, ',');
>> + if (next_range_str)
>> + *next_range_str++ = '\0';
>> +
>> + if (3 != sscanf (curr_range_str, "%[^:]:%d:%s", alg_name, &maxs, align))
>
> This appears to introduce buffer overruns, which is never OK - whatever
> the length of strings in the command-line arguments, you must not overflow
> fixed-width buffers, so you must specify maximum field widths for the %[]
> and %s.
>
Ok will fix.
>> + {
>> + warning (0, "Wrong arg %s to option %s", curr_range_str,
>> + is_memset ? "-mmemset_strategy=" : "-mmemcpy_strategy=");
>> + return;
>
> Invalid option arguments should be errors, not warnings, and diagnostics
> should not start with a capital letter. Same applies to other diagnostics
> here.
>
Ok will fix.
>> Index: config/i386/stringop.opt
>> ===================================================================
>> --- config/i386/stringop.opt (revision 0)
>> +++ config/i386/stringop.opt (revision 0)
>> @@ -0,0 +1,36 @@
>> +/* Definitions for option handling for IA-32.
>> + Copyright (C) 2013 Free Software Foundation, Inc.
>> +
>> +This file is part of GCC.
>> +
>> +GCC is free software; you can redistribute it and/or modify
>> +it under the terms of the GNU General Public License as published by
>> +the Free Software Foundation; either version 3, or (at your option)
>> +any later version.
>> +
>> +GCC is distributed in the hope that it will be useful,
>> +but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> +GNU General Public License for more details.
>> +
>> +Under Section 7 of GPL version 3, you are granted additional
>> +permissions described in the GCC Runtime Library Exception, version
>> +3.1, as published by the Free Software Foundation.
>
> Again, why the exception?
Wrong template used.
thanks,
David
>
> --
> Joseph S. Myers
> joseph@codesourcery.com
More information about the Gcc-patches
mailing list