re PR tree-optimization/30567 (-O3 optimizer bug)

2007-04-26  Richard Guenther  <rguenther@suse.de>
        Daniel Berlin  <dberlin@dberlin.org>

        PR tree-optimization/30567
        * g++.dg/other/pr30567.C: New testcase.

Co-Authored-By: Daniel Berlin <dberlin@dberlin.org>

From-SVN: r124191
This commit is contained in:
Richard Guenther 2007-04-26 15:50:32 +00:00 committed by Richard Biener
parent 5c7ec4f0d5
commit 794ed8a510
2 changed files with 39 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2007-04-26 Richard Guenther <rguenther@suse.de>
Daniel Berlin <dberlin@dberlin.org>
PR tree-optimization/30567
* g++.dg/other/pr30567.C: New testcase.
2007-04-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/31703

View File

@ -0,0 +1,33 @@
/* { dg-do run } */
/* { dg-options "-O -finline-functions -fstrict-aliasing" } */
template <typename T>
struct const_ref
{
const T* begin;
const_ref(const T* b) : begin(b) {}
};
template <typename T>
T sum(const_ref<T> const& a)
{
T result = 0;
for(unsigned i=0;i<1;i++) result += a.begin[i];
return result;
}
struct tiny_plain
{
int elems[2];
tiny_plain() { elems[0]=1; }
};
struct vec3 : tiny_plain {};
struct mat3
{
int type() const { return sum(const_ref<int>(vec3().elems)) == 1; }
};
int main() { return mat3().type() ? 0 : 1; }