This is the mail archive of the gcc-bugs@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: linux-2.3.3 doesn't boot when compiled with egcs-2.93.22


On Mon, May 24, 1999 at 05:05:55PM +0200, Jeffrey A Law wrote:
> 
>   In message <m33e0mtye6.fsf@fred.muc.de>you write:
>   > davem@redhat.com (David S. Miller) writes:
>   > 
>   > >    From: mark@codesourcery.com
>   > >    Date: Mon, 24 May 1999 01:26:25 -0700
>   > > 
>   > >    Perhaps it would be a good long-term goal to eliminate this stuff,
>   > >    replacing it with assembly where necessary?
>   > > 
>   > > Certainly, and just like I said, in the 2.3.x development series not
>   > > the stable 2.2.x series.
>   > 
>   > The problem is that the Kernel makefile currently has no way to detect
>   > the compiler version used (kernel has no configure). Passing -fno-strict-al
>   > ias
>   > to a gcc 2.7.2 wouldn't be a good idea. So to implement it you need a mini
>   > configure or a similar trick. 
>   > 
>   > Or go the easy way:
>   > 
>   > #if __GNUC__ >= 2 && GNUC_MINOR >= 9 && !defined(CONFIG_EGCS)
>   > #error "you need to compile with CONFIG_EGCS"
>   > #endif
> IMHO is probably the cleanest solution since the kernel does not have any
> way to determine this stuff automagicly.

Erm, of course it was wrong because it wouldn't handle GCC 3.0 and has a typo.

Here is a better version:

#if ((__GNUC__ == 2 && __GNUC_MINOR__ >= 9) || __GNUC__ >= 3) && !defined(CONFIG_EGCS)
#error "you need to compile with CONFIG_EGCS"
#endif

BTW, I found that the TCP is full of such alias problems - it often plays direct access
tricks with TCP headers to test multiple flags, because gcc is not clever enough to combine
complicated multi bit bitfield flag tests over several statements. I'm working on a fix for 2.3.

Is it at least safe to assume that the alias analysis is always flushed at the border of inline
functions? 

I try something like this now:

struct tcphdr_union { 
	union {  
		struct tcphdr tcp;
		__u32 data[5];
	} h;
}; 
/* Anonymous unions and structures would be really handy now! * /
#define tcph h.tcp 

static inline function_that_plays_tricks(struct tcphdr_union *th) 
{
	/* play with th->h.data */ 
}

void main_function(struct tcphdr *th)
{
	... do something with th ...
	function_that_plays_tricks((struct tcphdr_union *) th); 
	... do something with th ...
}

Is this ok?

-Andi

-- 
This is like TV. I don't like TV.


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