[Bug c/15360] c99: extern w/initializer; extern w/internal linkage

2021-07-05 Thread dungeonlords789 at yandex dot ru via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15360

--- Comment #10 from Andrei Cherniaev  ---
I suggest allow use directive extern without array size.

main.c:
#define size ( 1 ) 
char arr[size];

int main()
{
return 0;
}

second.c:
extern char arr[];

void f(){
sizeof(arr);
}

It was error: 
invalid application of 'sizeof' to incomplete type 'char[]'

I can modify second.c: extern char arr[size];
But I ned export my define to second.c... It is not flexiable.

More than that, I can use mistake: in one file one size and in second size will
another...
main.c:
char arr[1];

int main()
{
return 0;
}

second.c:
extern char arr[999];

void f(){
sizeof(arr);
}

I think gcc should prevent it error. But now I can't see even warning...

So I suggest allow to use directive extern without array size.

[Bug c/15360] c99: extern w/initializer; extern w/internal linkage

2021-07-05 Thread dungeonlords789 at yandex dot ru via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15360

Andrei Cherniaev  changed:

   What|Removed |Added

 CC||dungeonlords789 at yandex dot 
ru

--- Comment #9 from Andrei Cherniaev  ---
Created attachment 51107
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51107=edit
extern directive test

This project illustrate a problem when i try extern array.