[Bug middle-end/95485] missing warning writing into function text
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95485 Martin Sebor changed: What|Removed |Added Assignee|msebor at gcc dot gnu.org |unassigned at gcc dot gnu.org Status|ASSIGNED|NEW Blocks||87403 --- Comment #5 from Martin Sebor --- I'm not working on this anymore. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87403 [Bug 87403] [Meta-bug] Issues that suggest a new warning
[Bug middle-end/95485] missing warning writing into function text
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95485 --- Comment #4 from Eric Gallager --- (In reply to Martin Sebor from comment #3) > Ah, yes, -Wpedantic does detect the invalid conversion. But few projects > use -Wpedantic (GCC itself doesn't) and enabling the warning in -Wall or > -Wextra would likely lead to lots of noise for code that converts between > object and function pointers (POSIX requires it to work). > > A warning implemented in a front end can also only detect questionable > conversions but not the actual writes, which is what the warning I'm working > on does (i.e., detect stores into read-only storage). so... you're suggesting a new flag, then?
[Bug middle-end/95485] missing warning writing into function text
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95485 --- Comment #3 from Martin Sebor --- Ah, yes, -Wpedantic does detect the invalid conversion. But few projects use -Wpedantic (GCC itself doesn't) and enabling the warning in -Wall or -Wextra would likely lead to lots of noise for code that converts between object and function pointers (POSIX requires it to work). A warning implemented in a front end can also only detect questionable conversions but not the actual writes, which is what the warning I'm working on does (i.e., detect stores into read-only storage).
[Bug middle-end/95485] missing warning writing into function text
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95485 Eric Gallager changed: What|Removed |Added CC||egallager at gcc dot gnu.org --- Comment #2 from Eric Gallager --- -Wpedantic catches it: $ /usr/local/bin/gcc -c -O2 -S -Wall -Wextra -pedantic -fdump-tree-optimized=/dev/stdout 95485.c 95485.c: In function 'f': 95485.c:6:20: warning: ISO C forbids passing argument 1 of '__builtin_memset' between function pointer and 'void *' [-Wpedantic] 6 | __builtin_memset (p, 0, 32); // zero out -- whoops! -- writing to a function |^ 95485.c:6:20: note: expected 'void *' but argument is of type 'void * (*)(int)' ;; Function f (f, funcdef_no=0, decl_uid=1910, cgraph_uid=1, symbol_order=0) f (void * (*) (int) p) { void * q; [local count: 1073741824]: q_4 = p_2(D) (32); __builtin_memset (p_2(D), 0, 32); return q_4; } $
[Bug middle-end/95485] missing warning writing into function text
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95485 Martin Sebor changed: What|Removed |Added Last reconfirmed||2020-06-02 Status|UNCONFIRMED |ASSIGNED Ever confirmed|0 |1 See Also||https://gcc.gnu.org/bugzill ||a/show_bug.cgi?id=90404 Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org --- Comment #1 from Martin Sebor --- See also pr90404. I'm working on a solution for that, and I expect it to handle this as well.
[Bug middle-end/95485] missing warning writing into function text
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95485 Martin Sebor changed: What|Removed |Added Keywords||diagnostic Severity|normal |enhancement