URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 305 |
Rev 384 |
// { dg-do run }
|
// { dg-do run }
|
// GROUPS passed references
|
// GROUPS passed references
|
// (Message bugs/refs:1)
|
// (Message bugs/refs:1)
|
// From: tal@vlsi.cs.caltech.edu
|
// From: tal@vlsi.cs.caltech.edu
|
// Date: Fri, 25 Feb 94 23:55:50 -0800
|
// Date: Fri, 25 Feb 94 23:55:50 -0800
|
// Subject: g++-2.5.8 produces incorrect code for references
|
// Subject: g++-2.5.8 produces incorrect code for references
|
// Message-ID: <9402260755.AA27693@vlsi.cs.caltech.edu>
|
// Message-ID: <9402260755.AA27693@vlsi.cs.caltech.edu>
|
|
|
#include
|
#include
|
|
|
class C {
|
class C {
|
private:
|
private:
|
const char** list;
|
const char** list;
|
public:
|
public:
|
C(const char** );
|
C(const char** );
|
void count (int&);
|
void count (int&);
|
};
|
};
|
|
|
C::C (const char** l) {
|
C::C (const char** l) {
|
list = l;
|
list = l;
|
}
|
}
|
|
|
void C::count (int& total) {
|
void C::count (int& total) {
|
if (*list == NULL)
|
if (*list == NULL)
|
return;
|
return;
|
else {
|
else {
|
list++;
|
list++;
|
count (++total); // THIS IS WHERE THE TROUBLE STARTS
|
count (++total); // THIS IS WHERE THE TROUBLE STARTS
|
}
|
}
|
}
|
}
|
|
|
const char * foo[] = {
|
const char * foo[] = {
|
"one", "two", "three", NULL};
|
"one", "two", "three", NULL};
|
|
|
int main() {
|
int main() {
|
C c(foo);
|
C c(foo);
|
int i = 0;
|
int i = 0;
|
c.count(i);
|
c.count(i);
|
if (i == 3)
|
if (i == 3)
|
printf ("PASS\n");
|
printf ("PASS\n");
|
else
|
else
|
{ printf ("FAIL\n"); return 1; }
|
{ printf ("FAIL\n"); return 1; }
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.