[Bug c/61236] GCC 4.9 generates incorrect object code

2014-05-20 Thread muks at banu dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236 --- Comment #9 from Mukund Sivaraman muks at banu dot com --- Hi Jakub, Markus We discussed this during our daily standup call today, and there are two points we'd like to make: 1. The qsort() defintion in C99 doesn't explicitly state that base

[Bug c/61236] GCC 4.9 generates incorrect object code

2014-05-20 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added Status|WAITING |RESOLVED

[Bug c/61236] GCC 4.9 generates incorrect object code

2014-05-20 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236 --- Comment #11 from Andrew Pinski pinskia at gcc dot gnu.org --- (In reply to Jakub Jelinek from comment #10) If you believe the nonnull attribute on qsort is incorrect, then you should report that as glibc bug, not gcc bug, the prototype is

[Bug c/61236] GCC 4.9 generates incorrect object code

2014-05-20 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236 --- Comment #12 from Andrew Pinski pinskia at gcc dot gnu.org --- (In reply to Andrew Pinski from comment #11) It is not incorrect as the C standard says this about qsort: nmemb can have the value zero on a call to that function; the

[Bug c/61236] GCC 4.9 generates incorrect object code

2014-05-20 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236 --- Comment #13 from Jakub Jelinek jakub at gcc dot gnu.org --- (In reply to Andrew Pinski from comment #11) It is not incorrect as the C standard says this about qsort: nmemb can have the value zero on a call to that function; the comparison

[Bug c/61236] GCC 4.9 generates incorrect object code

2014-05-20 Thread muks at banu dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236 --- Comment #14 from Mukund Sivaraman muks at banu dot com --- (In reply to Jakub Jelinek from comment #10) But the compiler doesn't know there that x is NULL. The compiler sees a See comment #3. It generates 2 codepaths, one where (nalloc ==

[Bug c/61236] GCC 4.9 generates incorrect object code

2014-05-20 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236 --- Comment #15 from Andrew Pinski pinskia at gcc dot gnu.org --- (In reply to Mukund Sivaraman from comment #14) (In reply to Jakub Jelinek from comment #10) But the compiler doesn't know there that x is NULL. The compiler sees a See

[Bug c/61236] GCC 4.9 generates incorrect object code

2014-05-20 Thread muks at banu dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236 --- Comment #16 from Mukund Sivaraman muks at banu dot com --- (In reply to Andrew Pinski from comment #15) At the very least, if it is possible to detect that the pointer is NULL by static analysis and it is being passed to a function that

[Bug c/61236] GCC 4.9 generates incorrect object code

2014-05-19 Thread muks at banu dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236 --- Comment #1 from Mukund Sivaraman muks at banu dot com --- The following is _correct_ generated x8t_64 code for dns_rdataslab_fromrdataset() as compiled with: gcc version 4.8.2 20131212 (Red Hat 4.8.2-7) (GCC) Under free_rdatas label, you

[Bug c/61236] GCC 4.9 generates incorrect object code

2014-05-19 Thread muks at banu dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236 --- Comment #2 from Mukund Sivaraman muks at banu dot com --- This is the C function (so you can compare notes from the next comment): isc_result_t dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, isc_region_t

[Bug c/61236] GCC 4.9 generates incorrect object code

2014-05-19 Thread muks at banu dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236 --- Comment #3 from Mukund Sivaraman muks at banu dot com --- The following is _incorrect_ generated x86_64 code for dns_rdataslab_fromrdataset() as compiled with: gcc version 4.9.1 20140507 (prerelease) (GCC). (the current version of GCC on

[Bug c/61236] GCC 4.9 generates incorrect object code

2014-05-19 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236 Markus Trippelsdorf trippels at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |WAITING

[Bug c/61236] GCC 4.9 generates incorrect object code

2014-05-19 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236 --- Comment #5 from Markus Trippelsdorf trippels at gcc dot gnu.org --- (In reply to Markus Trippelsdorf from comment #4) Could you please try to reproduce the issue with a more recent snapshot:

[Bug c/61236] GCC 4.9 generates incorrect object code

2014-05-19 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236 --- Comment #6 from Markus Trippelsdorf trippels at gcc dot gnu.org --- (In reply to Markus Trippelsdorf from comment #4) Could you please try to reproduce the issue with a more recent snapshot: No need. I can reproduce the issue and will look

[Bug c/61236] GCC 4.9 generates incorrect object code

2014-05-19 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236 --- Comment #7 from Markus Trippelsdorf trippels at gcc dot gnu.org --- -fno-delete-null-pointer-checks fixes the issue and is an easy workaround for now.

[Bug c/61236] GCC 4.9 generates incorrect object code

2014-05-19 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added CC||jakub at gcc dot