[patch] Fix estimate number of iterations

Falk Hueffner falk@debian.org
Mon Sep 19 21:36:00 GMT 2005


Daniel Berlin <dberlin@dberlin.org> writes:

> Actually, it has *nothing* to do with structs directly, only pointers.
>
> The following is not legal:
>
> struct a
> {
> int foo;
> int bar[1];
> } foobar;
>
> foobar.bar[2] = 5
>
> The attached should work

What does this patch do to code like this (from
linux/arch/alpha/kernel/traps.c):

struct allregs {
	unsigned long regs[32];
	unsigned long ps, pc, gp, a0, a1, a2;
};

unsigned long f(struct allregs *r) {
	return r->regs[35];	// return a0
}

It's most likely invalid, but apparently people expect it to work.

-- 
	Falk



More information about the Gcc-patches mailing list