[Bug c/25702] feature request: generate a warning for sizeof on a pointer

2016-05-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25702 --- Comment #15 from Jakub Jelinek --- Even (T*)malloc(n) where n < sizeof(T) is quite common, e.g. in GCC itself (well, we don't usually use malloc but some ggc_alloc*) - e.g. if T is a union and the code wants to allocate memory just for one

[Bug c/25702] feature request: generate a warning for sizeof on a pointer

2016-05-21 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25702 --- Comment #14 from Jonathan Wakely --- See PR 71219 and the TC it links to. The suggestion is to warn for (T*)malloc(n) where n < sizeof(T) i.e. when there is enough context to infer that what was intended was malloc(sizeof(T)). The

[Bug c/25702] feature request: generate a warning for sizeof on a pointer

2016-05-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25702 --- Comment #13 from Jakub Jelinek --- If we add such a warning, IMNSHO it shouldn't be in -Wall, because sizeof on pointer is a perfectly valid thing, which is used in huge amounts of code, there is really nothing wrong on it.

[Bug c/25702] feature request: generate a warning for sizeof on a pointer

2016-05-21 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25702 --- Comment #12 from Jonathan Wakely --- PR 71219 requests a new warning for: struct S* p = (struct S*)malloc(sizeof(p)); which would solve some of the other bugs shown in comment 3.

[Bug c/25702] feature request: generate a warning for sizeof on a pointer

2015-08-12 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25702 Marek Polacek mpolacek at gcc dot gnu.org changed: What|Removed |Added Status|NEW |RESOLVED

[Bug c/25702] feature request: generate a warning for sizeof on a pointer

2015-08-12 Thread meklund at cisco dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25702 --- Comment #11 from Mark Eklund meklund at cisco dot com --- -Wsizeof-pointer-memaccess is definitely a good targeted fix and probably hits a majority of what I've seen. I'm good with this being resolved.

[Bug c/25702] feature request: generate a warning for sizeof on a pointer

2013-01-04 Thread forgcc at calmarius dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25702 David Csirmaz forgcc at calmarius dot net changed: What|Removed |Added CC||forgcc

[Bug c/25702] feature request: generate a warning for sizeof on a pointer

2013-01-04 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25702 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added CC||jakub at

[Bug c/25702] feature request: generate a warning for sizeof on a pointer

2008-11-14 Thread pinskia at gcc dot gnu dot org
--- Comment #6 from pinskia at gcc dot gnu dot org 2008-11-14 23:51 --- Actually I use sizeof all the time on pointers so I don't think this is useful. In fact it falls down with meta programming. That is: #define bitcase(type, a) ({typeof (a) b = a; type c; int

[Bug c/25702] feature request: generate a warning for sizeof on a pointer

2008-01-26 Thread rguenth at gcc dot gnu dot org
-- rguenth at gcc dot gnu dot org changed: What|Removed |Added CC||marcus at jet dot franken |

[Bug c/25702] feature request: generate a warning for sizeof on a pointer

2007-11-28 Thread manu at gcc dot gnu dot org
--- Comment #4 from manu at gcc dot gnu dot org 2007-11-28 17:34 --- So what the BSD people said about this? Did they agree with your assessment? How many of those 26 likely bugs were considered real bugs by them? It really seems too noisy and with no clear way to avoid or workaround

[Bug c/25702] feature request: generate a warning for sizeof on a pointer

2007-11-28 Thread meklund at cisco dot com
--- Comment #5 from meklund at cisco dot com 2007-11-28 19:43 --- Subject: Re: feature request: generate a warning for sizeof on a pointer Hi Manu, This is in regards to your Comments for the gcc feature enhancement request, http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25702. On Wed,

[Bug c/25702] feature request: generate a warning for sizeof on a pointer

2006-01-17 Thread meklund at cisco dot com
--- Comment #3 from meklund at cisco dot com 2006-01-17 15:36 --- Subject: Re: feature request: generate a warning for sizeof on a pointer Using the FreeBSD latest CVS pull on 10-Jan-06 (5.4 based), a build world was run with the below modifications to GCC. The output was then

[Bug c/25702] feature request: generate a warning for sizeof on a pointer

2006-01-06 Thread pinskia at gcc dot gnu dot org
--- Comment #1 from pinskia at gcc dot gnu dot org 2006-01-06 22:12 --- Actually people use sizeof(x) all the time to mean the correct thing, for an example: memcpy(x, y, sizeof(x)); -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25702

[Bug c/25702] feature request: generate a warning for sizeof on a pointer

2006-01-06 Thread meklund at cisco dot com
--- Comment #2 from meklund at cisco dot com 2006-01-06 22:24 --- Subject: Re: feature request: generate a warning for sizeof on a pointer On Fri, Jan 06, 2006 at 10:12:55PM -, pinskia at gcc dot gnu dot org wrote: Actually people use sizeof(x) all the time to mean the correct