This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] convert braced initializers to strings (PR 71625)


Sorry, again, but could it be possible that this test case changed
with your patch?

$ cat w.c
const char  x[] = {  };
int main()
{
   __builtin_printf("%ld\n", sizeof(x));
   return 0;
}
$ gcc w.c
$ ./a.out
1

without your patch
$ ./a.out
0


Jason/Joseph, is this meant to be accepted?  It's rejected with
a hard error with -Wpedantic but I don't see any tests for it:

warning: ISO C forbids empty initializer braces [-Wpedantic]
   const char x[] = { };
                    ^
error: zero or negative size array ‘b’
   const char x[] = { };
              ^

I'll avoid handling it but I'm not sure I should add a test case
for it if it's accepted by mistake (and if I should open a bug
to reject it instead).

The comment above complete_array_type() in c-common.c and
the code kind of suggest it's on purpose but the odd failure
mode (hard error with -Wpedantic, silence otherwise) and
the absence of tests make me wonder.

Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]