[Bug c/89340] ICE in function_and_variable_visibility, at ipa-visibility.c:707

2019-02-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89340

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
It should be actually rejected like:
__attribute__((weak)) static void foo () {}
void bar (void) { foo (); }
pr89340.c:1:35: error: weak declaration of ‘foo’ must be public
1 | __attribute__((weak)) static void foo () {}
  |   ^~~

[Bug c/89340] ICE in function_and_variable_visibility, at ipa-visibility.c:707

2019-02-14 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89340

Martin Liška  changed:

   What|Removed |Added

   Keywords||ice-on-invalid-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-02-14
 CC||jsm28 at gcc dot gnu.org,
   ||marxin at gcc dot gnu.org,
   ||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Martin Liška  ---
Confirmed, FE should reject that similarly to:

$ of ‘bar’ was here
 void bar () { }
  ^~~
marxin@marxinbox:~/Programming/testcases> cat pr89340.c
__attribute__((weak))
void bar () { }
bar();

$ gcc pr89340.c
pr89340.c:3:1: warning: data definition has no type or storage class
 bar();
 ^~~
pr89340.c:3:1: warning: type defaults to ‘int’ in declaration of ‘bar’
[-Wimplicit-int]
pr89340.c:3:1: error: conflicting types for ‘bar’
pr89340.c:2:6: note: previous definition of ‘bar’ was here
 void bar () { }
  ^~~