URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 149 |
Rev 154 |
/* Checks that pure functions are not treated as const. */
|
/* Checks that pure functions are not treated as const. */
|
|
|
char *p;
|
char *p;
|
|
|
static int __attribute__ ((pure))
|
static int __attribute__ ((pure))
|
is_end_of_statement (void)
|
is_end_of_statement (void)
|
{
|
{
|
return *p == '\n' || *p == ';' || *p == '!';
|
return *p == '\n' || *p == ';' || *p == '!';
|
}
|
}
|
|
|
void foo (void)
|
void foo (void)
|
{
|
{
|
/* The is_end_of_statement call was moved out of the loop at one stage,
|
/* The is_end_of_statement call was moved out of the loop at one stage,
|
resulting in an endless loop. */
|
resulting in an endless loop. */
|
while (!is_end_of_statement ())
|
while (!is_end_of_statement ())
|
p++;
|
p++;
|
}
|
}
|
|
|
int
|
int
|
main (void)
|
main (void)
|
{
|
{
|
p = "abc\n";
|
p = "abc\n";
|
foo ();
|
foo ();
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.