public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug tree-optimization/100845] New: [11/12 Regression] False positive for -Werror=maybe-uninitialized since r11-959-gb825a22890740f34 @ 2021-06-01 7:02 marxin at gcc dot gnu.org 2021-06-01 7:43 ` [Bug tree-optimization/100845] " rguenth at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: marxin at gcc dot gnu.org @ 2021-06-01 7:02 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100845 Bug ID: 100845 Summary: [11/12 Regression] False positive for -Werror=maybe-uninitialized since r11-959-gb825a22890740f34 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: msebor at gcc dot gnu.org Target Milestone: --- Since the revision, the following simple test-case is affected: $ cat snippet.c #include <stdlib.h> int xor_hash(const char* mem, const size_t n) { int hash = 0; for(size_t i=0;i<n;i++) hash ^= mem[i]; return hash>=0?hash:-hash; } int uninitialized(size_t size) { void *mem = malloc(size); if(mem == NULL) return -1; int ret = xor_hash(mem, size); free(mem); return ret; } $ gcc -Werror=all snippet.c -c snippet.c: In function ‘uninitialized’: snippet.c:15:19: error: ‘mem’ may be used uninitialized [-Werror=maybe-uninitialized] 15 | int ret = xor_hash(mem, size); | ^~~~~~~~~~~~~~~~~~~ snippet.c:3:5: note: by argument 1 of type ‘const char *’ to ‘xor_hash’ declared here 3 | int xor_hash(const char* mem, const size_t n) { | ^~~~~~~~ cc1: some warnings being treated as errors While using -O2 is fine. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/100845] [11/12 Regression] False positive for -Werror=maybe-uninitialized since r11-959-gb825a22890740f34 2021-06-01 7:02 [Bug tree-optimization/100845] New: [11/12 Regression] False positive for -Werror=maybe-uninitialized since r11-959-gb825a22890740f34 marxin at gcc dot gnu.org @ 2021-06-01 7:43 ` rguenth at gcc dot gnu.org 2021-06-01 9:15 ` pinskia at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: rguenth at gcc dot gnu.org @ 2021-06-01 7:43 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100845 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Target Milestone|--- |11.2 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/100845] [11/12 Regression] False positive for -Werror=maybe-uninitialized since r11-959-gb825a22890740f34 2021-06-01 7:02 [Bug tree-optimization/100845] New: [11/12 Regression] False positive for -Werror=maybe-uninitialized since r11-959-gb825a22890740f34 marxin at gcc dot gnu.org 2021-06-01 7:43 ` [Bug tree-optimization/100845] " rguenth at gcc dot gnu.org @ 2021-06-01 9:15 ` pinskia at gcc dot gnu.org 2021-06-01 9:19 ` pinskia at gcc dot gnu.org 2021-06-01 9:21 ` marxin at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2021-06-01 9:15 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100845 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- >While using -O2 is fine. -O2 is only fine because xor_hash is considering just reading memory and then malloc/free pairs are removed too. The warning is correct in my mind really as you are reading uninitialized memory. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/100845] [11/12 Regression] False positive for -Werror=maybe-uninitialized since r11-959-gb825a22890740f34 2021-06-01 7:02 [Bug tree-optimization/100845] New: [11/12 Regression] False positive for -Werror=maybe-uninitialized since r11-959-gb825a22890740f34 marxin at gcc dot gnu.org 2021-06-01 7:43 ` [Bug tree-optimization/100845] " rguenth at gcc dot gnu.org 2021-06-01 9:15 ` pinskia at gcc dot gnu.org @ 2021-06-01 9:19 ` pinskia at gcc dot gnu.org 2021-06-01 9:21 ` marxin at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2021-06-01 9:19 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100845 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This is more likely a dup of bug 100417 for the original testcase rather than this reduced one. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/100845] [11/12 Regression] False positive for -Werror=maybe-uninitialized since r11-959-gb825a22890740f34 2021-06-01 7:02 [Bug tree-optimization/100845] New: [11/12 Regression] False positive for -Werror=maybe-uninitialized since r11-959-gb825a22890740f34 marxin at gcc dot gnu.org ` (2 preceding siblings ...) 2021-06-01 9:19 ` pinskia at gcc dot gnu.org @ 2021-06-01 9:21 ` marxin at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: marxin at gcc dot gnu.org @ 2021-06-01 9:21 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100845 Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> --- Oh, you are right, the warning is correct! ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-06-01 9:21 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-06-01 7:02 [Bug tree-optimization/100845] New: [11/12 Regression] False positive for -Werror=maybe-uninitialized since r11-959-gb825a22890740f34 marxin at gcc dot gnu.org 2021-06-01 7:43 ` [Bug tree-optimization/100845] " rguenth at gcc dot gnu.org 2021-06-01 9:15 ` pinskia at gcc dot gnu.org 2021-06-01 9:19 ` pinskia at gcc dot gnu.org 2021-06-01 9:21 ` marxin at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).