This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14029] [tree-ssa] Miscompilation of unrolled loop due to Iterator::base having an aliasing problem
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Feb 2004 03:10:58 -0000
- Subject: [Bug c++/14029] [tree-ssa] Miscompilation of unrolled loop due to Iterator::base having an aliasing problem
- References: <20040205125414.14029.stefaandr@hotmail.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-02-06 03:10 -------
This is caused by -fstrict-aliasing.
The problem is that C++ (and the C by the way if converted to act like C) front-end is doing this
for Iterator::base :
int* const& Iterator::base() const (this)
{
{
return (int * const *)this;
}
}
which is wrong as it violates aliasing rules.
For a C example:
int **t(struct Iterator*this1)
{
return &this1->ptr;
}
Does this:
t (this1)
{
return (int * *)this1;
}
Even it gets this wrong too:
struct Iterator {
int * ptr;
int * ptr1;
};
int **t(struct Iterator*this1)
{
return &this1->ptr1;
}
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |critical
Component|optimization |c++
Last reconfirmed|2004-02-05 18:37:03 |2004-02-06 03:10:57
date| |
Summary|[tree-ssa] Miscompilation of|[tree-ssa] Miscompilation of
|unrolled loop |unrolled loop due to
| |Iterator::base having an
| |aliasing problem
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14029