<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
You may want to try this with a lot of stack space - just<br>
to exclude that it is a stack overflow issue<br>
(since you created the task with minimum stack size)<br>
<br>
- T.<br>
<br>
On 10/31/2011 02:58 AM, Constantine "chicky" Giotopoulos wrote:
<blockquote
cite="mid:CA+58Dwt1VaUCU+qbgybL5S05wSVGR5+jZAaG9DLR1EPmW7BkYw@mail.gmail.com"
type="cite">
<div>Hello everyone.</div>
<div> </div>
<div>Using RTEMS 4.8.2, I create a single task that executes the
code of "paranoia.c" (it is included when installing RTEMS 4.8.2
in the path
.../rtems-4.8.2/testsuites/samples/paranoia/paranoia.c):</div>
<div> </div>
<div><span lang="EN-GB">
<p>rtems_task Init( rtems_task_argument ignored )</p>
<p>{</p>
<p>rtems_status_code status; rtems_id id;</p>
<p>//Create and start the first task</p>
<p>status = rtems_task_create( rtems_build_name( 'T', 'A',
'1', ' ' ), 1, RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES <span
lang="EN-GB">| RTEMS_FLOATING_POINT</span>, &id);</p>
<p>assert( !status );</p>
<p>status = rtems_task_start( id, task1, 0 );</p>
<p>assert( !status );</p>
<p>status = rtems_task_delete( RTEMS_SELF );</p>
<p>exit( 0 );</p>
<p>}</p>
<span lang="EN-GB">
<p>rtems_task task1( rtems_task_argument ignored )</p>
<p>{</p>
<p>paranoia();</p>
<p>rtems_task_delete(RTEMS_SELF);</p>
<p>}</p>
<p> </p>
<p>Paranoia program contains a number of functions that
perform floating point operations.</p>
<p>When I execute the aforementioned code on a SPARC machine
it works perfectly. But when I execute the same code using
Qemu/i386 the execution halts when "Milestone 140" is
reached, and more specifically after the line indicated
bellow:</p>
<span lang="EN-GB">
<p>/*=============================================*/</p>
<p>Milestone = 140;</p>
<p>/*=============================================*/</p>
<p>printf ("\n");</p>
<p>/* ...calculate Exp2 == exp(2) == 7.389056099... */</p>
<p>X = Zero;</p>
<p>I = 2;</p>
<p>Y = Two * Three;</p>
<p>Q = Zero;</p>
<p>N = 0;</p>
<p>do {</p>
<p> Z = X;</p>
<p> I = I + 1;</p>
<p> Y = Y / (I + I);</p>
<p> R = Y + Q;</p>
<p> X = Z + R;</p>
<p> Q = (Z - X) + R;</p>
<p>}</p>
<p>while (X > Z);</p>
<p>Z = (OneAndHalf + One / Eight) + X / (OneAndHalf *
ThirtyTwo);</p>
<p>X = Z * Z;</p>
<p>Exp2 = X * X;</p>
<p>X = F9;</p>
<p>Y = X - U1;</p>
<p><strong><u>printf ("Testing X^((X + 1) / (X - 1)) vs.
exp(2) = %.17e as X -> 1.\n", Exp2);</u></strong></p>
<p>for (I = 1;;) {</p>
<p> Z = X - BInvrse;</p>
<p> Z = (X + One) / (Z - (One - BInvrse));</p>
<p> Q = POW (X, Z) - Exp2;</p>
<p> if (FABS (Q) > TwoForty * U2) {</p>
<p> N = 1;</p>
<p> V9 = (X - BInvrse) - (One - BInvrse);</p>
<p> BadCond (Defect, "Calculated");</p>
<p> printf (" %.17e for\n", POW (X, Z));</p>
<p> printf ("\t(1 + (%.17e) ^ (%.17e);\n", V9, Z);</p>
<p> printf ("\tdiffers from correct value by %.17e
.\n", Q);</p>
<p> printf ("\tThis much error may spoil
financial\n");</p>
<p> printf ("\tcalculations involving tiny interest
rates.\n");</p>
<p> break;</p>
<p> } </p>
<p> else {</p>
<p> Z = (Y - X) * Two + Y;</p>
<p> X = Y;</p>
<p> Y = Z;</p>
<p> Z = One + (X - F9) * (X - F9);</p>
<p> if (Z > One && I < NoTrials)</p>
<p> I++;</p>
<p> else {</p>
<p> if (X > One) </p>
<p> {</p>
<p> if (N == 0)</p>
<p> printf ("Accuracy seems
adequate.\n");</p>
<p> break;</p>
<p> } </p>
<p> else </p>
<p> {</p>
<p> X = One + U2;</p>
<p> Y = U2 + U2;</p>
<p> Y += X;</p>
<p> I = 1;</p>
<p> }</p>
<p> }</p>
<p> }</p>
<p>}</p>
<p>/*=============================================*/</p>
<p>Milestone = 150;</p>
<p>/*=============================================*/</p>
<p>.................</p>
<p> </p>
<p>In other words, the program executes until the</p>
<p><strong><u>printf ("Testing X^((X + 1) / (X - 1)) vs.
exp(2) = %.17e as X -> 1.\n", Exp2);</u></strong></p>
<p>but stops there. If I comment out the section of the
code, the rest of the program executes normally.</p>
<p>What could be the case for this behaviour? Why is the
code running smootly on a SPARC but not on Qemu/i386 and
how could I work out an explaination?</p>
<p> </p>
<p>Thank you in advance.</p>
</span></span></span></div>
</blockquote>
<br>
</body>
</html>