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

            Bug ID: 87483
           Summary: attribute alias accepted on a symbol definition
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

GCC silently accepts attribute alias on the definition of a symbol in
contradiction to the attribute's purpose.

int f (void) { return 0; }

__attribute__ ((alias ("f"))) int g () { return 1; }

int h (void)
{
  return g ();
}

Other compilers that support the attribute (e.g., Clang and ICC) reject the
definition with the attribute with an error:

t.c:3:35: error: redefinition of 'g'

__attribute__ ((alias ("f"))) int g () { return 1; }

Reply via email to