[Bug middle-end/80346] pessimistic stringop-overflow

2017-04-17 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346 --- Comment #16 from Martin Sebor --- Interestingly, GCC manages to eliminate the memset at -O1 (and thus avoid warning) but not at -O2: $ gcc -O1 -S -Wall -Wextra -Wpedantic -fdump-tree-optimized=/dev/stdout ../b.c ;; Function f (f, funcdef_no

[Bug middle-end/80346] pessimistic stringop-overflow

2017-04-14 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346 --- Comment #15 from Jeffrey A. Law --- I was looking pretty hard for something the compiler could use to avoid the problematical paths. That's always my first approach since doing so removes the warning and generates better code. I just couldn

[Bug middle-end/80346] pessimistic stringop-overflow

2017-04-14 Thread bonzini at gnu dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346 --- Comment #14 from Paolo Bonzini --- And also treat it as undefined behavior and go straight to the else... kidding, but not entirely!). The main issue is that here we _are_ testing the overflow behavior of the function, so we cannot pass sz

[Bug middle-end/80346] pessimistic stringop-overflow

2017-04-14 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346 --- Comment #13 from Jeffrey A. Law --- Given an unknown object size and a byte count of -1 we ought to be warning IMHO.

[Bug middle-end/80346] pessimistic stringop-overflow

2017-04-14 Thread bonzini at gnu dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346 --- Comment #12 from Paolo Bonzini --- > So AFAICT, the warning for the first testcase is valid as well. True, but isn't the maximum object size (2^63-1 aka PTRDIFF_MAX) as bogus as 2^64-1? We are using -1 which is a bit ugly but SIZE_MAX would

[Bug middle-end/80346] pessimistic stringop-overflow

2017-04-14 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346 Jeffrey A. Law changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

[Bug middle-end/80346] pessimistic stringop-overflow

2017-04-07 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346 --- Comment #10 from Martin Sebor --- 108 /* compute the table entries in rsdt */ 109 tables_nr = (rsdt_table->length - sizeof(AcpiRsdtDescriptorRev1)) / 110 sizeof(uint32_t); 111 g_assert_cmpint(tables_nr, >, 0);

[Bug middle-end/80346] pessimistic stringop-overflow

2017-04-07 Thread dgilbert at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346 --- Comment #9 from Dr. David Alan Gilbert --- (In reply to Paolo Bonzini from comment #8) > g_assertion_message_cmpnum is not declared anymore as noreturn since glib > 2.38. > https://bugzilla.gnome.org/show_bug.cgi?id=692125 :-O !!!? Oh in th

[Bug middle-end/80346] pessimistic stringop-overflow

2017-04-07 Thread bonzini at gnu dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346 --- Comment #8 from Paolo Bonzini --- g_assertion_message_cmpnum is not declared anymore as noreturn since glib 2.38. https://bugzilla.gnome.org/show_bug.cgi?id=692125 :-O

[Bug middle-end/80346] pessimistic stringop-overflow

2017-04-07 Thread dgilbert at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346 --- Comment #7 from Dr. David Alan Gilbert --- (In reply to Martin Sebor from comment #6) > The reduced test case from comment #4 doesn't trigger a warning because in > it the value of n is unknown. The original test case does trigger it > becau

[Bug middle-end/80346] pessimistic stringop-overflow

2017-04-07 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346 --- Comment #6 from Martin Sebor --- The reduced test case from comment #4 doesn't trigger a warning because in it the value of n is unknown. The original test case does trigger it because in it n's range is known. This is evident from the VRP

[Bug middle-end/80346] pessimistic stringop-overflow

2017-04-07 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346 --- Comment #5 from Jeffrey A. Law --- My very quick analysis from the IRC chat yesterday was that the first testcase has a path that should have been detected as unexecutable. I'd work from the full testcase rather than the reduced one.

[Bug middle-end/80346] pessimistic stringop-overflow

2017-04-07 Thread bonzini at gnu dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346 Paolo Bonzini changed: What|Removed |Added CC||bonzini at gnu dot org --- Comment #4 fr

[Bug middle-end/80346] pessimistic stringop-overflow

2017-04-06 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346 --- Comment #3 from Martin Sebor --- The warning for attachment 41147 looks valid. It points to the g_malloc0_n(__n, __s) call in the else statement in the following block. If I'm reading it right, there, __s is non-zero, and __n is equal to SI

[Bug middle-end/80346] pessimistic stringop-overflow

2017-04-06 Thread dgilbert at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346 --- Comment #2 from Dr. David Alan Gilbert --- Created attachment 41147 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41147&action=edit a different signed/size case Here's another case (law said to attach it to the same bug), this is givi

[Bug middle-end/80346] pessimistic stringop-overflow

2017-04-06 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346 Martin Sebor changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed|