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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Changing the test case to modify the alias instead of the TLS causes the
program to crash because the memory the alias is mapped to is read-only.  That
suggests that rejecting the alias attribute with an error might be a better
solution than issuing just a warning.  Alternatively, GCC could issue just a
warning when the alias is declared const and an error when it's not const.

$ cat t.c && gcc -Wall -Wextra t.c && ./a.out
__thread int a = 123;

extern __attribute ((alias ("a"))) int b;

int main (void)
{
  b = 456;

  __builtin_printf ("a = %i (@%p)\nb = %i (@%p)\n", a, &a, b, &b);
}
Segmentation fault (core dumped)

Reply via email to