PR# 10057 Compiler bug for post-condition
Problem Report Summary
Submitter: farazahmadi
Category: Compiler
Priority: High
Date: 2005/11/19
Class: Bug
Severity: Serious
Number: 10057
Release: 5.6.1218 University Edition
Confidential: No
Status: Suspended
Responsible:
Environment: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1)
Synopsis: Compiler bug for post-condition
Description
If you compile the following code from scratch and press the launch button, you'll see a post-condition violation. Now, uncomment the commented line in 'multiply' feature and re-compile the system (not from scratch) and launch it. The post-condition error does not appear anymore.
============================================
class ROOT_CLASS
create make
feature
make is
local
a, b, r: REAL
do
a := 2.2
b := 5.5
r := multiply (a, b)
end
multiply (num1:REAL; num2: REAL): REAL is
do
Result := num1 * num2
-- print ("uncomment this line")
ensure
Result = num1 * num2
end
end
To Reproduce
See the description.
Problem Report Interactions
Thanks for reporting this. This is a known issue with the backend C compiler which performs comparison with a higher precision than the value stored thus causing the post-condition to fail.