From owner-freebsd-stable@FreeBSD.ORG Sat Mar 22 18:34:26 2008 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43EBC106566B for ; Sat, 22 Mar 2008 18:34:26 +0000 (UTC) (envelope-from mikael.ikivesi@pp.inet.fi) Received: from pne-smtpout3-sn1.fre.skanova.net (pne-smtpout3-sn1.fre.skanova.net [81.228.11.120]) by mx1.freebsd.org (Postfix) with ESMTP id 11F228FC14 for ; Sat, 22 Mar 2008 18:34:25 +0000 (UTC) (envelope-from mikael.ikivesi@pp.inet.fi) Received: from localhost (80.221.11.59) by pne-smtpout3-sn1.fre.skanova.net (7.3.129) (authenticated as tansmi-f) id 47A788570028743C for freebsd-stable@freebsd.org; Sat, 22 Mar 2008 18:25:07 +0100 Date: Sat, 22 Mar 2008 19:24:33 +0200 From: Mikael Ikivesi To: freebsd-stable@freebsd.org Message-ID: <20080322192433.3719eb44@pp.inet.fi> X-Mailer: Claws Mail 3.3.0 (GTK+ 2.12.8; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: gcc -O2 error X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Mar 2008 18:34:26 -0000 Hi I am running uptodate RELENG_7. It has gcc (GCC) 4.2.1 20070719 [FreeBSD]. I tried to track down segfaults from my code and I accidentaly found a optimization error. Code did not segfault when compiled without optimization but crashed when -O2 was used. I tried to track it I could make the gcc give me following error by simply stripping few lines: ----------------------- wrong.c: In function 'wrong': wrong.c:11: error: Attempt to delete prologue/epilogue insn: (insn/f 47 46 48 2 (set (mem:SI (plus:SI (reg/f:SI 6 bp) (const_int -8 [0xfffffffffffffff8])) [0 S4 A8]) (reg:SI 3 bx)) -1 (nil) (nil)) wrong.c:11: internal compiler error: in propagate_one_insn, at flow.c:1735 Please submit a full bug report, with preprocessed source if appropriate. See for instructions. ------------------ And this is what triggers it: #include #include #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; if(wcsstr(wordlist,buffer)==0) wcscpy(wordlist,buffer); return wordlist; } -Mikael