Marco Ciot wrote:The affected module is DevCPT.
The bug is very old. I guess it was there in the original Oberon Compiler written by N. Wirth, already. (And never discovered so far?!?) If this particular language construct is used, however, it leads to Heap Corruption.
DevCPT bug
- Ivan Denisov
- Posts: 362
- Joined: Tue Sep 17, 2013 12:21 am
- Location: Krasnoyarsk, Russia
DevCPT bug
- Attachments
-
- Test.zip
- (5.22 KiB) Downloaded 529 times
Re: DevCPT bug
Seems like new bug of Garbage Collector.
-
- Posts: 1
- Joined: Mon Jun 23, 2014 2:15 pm
Re: DevCPT bug
No, it's definetely a compiler bug.
I have fixed it in my branch of BlackBox.
I added a Debug Statement in DevCPT, that shows what's done wrong at compile time: Fixed excerpt from DevCPT:
Additionally the finger printing needs to be fixed, as well:
I have fixed it in my branch of BlackBox.
I added a Debug Statement in DevCPT, that shows what's done wrong at compile time: Fixed excerpt from DevCPT:
Code: Select all
PROCEDURE OutRecurseBaseTypeForHdFlds (typ: Struct; adr: INTEGER);
BEGIN
IF typ.BaseTyp # NIL THEN OutRecurseBaseTypeForHdFlds(typ.BaseTyp, adr); END;
OutFlds(typ.link, adr, FALSE);
END OutRecurseBaseTypeForHdFlds;
PROCEDURE OutHdFld(typ: Struct; fld: Object; adr: INTEGER);
VAR i, j, n: INTEGER; btyp: Struct; debugNow: BOOLEAN;
BEGIN
IF typ.comp = Record THEN
IF typ.BaseTyp # NIL THEN OutRecurseBaseTypeForHdFlds(typ.BaseTyp, adr); END;
OutFlds(typ.link, adr, FALSE);
Code: Select all
PROCEDURE FPrintStr*(typ: Struct);
VAR f, c: SHORTINT; btyp: Struct; strobj, bstrobj: Object; pbfp, pvfp: INTEGER;
PROCEDURE ^FPrintFlds(fld: Object; adr: INTEGER; visible: BOOLEAN);
PROCEDURE FPrintRecurseBaseTypeForHdFlds (typ: Struct; adr: INTEGER);
BEGIN
IF typ.BaseTyp # NIL THEN FPrintRecurseBaseTypeForHdFlds(typ.BaseTyp, adr); END;
FPrintFlds(typ.link, adr, FALSE);
END FPrintRecurseBaseTypeForHdFlds;
PROCEDURE FPrintHdFld(typ: Struct; fld: Object; adr: INTEGER); (* modifies pvfp only *)
VAR i, j, n: INTEGER; btyp: Struct;
BEGIN
IF typ.comp = Record THEN
IF typ.BaseTyp # NIL THEN FPrintRecurseBaseTypeForHdFlds(typ.BaseTyp, adr); END;
FPrintFlds(typ.link, adr, FALSE);
- Ivan Denisov
- Posts: 362
- Joined: Tue Sep 17, 2013 12:21 am
- Location: Krasnoyarsk, Russia
Re: DevCPT bug
Marco, thank you for detecting this bug and for suggested solution!
Is your branch available somewhere?marco.ciot wrote:I have fixed it in my branch of BlackBox.
- Ivan Denisov
- Posts: 362
- Joined: Tue Sep 17, 2013 12:21 am
- Location: Krasnoyarsk, Russia
Re: DevCPT bug
Marco, I tested you solution. All works fine. The numbers logged from 999 to 0.
- Ivan Denisov
- Posts: 362
- Joined: Tue Sep 17, 2013 12:21 am
- Location: Krasnoyarsk, Russia
Re: DevCPT bug
This bugfix was included to alpha1 Center version of BlackBox.
The last development version is available from:
http://blackboxframework.org/unstable/master
The last development version is available from:
http://blackboxframework.org/unstable/master