Summary: | -m32 forbids empty scalar initializer | ||
---|---|---|---|
Product: | gcc | Reporter: | Stas Sergeev <stsp> |
Component: | c | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 11.4.0 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | ||
Attachments: | test case |
va_list can't be used that way. in x86 (32bit) va_list is a pointer while in x86_64, it is an array. va_list can only be assigned to via another va_list, initialized using va_start or va_copy. (In reply to Andrew Pinski from comment #1) > va_list can't be used that way. > in x86 (32bit) va_list is a pointer while in x86_64, it is an array. https://stackoverflow.com/questions/77647307/expression-int-a-why-a-is-null So isn't the {} an universal initializer that can be used on pointers too? The above article says it is... (In reply to Stas Sergeev from comment #3) > (In reply to Andrew Pinski from comment #1) > > va_list can't be used that way. > > in x86 (32bit) va_list is a pointer while in x86_64, it is an array. > > https://stackoverflow.com/questions/77647307/expression-int-a-why-a-is-null > So isn't the {} an universal initializer that can > be used on pointers too? The above article says it is... Yes it was not supported in GCC 11 as such as GCC 11 didn't have this support from C23, it was add in GCC 13. Thank you. Then its not INVALID, but rather is FIXED. It is invalid since it is not being backported ... |
Created attachment 58941 [details] test case $ gunzip a.c.gz $ gcc -c a.c [ no output ] $ gcc -m32 -c a.c doprnt.c: In function ‘_doprnt’: doprnt.c:144:27: error: empty scalar initializer 144 | va_list to_be_printed = {}; /* argument to be printed if numeric specifier are used */ | ^ doprnt.c:144:27: note: (near initialization for ‘to_be_printed’) I tried the trivial test-cases, but they pass. But in this particular file any empty scalar initializers are forbidden with -m32.