https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84725
Bug ID: 84725 Summary: enable attribute nonstring for all narrow character types Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- Attribute nonstring newly added in GCC is only accepted on arrays or pointers to plain char (see the test case below). However, as discussed in the thread Re: [PATCH] Support the nonstring variable attribute (gcc >= 8), Linux kernel developers would find the new attribute nonstring useful with all narrow character types, including signed char and unsigned char: https://www.spinics.net/lists/kernel/msg2737596.html This bug tracks that change. $ cat z.c && gcc -O2 -S -Wall z.c struct S { char __attribute__ ((nonstring)) a[4]; signed char __attribute__ ((nonstring)) b[4]; unsigned char __attribute__ ((nonstring)) c[4]; char __attribute__ ((nonstring)) *p; signed char __attribute__ ((nonstring)) *q; unsigned char __attribute__ ((nonstring)) *r; }; z.c:4:3: warning: ‘nonstring’ attribute ignored on objects of type ‘signed char[4]’ [-Wattributes] signed char __attribute__ ((nonstring)) b[4]; ^~~~~~ z.c:5:3: warning: ‘nonstring’ attribute ignored on objects of type ‘unsigned char[4]’ [-Wattributes] unsigned char __attribute__ ((nonstring)) c[4]; ^~~~~~~~ z.c:8:3: warning: ‘nonstring’ attribute ignored on objects of type ‘signed char *’ [-Wattributes] signed char __attribute__ ((nonstring)) *q; ^~~~~~ z.c:9:3: warning: ‘nonstring’ attribute ignored on objects of type ‘unsigned char *’ [-Wattributes] unsigned char __attribute__ ((nonstring)) *r; ^~~~~~~~