Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Mar 2008 04:58:01 -0700
From:      Jeremy Chadwick <koitsu@freebsd.org>
To:        Mikael Ikivesi <mikael.ikivesi@pp.inet.fi>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: gcc -O2 error
Message-ID:  <20080323115801.GA68873@eos.sc1.parodius.com>
In-Reply-To: <20080322192433.3719eb44@pp.inet.fi>
References:  <20080322192433.3719eb44@pp.inet.fi>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Mar 22, 2008 at 07:24:33PM +0200, Mikael Ikivesi wrote:
> #include <wchar.h>
> #include <stdio.h>
> 
> #define max_word_len    64
> 
> wchar_t *wrong(wchar_t *wordlist, wchar_t *word)
> {   wchar_t     buffer[max_word_len+2];
>     buffer[max_word_len+2]=0;
> 
> 	<STRIPPED PART>
> 
>     if(wcsstr(wordlist,buffer)==0) wcscpy(wordlist,buffer);
> 
> 	<STRIPPED PART>
> 
>     return wordlist;
> }

There's an off-by-one error in your code, which is very likely tickling
a bug in gcc.

That said, gcc shouldn't crash or be generating working code depending
upon which optimisation flags you use, so as Kris said, file a bug with
the gcc team for that.

-- 
| Jeremy Chadwick                                    jdc at parodius.com |
| Parodius Networking                           http://www.parodius.com/ |
| UNIX Systems Administrator                      Mountain View, CA, USA |
| Making life hard for others since 1977.                  PGP: 4BD6C0CB |




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080323115801.GA68873>