From owner-freebsd-bugs@FreeBSD.ORG Tue Mar 13 12:46:02 2007 Return-Path: X-Original-To: bugs@freebsd.org Delivered-To: freebsd-bugs@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 691E416A400 for ; Tue, 13 Mar 2007 12:46:02 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id EDDB713C458 for ; Tue, 13 Mar 2007 12:46:01 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.13.8/8.13.8) with ESMTP id l2DCWv3N096889 for ; Tue, 13 Mar 2007 15:32:57 +0300 (MSK) (envelope-from ache@nagual.pp.ru) Received: (from ache@localhost) by nagual.pp.ru (8.13.8/8.13.8/Submit) id l2DCWvLH096888 for bugs@freebsd.org; Tue, 13 Mar 2007 15:32:57 +0300 (MSK) (envelope-from ache) Resent-From: ache@nagual.pp.ru Resent-Date: Tue, 13 Mar 2007 15:32:56 +0300 Resent-Message-ID: <20070313123256.GA96813@nagual.pp.ru> Resent-To: bugs@freebsd.org X-Bogosity: Ham, spamicity=0.000000 Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53]) by nagual.pp.ru (8.13.8/8.13.8) with ESMTP id l2DCCFSh096491 for ; Tue, 13 Mar 2007 15:12:22 +0300 (MSK) (envelope-from owner-freebsd-current@freebsd.org) Authentication-Results: nagual.pp.ru sender=owner-freebsd-current@freebsd.org; sender-id=pass; spf=pass Received: from hub.freebsd.org (hub.freebsd.org [69.147.83.54]) by mx2.freebsd.org (Postfix) with ESMTP id AB9272EC99 for ; Tue, 13 Mar 2007 12:11:17 +0000 (UTC) (envelope-from owner-freebsd-current@freebsd.org) Received: by hub.freebsd.org (Postfix) id A634616A418; Tue, 13 Mar 2007 12:11:17 +0000 (UTC) Delivered-To: ache@freebsd.org Received: from hub.freebsd.org (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 787A416A414; Tue, 13 Mar 2007 12:11:16 +0000 (UTC) (envelope-from owner-freebsd-current@freebsd.org) X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1D43816A401 for ; Tue, 13 Mar 2007 12:11:10 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id 924AC13C44B for ; Tue, 13 Mar 2007 12:11:09 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.13.8/8.13.8) with ESMTP id l2DCB8Bl096455 for ; Tue, 13 Mar 2007 15:11:08 +0300 (MSK) (envelope-from ache@nagual.pp.ru) Received: (from ache@localhost) by nagual.pp.ru (8.13.8/8.13.8/Submit) id l2DCB8pN096454 for current@freebsd.org; Tue, 13 Mar 2007 15:11:08 +0300 (MSK) (envelope-from ache) Date: Tue, 13 Mar 2007 15:11:07 +0300 From: Andrey Chernov To: current@freebsd.org Message-ID: <20070313121106.GA96293@nagual.pp.ru> Mail-Followup-To: Andrey Chernov , current@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.14 (2007-02-12) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Sender: owner-freebsd-current@freebsd.org Errors-To: owner-freebsd-current@freebsd.org Cc: Subject: Bad gcc -O optimization cause core dump. What to do? X-BeenThere: freebsd-bugs@freebsd.org List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Mar 2007 12:46:02 -0000 Copy the segment below to the file a.c ---------------------- cut me here --------------------- #include main() { printf("%s\n", NULL); } ---------------------- cut me here --------------------- Compile first as cc a.c ./a.out got (null) Then compile as cc -O a.c ./a.out got core dump. Lets see assembler output from cc -O -S a.c .file "a.c" .text .p2align 2,,3 .globl main .type main, @function main: pushl %ebp movl %esp, %ebp subl $8, %esp andl $-16, %esp subl $28, %esp pushl $0 call puts leave ret .size main, .-main .ident "GCC: (GNU) 3.4.6 [FreeBSD] 20060825" It calls "puts(NULL)" with core dump. It means "printf("%s\n", NULL)" is overoptimized. BTW, things like "printf("1%s\n", NULL)" are not overoptimized. Any ideas? Is it right or needs to be fixed? -- http://ache.pp.ru/ _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"