[Bug c++/32716] New: Wrong code generation. Inlining problem.
pranav dot bhandarkar at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Jul 10 09:52:00 GMT 2007
Generating wrong code for the following code snippet (test.C)
using namespace std;
#include <iostream>
class A { public:int a;};
class B: public virtual A { public: A::a;};
class C : public virtual A { public: A::a;};
class D : public C, public B {};
void h ( D &x )
{
x.a++;
}
int main ()
{
int result ;
D d;
d.a = 0;
h (d);
result = !(d.a==1);
result ? cout<<"FAILED": cout <<"SUCCESS";
return 0;
}
$>arm-none-eabi-g++ -O3 test.C
$> arm-none-eabi-run a.out
FAILED
$>arm-none-eabi-g++ -O3 test.C -fno-inline-functions
$> arm-none-eabi-run a.out
SUCCESS
$>arm-none-eabi-g++ --version
arm-none-eabi-g++ (GCC) 4.3.0 20070703 (experimental)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--
Summary: Wrong code generation. Inlining problem.
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pranav dot bhandarkar at gmail dot com
GCC target triplet: arm-none-eabi
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32716
More information about the Gcc-bugs
mailing list