Who broke options.h?

David Edelsohn dje.gcc@gmail.com
Tue Apr 25 15:09:00 GMT 2017


On Tue, Apr 25, 2017 at 11:03 AM, David Malcolm <dmalcolm@redhat.com> wrote:
> On Tue, 2017-04-25 at 06:59 -0700, Steve Kargl wrote:
>> Someone (other than Richard who seems to have fixed his
>> bootstrap issue) in the last 3 days has broken bootstrap
>> on FreeBSD.  The generated file gcc/options.h contains
>> code of the form
>>
>>   OPT_C = 116,                               /* -C */
>>   OPT_CC = 117,                              /* -CC */
>>   OPT_c = 118,                               /* -c */
>>   OPT_C = 119,                               /* -C */
>>   OPT_coverage = 120,                        /* -coverage */
>>   OPT_cpp_ = 121,                            /* -cpp= */
>>   OPT_cpp = 122,                             /* -cpp */
>>   OPT_d = 123,                               /* -d */
>>   OPT_D = 124,                               /* -D */
>>   OPT_d = 125,                               /* -d */
>>   OPT_defsym_ = 126,                         /* -defsym= */
>>   OPT_defsym = 127,                          /* -defsym */
>>   OPT_d = 128,                               /* -d */
>>   OPT_D = 129,                               /* -D */
>>
>> The sudden dumping ground of everyone's pet project into
>> trunk after the new branch has been created is making it
>> impossible to bisect this issue.
>
> Presumably the issue is the duplicate names within an enum.  Above,
> OPT_C has values 116, 119
> OPT_d has values 123, 125, 128
> OPT_D has values 124, 129
> etc.
>
> Looking at the code that writes out that enum in opth-gen.awk, I see:
>
>    443  enum_value = 0
>    444  for (i = 0; i < n_opts; i++) {
>    445          # Combine the flags of identical switches.  Switches
>    446          # appear many times if they are handled by many front
>    447          # ends, for example.
>    448          while( i + 1 != n_opts && opts[i] == opts[i + 1] ) {
>    449                  flags[i + 1] = flags[i] " " flags[i + 1];
>    450                  i++;
>    451          }
>
> Lines 445-451 suggest that the options are meant to be in some kind of
> sorted order, so that duplicates will be adjacent.
>
> In the output you posted the duplicates are *not* adjacent.  So is
> there some implicit assumption in the awk code about the sorting of
> options, that somehow isn't satisfied on the machine you're seeing this
> on?
>
> From what I can tell, the n_opts and opts in that file come direct from
>  opt-read.awk, which gets them from opt-gather.awk, which appears to
> sort them (but my awk skills are weak).
>
> Alternatively, maybe the collisions are caused by some names needing
> opt_sanitized_name?  (you could try making that return its argumen
> unmodified to see if it shows anything, I guess)  But I don't see any
> new option in trunk in the last 3 days.

Maybe BSD awk versus GNU awk?

Did the bootstrap system change or GNU awk is not in the path?

- David



More information about the Gcc mailing list