Re: [BLACKBOX] Possible compiler bug ?

From: [at]} <Robert>
Date: Mon, 19 Dec 2011 18:22:37 +0000

----boundary-LibPST-iamunique-1108323206_-_-
Content-type: text/plain

Luowy

I tried this, and my source code compiles, but crashes at run-time.

The line is (now !)

     pos := SHORT (LONG (val) * meter.steps DIV meter.maxVal);

All variables are INTEGERS.
val is 0, meter.steps is 100, and meter.maxVal is 9999.

If I copy meter.maxVal into a local temporary variable (maxVal) it works fine
with the unmodified compiler, but still crashes at runtime with the modification.


I need to use LONGINTs in the expression because sometimes val & maxVal may
exceed 2^31 / 100.


I believe there is a clever way of computing a * b MOD c without suffering
overflow problems; it is used in ObxRandom. But understanding that trick is a
theoretical detour I haven't the time for just now.


I know my posted example is incomplete as a runnable program; it was meant to be
a minimal example of the compiler problem.


Regards

Robert


On 19/12/2011 17:12, luowy{([at]})nowhere.xy
> add one line:
>
> DevCPC486.FloatDOp
> ...
> | div:
> IF y.mode # Reg THEN LoadR(y); END;(*<<< add this line *)
> IF rev THEN Dev2CPL486.GenFDOp(FDIVR, y) ELSE Dev2CPL486.GenFDOp(FDIV, y) END;
> Floor(y,FALSE)
> ...
>
>
>
> ----- ?? -----
> ???: Aubrey.McIntosh{([at]})nowhere.xy
> ? ?: Re: [BLACKBOX] Possible compiler bug ?
> ? ?: 2011?12?19? 22:25:12
>
> It compiles to completion in V4:iOP2 RC/NM V1.7 22.1.1996
> compiling DemoMeter; new symbol file 58And the user program traps at the expected place on the NIL pointer.
>
> I think that the BlackBox compiler is a descendant of the original OP2 compiler. There is an early 90s paper that describes the internal data structures of OP2. Is it obvious to anyone how to walk down the source for the two compiler execution paths side by side to see what catches the eye?
>
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2012.0.1890 / Virus Database: 2108/4689 - Release Date: 12/18/11


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1108323206_-_-
Content-type: application/rtf
Content-transfer-encoding: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YXBzIGF0IHRoZSBleHBlY3Rl
ZCBwbGFjZSBvbiB0aGUgTklMIHBvaW50ZXIuXHBhcg0KPlxwYXINCj4gSSB0aGluayB0aGF0IHRo
ZSBCbGFja0JveCBjb21waWxlciBpcyBhIGRlc2NlbmRhbnQgb2YgdGhlIG9yaWdpbmFsIE9QMiBj
b21waWxlci4gVGhlcmUgaXMgYW4gZWFybHkgOTBzIHBhcGVyIHRoYXQgZGVzY3JpYmVzIHRoZSBp
bnRlcm5hbCBkYXRhIHN0cnVjdHVyZXMgb2YgT1AyLiBJcyBpdCBvYnZpb3VzIHRvIGFueW9uZSBo
b3cgdG8gd2FsayBkb3duIHRoZSBzb3VyY2UgZm9yIHRoZSB0d28gY29tcGlsZXIgZXhlY3V0aW9u
IHBhdGhzIHNpZGUgYnkgc2lkZSB0byBzZWUgd2hhdCBjYXRjaGVzIHRoZSBleWU/XHBhcg0KPlxw
YXINCj5ccGFyDQo+XHBhcg0KPiAtLS0tLVxwYXINCj4gTm8gdmlydXMgZm91bmQgaW4gdGhpcyBt
ZXNzYWdlLlxwYXINCj4gQ2hlY2tlZCBieSBBVkcgLSB3d3cuYXZnLmNvbVxwYXINCj4gVmVyc2lv
bjogMjAxMi4wLjE4OTAgLyBWaXJ1cyBEYXRhYmFzZTogMjEwOC80Njg5IC0gUmVsZWFzZSBEYXRl
OiAxMi8xOC8xMVxwYXINClxwYXINClxwYXINCi0tLS1ccGFyDQpUbyB1bnN1YnNjcmliZSwgc2Vu
ZCBhIG1lc3NhZ2Ugd2l0aCBib2R5ICJTSUdOT0ZGIEJMQUNLQk9YIiB0byBMSVNUU0VSVkBMSVNU
Uy5PQkVST04uQ0h9fQAAAIB7
----boundary-LibPST-iamunique-1108323206_-_---
Received on Mon Dec 19 2011 - 19:22:37 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:09 UTC