Subject: Re: Compiler bug?
To: Ian Dall <Ian.Dall@dsto.defence.gov.au>
From: Jon Buller <jonb@metronet.com>
List: port-pc532
Date: 04/28/1999 18:17:19
From: Ian Dall <Ian.Dall@dsto.defence.gov.au>

> I have noticed that under egcs 1.0.2 I get a core dump with the following
> small program.

[ test source deleted ]

> An even simpler test to to compile
> 
> static int foo (void *p)
> {
>   return p == foo;
> }
> 
> with
> 
> cc -fpic -S
> 
> As far as I can tell, this has been fixed in later versions of egcs with
> no changes to the MD code in the compiler, hence it may be a MI problem.

On my machine, cc -v says:
gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)

I'm not sure if i'm running 1.4_BETA, but if I'm not, it's from a
build a few days before.  I'm sure it's after the 1.4_ALPHA build,
because I was worried that I might mess up my system to the point
that I couldn't do the BETA build. It was installed on Apr 14 18:58
so the sources were probably from a few days before...

Anyway, this produced the following on my machine:

#NO_APP
gcc2_compiled.:
___gnu_compiled_c:
.text
	.align 2
	.type	 _foo,@function
_foo:
	enter [],0
	sprd sb,tos
	addr __GLOBAL_OFFSET_TABLE_(pc),r0
	lprd sb,r0
	cmpd 8(fp),_foo(sb)
	seqd r1
	movd r1,r0
	br L1
	.align 2
L1:
	lprd sb,tos
	exit []
	ret 0
Lfe1:
	.size	 _foo,Lfe1-_foo