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

From Tom Lane
Subject Re: Re: Cygwin PostgreSQL CVS Patch Question
Date
Msg-id 7665.979083451@sss.pgh.pa.us
Whole thread Raw
In response to Re: Re: Cygwin PostgreSQL CVS Patch Question  (Jason Tishler <Jason.Tishler@dothill.com>)
Responses Re: Re: Cygwin PostgreSQL CVS Patch Question  (Jason Tishler <Jason.Tishler@dothill.com>)
List pgsql-ports
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.

            regards, tom lane

pgsql-ports by date:

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