1.7: gcc 3.4.4 optimization bug ?

Peter Rosin peda@lysator.liu.se
Sat Dec 26 22:24:00 GMT 2009


Den 2009-12-26 18:45 skrev Kiran Prakash:
> Hi,
> 
> I just recently ugraded to cygwin 1.7
> 
> I was modifying iftop to work on cygwin, when I ran into this little bug.
> I'm generally not so quick to blame the compiler, but I can't find any
> other explanation.
> 
> 
> char *tmp, options.interface;
> 
> The following works.
> 
>    if (options.interface[0]=='{')
>      {
>     tmp=xmalloc( 32+strlen(options.interface) );
>     tmp="\\Device\\NPF_";

You need strcpy(tmp, "\\Device\\NPF_") instead of the assignment.

>     strcat(tmp, options.interface);
>     xfree(options.interface);
>     options.interface=tmp;
>      }
>    fprintf(stderr, "opening interface:%s\n", options.interface);
> 
> This does not.
> 
>    if (options.interface[0]=='{')
>      {
>     tmp=xmalloc( 32+strlen(options.interface) );
>     tmp="\\Device\\NPF_";

Ditto.

>     strcat(tmp, options.interface);
>     xfree(options.interface);
>     options.interface=tmp;
>      }
>    fprintf(stderr, "opening interface:%s\n", tmp);
> 
> command line is gcc  -g -O2   -L/usr/lib -o iftop.exe ....
> 
> Certainly looks like an optimization problem.

Nope.

> Also, is gcc 3.4.4 supported on cygwin 1.7 at all ?

Don't know.

Cheers,
Peter


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list