OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.law/] [refs1.C] - Diff between revs 305 and 338

Only display areas with differences | Details | Blame | View Log

Rev 305 Rev 338
// { 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; }
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.