[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 --- (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 has the notnull >

[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 --- (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 comment #3. It generates 2

[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 --- (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 == 0) and another where

[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 --- (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 > function is not called

[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 --- (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 > function is not calle

[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 --- (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 provided by glibc. > The m

[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 changed: What|Removed |Added Status|WAITING |RESOLVED Resolution|---

[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 --- 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 must not be NULL, th

[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 changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #8

[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 --- -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 trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61236 --- Comment #6 from Markus Trippelsdorf --- (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 deeper tomorrow.

[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 --- (In reply to Markus Trippelsdorf from comment #4) > Could you please try to reproduce the issue with a more recent snapshot: > ftp://gcc.gnu.org/pub/gcc/snapshots/4.10-20140518/ Sorry wrong address.

[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 changed: What|Removed |Added Status|UNCONFIRMED |WAITING Last reconfirmed|

[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 --- 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 Arch Linux). NOTE 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 #2 from Mukund Sivaraman --- 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 *region, unsigned in

[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 --- 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 can see that there is a