This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/31809] New: [4.1/4.2/4.3 Regression] sometimes TREE_READONLY is still set for non read only variables causing wrong code
- 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: 4 May 2007 00:25:48 -0000
- Subject: [Bug c++/31809] New: [4.1/4.2/4.3 Regression] sometimes TREE_READONLY is still set for non read only variables causing wrong code
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Testcase which should not abort but does currently at -O1 and above because SRA
thinks the decl is constant so it using its DECL_INITIAL but that is NULL so we
get a zero instead of the corect value:
struct sc
{
unsigned v;
static inline sc f(unsigned a);
};
inline sc sc::f(unsigned a)
{
static sc t = { a };
return t;
}
const static sc RC = sc::f( 1 );
extern "C" void abort (void);
int main()
{
sc RC1 = RC;
if (! RC1.v ) abort ();
return 0;
}
--
Summary: [4.1/4.2/4.3 Regression] sometimes TREE_READONLY is
still set for non read only variables causing wrong code
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
GCC target triplet: powerpc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31809