In my program I use recursive quick-sort, which is apparently miscompiled by my
gcc (Fedora 8, x86_64), when I use -O3 or -O2 -finline-functions. With these
options, the data get out of the qsort routine only partially sorted. With -O2
it is OK, and when I add a debugging printf() at the end of the qsort routine
(thus disabling the tail-call recursion), it also works (even with -O3 or -O2
-finline-functions).

The test program is at http://www.fi.muni.cz/~kas/data/sorttest.c - try to
compile it and run on 64-bit x86_64 system (it is non-portable, but it is a
design decision) with -O2 and with -O3. Then uncomment the debugging code
near the end of the file, and try it again.


-- 
           Summary: -finline-functions miscompiles tail recursion
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kas at fi dot muni dot cz
 GCC build triplet: x86_64-redhat-linux
  GCC host triplet: x86_64-redhat-linux
GCC target triplet: x86_64-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36082

Reply via email to