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 338 |
// { dg-do assemble }
|
// { dg-do assemble }
|
// { dg-options "-fexceptions -O -S" }
|
// { dg-options "-fexceptions -O -S" }
|
|
|
extern "C" int printf (const char *, ...);
|
extern "C" int printf (const char *, ...);
|
extern "C" int atoi (const char *);
|
extern "C" int atoi (const char *);
|
extern "C" void exit (int);
|
extern "C" void exit (int);
|
|
|
struct Exception
|
struct Exception
|
{
|
{
|
int v;
|
int v;
|
Exception(int i) { v = i; };
|
Exception(int i) { v = i; };
|
};
|
};
|
|
|
void inc(int &i)
|
void inc(int &i)
|
{
|
{
|
try {
|
try {
|
if (i == 0)
|
if (i == 0)
|
throw Exception(i);
|
throw Exception(i);
|
else
|
else
|
i++;
|
i++;
|
}
|
}
|
catch (Exception v) {
|
catch (Exception v) {
|
i = v.v;
|
i = v.v;
|
}
|
}
|
}
|
}
|
|
|
main (int argc, const char *argv[])
|
main (int argc, const char *argv[])
|
{
|
{
|
if (argc != 2)
|
if (argc != 2)
|
{
|
{
|
printf ("usage: a.out \n");
|
printf ("usage: a.out \n");
|
exit (1);
|
exit (1);
|
}
|
}
|
int count = atoi (argv[1]);
|
int count = atoi (argv[1]);
|
inc (count);
|
inc (count);
|
printf ("success\n");
|
printf ("success\n");
|
exit (0);
|
exit (0);
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.