PR# 19532 Wrong generated C code in finalized mode
Problem Report Summary
Submitter: gobobe
Category: Compiler
Priority: High
Date: 2019/03/10
Class: Bug
Severity: Critical
Number: 19532
Release: 19.02.10.2945
Confidential: No
Status: Closed
Responsible: alexk_es
Environment: win
Synopsis: Wrong generated C code in finalized mode
Description
When compiling the following system in finalized mode:
~~~~~~~~~~~~~~~~~~~~~~
class A
create
make
feature
make
local
c1, c2: C
b: BOOLEAN
do
create c1
create c2
b := c1 <= c2
end
end
~~~~~~~~~~~~~~~~~~~~~~
deferred class B
feature
is_less_equal alias "<=" (other: like Current): BOOLEAN
do
Result := is_less (other) or is_equal (other)
end
is_less (other: like Current): BOOLEAN
deferred
end
end
~~~~~~~~~~~~~~~~~~~~~~
class C
inherit
B
redefine
is_equal
end
feature
is_less (other: like Current): BOOLEAN
do
print ("C.is_less%N")
end
is_equal (other: like Current): BOOLEAN
do
print ("C.is_equal%N")
end
end
~~~~~~~~~~~~~~~~~~~~~~
I get this output:
~~~~~~~~~~~~~~~~~~~~~~
C.is_less
~~~~~~~~~~~~~~~~~~~~~~
I was expecting {C}.is_equal to be called. Looking at the C code generated for {B}.is_less_equal:
~~~~~~~~~~~~~~~~~~~~~~
Result = '\01';
if (!F33_503(Current, arg1)) {
Result = (EIF_BOOLEAN) eif_builtin_ANY_is_equal (Current, arg1);
}
~~~~~~~~~~~~~~~~~~~~~~
We can see that it's {ANY}.is_equal which is called, not {C}.is_equal.
--
Eric Bezault
To Reproduce