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


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)

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/


-- 
Ori Bernstein <ori@xxxxxxxxxxxxxx>

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