This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Gcc extra alignment..




On Tue, 31 Oct 2000, Richard Henderson wrote:
> 
> It is possible, and would depend on the exact layout of the surrounding
> code.  We generate extra loop alignment if there is a LOOP note adjacent
> to a label.  The combination of fake loop notes and labels appearing for
> other reasons is not detected.

This does seem to be the case: I can actually reproduce this with a simple
test-case when optimizations are disabled. I assume that with a more
complex case I could see it even with optimizations, assuming that the
case was complex enough that the optimizer would get sufficiently
confused.

Might it not be worth-while to special-case the "do { } while (0)"
construct and get rid of the "loop" very very early? It's pretty much the
standard way of writing just about any macro. The code without -O is just
ridiculous: try compiling

	void test(void)
	{
		asm ("*** 1 ***");
		do {
			asm ("*** 2 ***");
		} while (0);
		asm ("*** 3 ***");
	}

with "gcc -S", and it's just sad.

Now, I personally never compile _anything_ without optimizations, but I
know people who do for debugging reasons. But the mess made by even really
simple macros that use an empty while-loop is truly sad, and doesn't
exactly help debugging.

[ Begin weak argument of the week ]

It might even speed up the compiler for common cases to notice the "while
(0)" early and not waste any more time on it.

[ End weak argument of the week ]

		Linus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]