Eigenstate: myrddin-dev mailing list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiler crashes when taking address of function pointer



Ori Bernstein <ori@xxxxxxxxxxxxxx> wrote:
>Interesting. That shouldn't happen. It's crashing because the backend
>puts
>function addresses into registers as rvalues if they're not being
>called.
>
>I haven't hit it because I haven't needed pointer to a function yet;
>functions already can be passed around without taking their address:
>
>	const each = {sl : int[:], f : (int -> void)
>		...
>	}
>
>	each([1,2,3][:], somefunc)

Well, it has to do with the kernel writing. I need to split a function's address into the higher and lower bits.

I think there's a way I can get around it, though. Just though I should report this anyway.

>
>should work just fine.
>
>On Fri, 16 Jan 2015 14:52:29 -0600
>Ryan Gonzalez <rymg19@xxxxxxxxx> wrote:
>
>> Example:
>> 
>> const g = {; ->}
>> const f = {; var addr = &g}
>> 
>> I get this:
>> 
>> ryan@DevPC-LX:~/langtest/myr$ 6m bug.myr
>> 6m: gengas.c:128: locprint: Assertion `(spec == 'r' &&
>isintmode(l->mode))
>> || (spec == 'f' && isfloatmode(l->mode)) || spec == 'v' || spec ==
>'x' ||
>> spec == 'u'' failed.
>> Aborted (core dumped)
>> ryan@DevPC-LX:~/langtest/myr$
>> 
>> -- 
>> Ryan
>> If anybody ever asks me why I prefer C++ to C, my answer will be
>simple:
>> "It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think that
>was
>> nul-terminated."
>> Personal reality distortion fields are immune to contradictory
>evidence. -
>> srean
>> Check out my website: http://kirbyfan64.github.io/

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
Check out my website: http://kirbyfan64.github.io/

Follow-Ups:
Re: Compiler crashes when taking address of function pointerOri Bernstein <ori@xxxxxxxxxxxxxx>
References:
Compiler crashes when taking address of function pointerRyan Gonzalez <rymg19@xxxxxxxxx>
Re: Compiler crashes when taking address of function pointerOri Bernstein <ori@xxxxxxxxxxxxxx>