From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12623 invoked by alias); 22 Nov 2009 12:06:14 -0000 Received: (qmail 12603 invoked by uid 48); 22 Nov 2009 12:06:01 -0000 Date: Sun, 22 Nov 2009 12:06:00 -0000 Subject: [Bug c/42142] New: GCC 4.5 doesn't compile a certain quicksort implementation correctly when optimizing with -O1 or higher X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "maister at archlinux dot us" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-11/txt/msg01842.txt.bz2 I have a reproducible test case which shows that GCC 4.5 (20091112) doesn't compile a certain quicksort implementation correctly. It runs fine, but the sorting is plain wrong when trying to optimize with -O1 or higher. There might be something wrong with the quicksort implementation itself, but it compiles and runs fine when not optimizing anything with GCC 4.5. It also runs, and executes correctly on 4.3 and 4.4 with all optimizations applied. The code in question is here: http://pastebin.com/m270ad2a5 Output when compiling with gcc-4.5 -o qsort qsort.c -O http://pastebin.com/m44c8f6f2 Output with gcc-4.5 -o qsort qsort.c http://pastebin.com/m6ee486a0 Output with gcc-4.4 -o qsort qsort.c $CRAZYSTUFF_HERE http://pastebin.com/m78d55249 -- Summary: GCC 4.5 doesn't compile a certain quicksort implementation correctly when optimizing with -O1 or higher Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: maister at archlinux dot us GCC host triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42142