https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64377

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |build
             Target|                            |nios2
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-22
     Ever confirmed|0                           |1

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Joel Sherrill from comment #1)
> Looking at the generated options-save.c, the first line of this method is
> clearly incorrect in the cast on the RHS. It looks like a full declaration
> and not a type. If anyone familiar with the magic in these files looked at
> it, I am sure it is easy to fix.

Those types come from processing TargetSave in .opt files, which are
transformed into variable names and types in optc-save-gen.awk:

for (i = 0; i < n_target_save; i++) {
        var = target_save_decl[i];
        sub (" *=.*", "", var);
        name = var;
        type = var;
        sub("^.*[ *]", "", name)
        sub(" *" name "$", "", type)
        if (target_save_decl[i] ~ "^const char \\*+[_" alnum "]+$")
                var_target_str[n_target_str++] = name;
        else {
                var_target_val_type[n_target_val] = type;
                var_target_val[n_target_val++] = name;
        }
}

However, the above code does not seem to support array
declarations. Not only the resulting cast does not make any
sense, but something like ptr->saved_custom_code_status[256] does
not seem correct either.

My guess is that the TargetSave declarations in nios2.opt are not
valid (it is the only file that uses arrays for TargetSave), but I'm not sure
what is the correct way to do what those declarations are trying to do. A patch
to optc-save-gen.awk to give a sensible error would also be welcome.

Reply via email to