[nem-bug] [Nemerle 0000639]: A compile-time calculus and code
generation
feedback at nemerle.org
feedback at nemerle.org
Tue Mar 28 02:27:14 CEST 2006
The following issue has been SUBMITTED.
======================================================================
<http://nemerle.org/bugs/view.php?id=639>
======================================================================
Reported By: VladD2
Assigned To:
======================================================================
Project: Nemerle
Issue ID: 639
Category: Compiler
Reproducibility: always
Severity: crash
Priority: normal
Status: new
======================================================================
Date Submitted: 03-28-2006 02:27 CEST
Last Modified: 03-28-2006 02:27 CEST
======================================================================
Summary: A compile-time calculus and code generation
Description:
If write macro like this:
using System;
macro CompileTimeFactorial(x : uint)
{
def factorial = Math.Factorial(x);
<[ $(factorial : ulong) ]>
}
public module Math
{
public static Factorial(x : uint) : ulong
{
def Loop(acc : ulong, x : uint)
{
if (x <= 1) acc else Loop(acc * x, x - 1)
};
Loop (1UL, x)
}
}
and try to use it like this:
WriteLine(CompileTimeFactorial(0));
The compiler generate such IL:
.method private hidebysig static void Main() cil managed
{
.entrypoint
.maxstack 1
L_0000: ldc.i8 1
L_0009: conv.u8
L_000a: call void [mscorlib]System.Console::WriteLine(int32)
L_000f: ret
}
That is in a fanction which take int32 parameter pass uint64 argument.
If run this code AV is expected.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
03-28-06 02:27 VladD2 New Issue
======================================================================
More information about the bugs
mailing list