[Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled

2009-07-07 Thread manu at gcc dot gnu dot org
--- Comment #6 from manu at gcc dot gnu dot org 2009-07-07 10:25 --- (In reply to comment #5) Thus code is undefined you have an acess of a char array as a struct. Yes you are only taking the address of an element but it is still considered an acess by the standards. I see

[Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled

2009-07-07 Thread mikulas at artax dot karlin dot mff dot cuni dot cz
--- Comment #7 from mikulas at artax dot karlin dot mff dot cuni dot cz 2009-07-07 16:31 --- extern int c; int a(void) { return *(short *)(void *)c; } This is a very bad example of a false positive as you are acessing an int as a short; that is undefined. I will

[Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled

2009-07-07 Thread pinskia at gcc dot gnu dot org
--- Comment #9 from pinskia at gcc dot gnu dot org 2009-07-07 16:54 --- So you say that converting the char * pointer to struct * pointer is understood as accessing the stored value by the standard? No. Let's look at the code: char buffer[512]; (void *)((struct structure *)(void

[Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled

2009-07-07 Thread mikulas at artax dot karlin dot mff dot cuni dot cz
--- Comment #8 from mikulas at artax dot karlin dot mff dot cuni dot cz 2009-07-07 16:45 --- Thus code is undefined you have an acess of a char array as a struct. Yes you are only taking the address of an element but it is still considered an acess by the standards. Why is it

[Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled

2009-07-07 Thread mikulas at artax dot karlin dot mff dot cuni dot cz
--- Comment #10 from mikulas at artax dot karlin dot mff dot cuni dot cz 2009-07-07 18:07 --- So you mean that that -x operator is invalid and break the standard? Anyway the standard means if you write your code according to the standard = the code will run correctly, but the inverse

[Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled

2009-07-07 Thread pinskia at gcc dot gnu dot org
--- Comment #11 from pinskia at gcc dot gnu dot org 2009-07-07 18:18 --- (In reply to comment #10) For example, you write unsigned char *framebuffer = vga_getgraphmem(); and now you want to access the framebuffer. According to the standard, you could only do it by bytes. But that

[Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled

2009-07-07 Thread mikulas at artax dot karlin dot mff dot cuni dot cz
--- Comment #12 from mikulas at artax dot karlin dot mff dot cuni dot cz 2009-07-07 19:40 --- So if there was char *buffer = malloc(512) instead of char buffer[512], would it be correct to cast it to the pointer to structure? And it is not about the cast between the pointer types

[Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled

2009-07-07 Thread pinskia at gcc dot gnu dot org
--- Comment #13 from pinskia at gcc dot gnu dot org 2009-07-07 20:24 --- (In reply to comment #12) So if there was char *buffer = malloc(512) instead of char buffer[512], would it be correct to cast it to the pointer to structure? Yes. And it is not about the cast between the

[Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled

2009-07-06 Thread mikulas at artax dot karlin dot mff dot cuni dot cz
--- Comment #1 from mikulas at artax dot karlin dot mff dot cuni dot cz 2009-07-07 01:22 --- Created an attachment (id=18145) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18145action=view) a bug in -Wstrict-aliasing=3 This is an example of a flaw in -Wstrict-aliasing=3 (this

[Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled

2009-07-06 Thread mikulas at artax dot karlin dot mff dot cuni dot cz
--- Comment #2 from mikulas at artax dot karlin dot mff dot cuni dot cz 2009-07-07 01:34 --- Created an attachment (id=18146) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18146action=view) a bug in -Wstrict-aliasing=3 This is an example of a flaw in -Wstrict-aliasing=3 (this

[Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled

2009-07-06 Thread pinskia at gmail dot com
--- Comment #3 from pinskia at gmail dot com 2009-07-07 03:44 --- Subject: Re: New: dereferencing type-punned pointer warnings cannot be disabled Sent from my iPhone On Jul 6, 2009, at 6:12 PM, mikulas at artax dot karlin dot mff dot cuni dot cz gcc-bugzi...@gcc.gnu.org wrote:

Re: [Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled

2009-07-06 Thread Andrew Pinski
Sent from my iPhone On Jul 6, 2009, at 6:34 PM, mikulas at artax dot karlin dot mff dot cuni dot cz gcc-bugzi...@gcc.gnu.org wrote: --- Comment #2 from mikulas at artax dot karlin dot mff dot cuni dot cz 2009-07-07 01:34 --- Created an attachment (id=18146) --

[Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled

2009-07-06 Thread pinskia at gmail dot com
--- Comment #4 from pinskia at gmail dot com 2009-07-07 03:48 --- Subject: Re: dereferencing type-punned pointer warnings cannot be disabled Sent from my iPhone On Jul 6, 2009, at 6:34 PM, mikulas at artax dot karlin dot mff dot cuni dot cz gcc-bugzi...@gcc.gnu.org wrote:

Re: [Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled

2009-07-06 Thread Andrew Pinski
Thus code is undefined you have an acess of a char array as a struct. Yes you are only taking the address of an element but it is still considered an acess by the standards. Sent from my iPhone On Jul 6, 2009, at 6:34 PM, mikulas at artax dot karlin dot mff dot cuni dot cz

[Bug regression/40665] dereferencing type-punned pointer warnings cannot be disabled

2009-07-06 Thread pinskia at gmail dot com
--- Comment #5 from pinskia at gmail dot com 2009-07-07 03:50 --- Subject: Re: dereferencing type-punned pointer warnings cannot be disabled Thus code is undefined you have an acess of a char array as a struct. Yes you are only taking the address of an element but it is still