ada/5978: A short-circuit return statement should be added to a-ngcefu.adb
zhenggen@public1.ptt.js.cn
zhenggen@public1.ptt.js.cn
Fri Mar 15 18:56:00 GMT 2002
>Number: 5978
>Category: ada
>Synopsis: A short-circuit return statement should be added to a-ngcefu.adb
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Mar 15 18:56:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: zhenggen@public1.ptt.js.cn
>Release: any
>Organization:
>Environment:
any
>Description:
Code fragment in gcc/gcc/ada/a-ngcefu.adb:
line309: if abs Re (X) < Square_Root_Epsilon and then
line310: abs Im (X) < Square_Root_Epsilon
line311: then
line312: return X;
line313:
line314: elsif abs Re (X) > Inv_Square_Root_Epsilon or else
line315: abs Im (X) > Inv_Square_Root_Epsilon
line316: then
line317: Result := -Complex_I * (Log (Complex_I * X) + Log (2.0 * Complex_I));
line318:
line319: if Im (Result) > PI_2 then
line320: Set_Im (Result, PI - Im (X));
line321:
line322: elsif Im (Result) < -PI_2 then
line323: Set_Im (Result, -(PI + Im (X)));
line324: end if;
line325: end if;
line326:
line327: Result := -Complex_I * Log (Complex_I * X + Sqrt (1.0 - X * X));
A short-circuit statement "return Result;" should be placed between
line324 and line325. Otherwise the assignment in line327 will
modify the value of "Result".
>How-To-Repeat:
>Fix:
Place a statement "Return Result;" between line324 and line325
in gcc/gcc/ada/a-ngcefu.adb
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-prs
mailing list