modula3 / cm3

Critical Mass Modula-3
http://modula3.github.io/cm3/
Other
133 stars 25 forks source link

Debug info for LONGCARD #334

Open demoitem opened 3 years ago

demoitem commented 3 years ago

In the M3 IR below the local ccc is declared as CARDINAL and is declared with the builtin uid for the type but the local lll is a LONGCARD and is declared as a subrange without a typename to accompany it. The uid is correct but I think it should not have the subrange declaration

declare_local    ccc 8 8 Word.64 -1746782238 F F 50 v.16
declare_subrange     -1662175513 89530742 0 9223372036854775807 64
declare_local    lll 8 8 Word.64 -1662175513 F F 50 v.17
RodneyBates commented 3 years ago

I think I agree.

From many years ago, Modula-3 says "CARDINAL Behaves just like the subrange [0...LAST(INTEGER)]". It took me years of questions, unenlightening answers, and finally, working in Pickle2, to find out why "just like" instead of "equals". Pickles will convert, among other things, sizes of integer-like things, when written on one target and read on another. But only when declared as one of the predefined types, not as a subrange.

LONGINT and LONGCARD got added later, and this distinction maybe got lost in the addition, or maybe it was deemed irrelevant for LONGINT, which, I guess, should always be 64 bits?

On 4/9/21 3:55 AM, peter mckinna wrote:

In the M3 IR below the local ccc is declared as CARDINAL and is declared with the builtin uid for the type but the local lll is a LONGCARD and is declared as a subrange without a typename to accompany it. The uid is correct but I think it should not have the subrange declaration

|declare_local ccc 8 8 Word.64 -1746782238 F F 50 v.16 declare_subrange -1662175513 89530742 0 9223372036854775807 64 declare_local lll 8 8 Word.64 -1662175513 F F 50 v.17 |

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/modula3/cm3/issues/334, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSVZNCR6DIOH7UBEMXQNWTTH26JLANCNFSM42URWXXQ.