[Bug c/94626] -Wstringop-truncation warning should mention attribute((nonstring))

2020-04-19 Thread allison.karlitskaya at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94626 --- Comment #3 from Allison Karlitskaya --- (In reply to Martin Sebor from comment #2) > Thanks for the report (and for getting Glibc to update its headers). The > problem with strncpy is that its correct and intended uses (filling a buffer > w

[Bug c/94615] -Wstringop-truncation warns on strncpy() with struct lastlog (or utmp)

2020-04-16 Thread allison.karlitskaya at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94615 Allison Karlitskaya changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill

[Bug c/94626] New: -Wstringop-truncation warning should mention attribute((nonstring))

2020-04-16 Thread allison.karlitskaya at redhat dot com
Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: allison.karlitskaya at redhat dot com Target Milestone: --- See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94615 Consider this code: { struct lastlog entry; strncpy

[Bug c/94615] -Wstringop-truncation warns on strncpy() with struct lastlog (or utmp)

2020-04-16 Thread allison.karlitskaya at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94615 Allison Karlitskaya changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c/94615] -Wstringop-truncation warns on strncpy() with struct lastlog (or utmp)

2020-04-16 Thread allison.karlitskaya at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94615 --- Comment #3 from Allison Karlitskaya --- (In reply to Richard Biener from comment #1) > Maybe use memcpy then, str* routines generally expect nul-termination "str* routines generally expect nul-termination" doesn't really fly as an argument,

[Bug c/94615] New: -Wstringop-truncation warns on strncpy() with struct lastlog (or utmp)

2020-04-16 Thread allison.karlitskaya at redhat dot com
Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: allison.karlitskaya at redhat dot com Target Milestone: --- Consider this code: { struct lastlog entry; strncpy (entry.ll_host, rhost, sizeof entry.ll_host); /* fill other

[Bug c/91952] [rfe] __attribute__((__default_value__()))

2019-10-04 Thread allison.karlitskaya at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91952 --- Comment #5 from Allison Karlitskaya --- One could imagine (as a first step) that __default_value__() would be implemented by way of a simple code transformation whenever it is encountered. An additional block could be added and the variable

[Bug c/91952] [rfe] __attribute__((__default_value__()))

2019-10-04 Thread allison.karlitskaya at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91952 --- Comment #4 from Allison Karlitskaya --- (In reply to Jakub Jelinek from comment #3) > First of all, not all automatic vars live on stack, some live in registers. Sure. The register could also be initialised to the same value, of course. >

[Bug c/91952] [rfe] __attribute__((__default_value__()))

2019-10-04 Thread allison.karlitskaya at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91952 --- Comment #2 from Allison Karlitskaya --- Consider this example in way of clarification: void cleanup_func (void **ptr); void *init (void); void function (bool condition) { if (condition) goto out; __attribute__((__cleanup__(cleanu

[Bug c/91951] goto + mixed declarations + cleanup attribute considered harmful

2019-10-01 Thread allison.karlitskaya at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91951 --- Comment #1 from Allison Karlitskaya --- Two notes: First: Owen Taylor (the author of the blog post) pointed out that with -O2, GCC is able to notice the uninitialised use of the variable in my example and warn about it. Note that this is a

[Bug c/91952] New: [rfe] __attribute__((__default_value__()))

2019-10-01 Thread allison.karlitskaya at redhat dot com
Assignee: unassigned at gcc dot gnu.org Reporter: allison.karlitskaya at redhat dot com Target Milestone: --- In automatic context, instead of writing int x = 5; it would be nice to be able to write __attribute__((__default_value__(5))) int x; which would have slightly

[Bug c/91951] New: goto + mixed declarations + cleanup attribute considered harmful

2019-10-01 Thread allison.karlitskaya at redhat dot com
Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: allison.karlitskaya at redhat dot com Target Milestone: --- Declaring a variable using __attribute__((__cleanup__)) and an initialiser and then jumping over it with goto will produce

[Bug c/90941] New: [rfe] attribute to specify write-once static variable for early-initialized values

2019-06-19 Thread allison.karlitskaya at redhat dot com
Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: allison.karlitskaya at redhat dot com Target Milestone: --- The GObject type system contains support for private variables, which works like this: you create a