Re: Re: Cygwin PostgreSQL CVS Patch Question - Mailing list pgsql-ports

From Jason Tishler
Subject Re: Re: Cygwin PostgreSQL CVS Patch Question
Date
Msg-id 20010109205441.D1364@dothill.com
Whole thread Raw
In response to Re: Re: Cygwin PostgreSQL CVS Patch Question  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Re: Cygwin PostgreSQL CVS Patch Question
List pgsql-ports
Tom,

On Tue, Jan 09, 2001 at 06:37:31PM -0500, Tom Lane wrote:
> Jason Tishler <Jason.Tishler@dothill.com> writes:
> >     extern int sys_nerr;
> >     int main() {
> >     int x = sys_nerr;
> >     ; return 0; }
>
> > The problem is gcc -O2 is being too smart, optimizing away the reference
> > to sys_nerr.
>
> Oh, that's nasty.  Try a test program like so:
>
>     extern int sys_nerr;
>     int my_nerr;
>     int main() {
>     my_nerr = sys_nerr;
>     return 0; }
>
> I don't think gcc will try to optimize away an assignment to a global
> variable.

You are correct -- the above program fails as expected.

Are you going to change config/c-library.m4 to generate the above
program instead?

Thanks,
Jason

--
Jason Tishler
Director, Software Engineering       Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corp.               Fax:   +1 (732) 264-8798
82 Bethany Road, Suite 7             Email: Jason.Tishler@dothill.com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

pgsql-ports by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: Cygwin PostgreSQL CVS Patch Question
Next
From: Tom Lane
Date:
Subject: Re: Re: Cygwin PostgreSQL CVS Patch Question