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

            Bug ID: 88883
           Summary: [AArch64] gcc/config/aarch64/aarch64.opt:
                    aarch64_branch_protection_string type
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: p...@gcc-bugzilla.mail.kapsi.fi
  Target Milestone: ---
              Host: x86_64-w64-mingw32
            Target: aarch64-none-elf
             Build: x86_64-linux-gnu

Hi.

It appears that when trying to build an x86_64-w64-mingw32 cross compiler
targetting AArch64 the build fails at generated `gcc/options-save.c' due to
narrowing conversion (using the latest trunk). This has likely something to do
with the latest branch protection patches.

The generated code looks like this (generated by `gcc/optc-save-gen.awk'):
  if (ptr->x_aarch64_branch_protection_string)
    fprintf (file, "%*s%s (%#lx)\n",
             indent, "",
             "aarch64_branch_protection_string",
             (unsigned long)ptr->x_aarch64_branch_protection_string);

And this will cause something like:
options-save.c:nnnn:mm: error: cast from 'const char*' to 'long unsigned int'
loses precision [-fpermissive]
              (unsigned long)ptr->x_aarch64_branch_protection_string);


I'm not sure who is the real culprit here. Should the generated options saving
code handle narrowing conversions better, or, as the above cast is only done
for any option that does not fall under char, short, int, enum or /string/
types is this caused by a mishap when selecting the proper type for
aarch64_branch_protection_string (at aarch64.opt)?

Reply via email to