public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14299] New: Improperly derefences pointers with casting
@ 2004-02-25 20:20 dmeggy at techsol dot ca
2004-02-25 20:22 ` [Bug optimization/14299] " falk at debian dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: dmeggy at techsol dot ca @ 2004-02-25 20:20 UTC (permalink / raw)
To: gcc-bugs
Here is an example
<snip>
typedef struct
{
unsigned first : 6;
unsigned second : 1;
unsigned third : 1;
unsigned fourth : 1;
unsigned fifth : 1;
unsigned sixth : 1;
unsigned unused : 21;
} TestStruct;
int func() {
TestStruct a;
TestStruct *b;
a.first = 4;
b = (TestStruct *)(&a);
return b->first;
}
int func2() {
int a;
TestStruct *b;
a = 4;
b = (TestStruct *)(&a);
return b->first;
}
</snip>
func() will work, and func2() won't, called as "arm-linux-gcc test2.c -Os -g -c"
func2 will never set the value of a to 4
--
Summary: Improperly derefences pointers with casting
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dmeggy at techsol dot ca
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-linux
GCC host triplet: i386-linux
GCC target triplet: arm-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14299
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug optimization/14299] Improperly derefences pointers with casting
2004-02-25 20:20 [Bug optimization/14299] New: Improperly derefences pointers with casting dmeggy at techsol dot ca
@ 2004-02-25 20:22 ` falk at debian dot org
2005-06-05 8:40 ` [Bug rtl-optimization/14299] " pinskia at gcc dot gnu dot org
2005-06-05 8:40 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: falk at debian dot org @ 2004-02-25 20:22 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From falk at debian dot org 2004-02-25 20:22 -------
The code violates aliasing rules and is therefore invalid. Newer gcc's even
warn about it.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14299
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug rtl-optimization/14299] Improperly derefences pointers with casting
2004-02-25 20:20 [Bug optimization/14299] New: Improperly derefences pointers with casting dmeggy at techsol dot ca
2004-02-25 20:22 ` [Bug optimization/14299] " falk at debian dot org
2005-06-05 8:40 ` [Bug rtl-optimization/14299] " pinskia at gcc dot gnu dot org
@ 2005-06-05 8:40 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-05 8:40 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-06-05 08:40 -------
Reopening to ...
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14299
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug rtl-optimization/14299] Improperly derefences pointers with casting
2004-02-25 20:20 [Bug optimization/14299] New: Improperly derefences pointers with casting dmeggy at techsol dot ca
2004-02-25 20:22 ` [Bug optimization/14299] " falk at debian dot org
@ 2005-06-05 8:40 ` pinskia at gcc dot gnu dot org
2005-06-05 8:40 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-05 8:40 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-06-05 08:40 -------
Mark as a dup of bug 21920
*** This bug has been marked as a duplicate of 21920 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14299
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-06-05 8:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-25 20:20 [Bug optimization/14299] New: Improperly derefences pointers with casting dmeggy at techsol dot ca
2004-02-25 20:22 ` [Bug optimization/14299] " falk at debian dot org
2005-06-05 8:40 ` [Bug rtl-optimization/14299] " pinskia at gcc dot gnu dot org
2005-06-05 8:40 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).