Re: indexing arrays

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

 



On Mon, Nov 18, 2013 at 04:47:01PM +0100, Mischa Baars wrote:
>
> At least you have the example in case you need it, in my opinion the
> compiler is in error.

This isn't even gcc, you're just making noise. Try it with clang or read
the x86_64 ABI.

Surely it's common knowledge that if you're writing assembly, certain
registers are preserved across function calls? What about %ebp?

Compile this file, even on the lowest optimisation level (-O1) using
both gcc and clang, and you'll see that they're explicitly using %ebx to
save the value of `i'. It's not an accident.

int main(void)
{
	int i = save_me();
	f(g(), h());
	return i;
}

Regards,
Rob




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux