public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/19340] New: Compilation SEGFAULTs with -O1 -fschedule-insns2 -fsched2-use-traces on an x86 architecture.
@ 2005-01-08 23:43 drab at kepler dot fjfi dot cvut dot cz
  2005-01-08 23:59 ` [Bug target/19340] " pinskia at gcc dot gnu dot org
  2005-08-18  2:03 ` drab at kepler dot fjfi dot cvut dot cz
  0 siblings, 2 replies; 11+ messages in thread
From: drab at kepler dot fjfi dot cvut dot cz @ 2005-01-08 23:43 UTC (permalink / raw)
  To: gcc-bugs

The following test code

-- test.c -------------------------------------
extern double f (double x);

double g (int a)
{
        int b, c, d, e = 0;
        double h;

        for (d = 0; d < a; d++)
                for (c = 0; c < a; c++)
                        b = 1;

        h = (double) e / (double) a;

        if (h)
        {
                h = 1.0 / h;
                h = f(h);
        }
        else
                h = 1.0;

        return h;
}
-----------------------------------------------

when compiled with

-----------------------------------------------
gcc -S -O1 -fschedule-insns2 -fsched2-use-traces test.c -o test.s
-----------------------------------------------

using the following GCC

-----------------------------------------------
$ gcc -v
Using built-in specs.
Configured with: ../../../gcc-CVS-20050107/gcc-CVS-20050107/configure
--host=i686-pc-linux-gnu --prefix=/usr/local/opt/gcc-4.0
--exec-prefix=/usr/local/opt/gcc-4.0 --sysconfdir=/etc
--libdir=/usr/local/opt/gcc-4.0/lib --libexecdir=/usr/local/opt/gcc-4.0/libexec
--sharedstatedir=/var --localstatedir=/var --program-suffix=-4.0
--with-x-includes=/usr/X11R6/include --with-x-libraries=/usr/X11R6/lib
--enable-shared --enable-static --with-gnu-as --with-gnu-ld --with-stabs
--enable-threads=posix --enable-version-specific-runtime-libs --disable-coverage
--enable-gather-detailed-mem-stats --disable-libgcj --disable-checking
--enable-multilib --with-x --enable-cmath --enable-libstdcxx-debug
--enable-fast-character --enable-hash-synchronization --with-system-zlib
--with-libbanshee --with-demangler-in-ld --with-arch=athlon-xp --enable-libada
--enable-languages=c,c++,f95,objc,ada
Thread model: posix
gcc version 4.0.0 20050107 (experimental)
$
-----------------------------------------------

(i.e., native gcc for the x86 architecture) SEGFAULTs in a following way:

-----------------------------------------------
$ gcc -v -S -O1 -fschedule-insns2 -fsched2-use-traces test.c -o test.s
Using built-in specs.
Configured with: ../../../gcc-CVS-20050107/gcc-CVS-20050107/configure
--host=i686-pc-linux-gnu --prefix=/usr/local/opt/gcc-4.0
--exec-prefix=/usr/local/opt/gcc-4.0 --sysconfdir=/etc
--libdir=/usr/local/opt/gcc-4.0/lib --libexecdir=/usr/local/opt/gcc-4.0/libexec
--sharedstatedir=/var --localstatedir=/var --program-suffix=-4.0
--with-x-includes=/usr/X11R6/include --with-x-libraries=/usr/X11R6/lib
--enable-shared --enable-static --with-gnu-as --with-gnu-ld --with-stabs
--enable-threads=posix --enable-version-specific-runtime-libs --disable-coverage
--enable-gather-detailed-mem-stats --disable-libgcj --disable-checking
--enable-multilib --with-x --enable-cmath --enable-libstdcxx-debug
--enable-fast-character --enable-hash-synchronization --with-system-zlib
--with-libbanshee --with-demangler-in-ld --with-arch=athlon-xp --enable-libada
--enable-languages=c,c++,f95,objc,ada
Thread model: posix
gcc version 4.0.0 20050107 (experimental)
 /usr/local/opt/gcc-4.0/libexec/gcc/i786-pc-linux-gnu/4.0.0/cc1 -quiet -v
-iprefix
/usr/local/opt/gcc-4.0/lib/gcc/i786-pc-linux-gnu/4.0.0/i786-pc-linux-gnu/4.0.0/
test.c -quiet -dumpbase test.c -march=athlon-xp -auxbase-strip test.s -O1
-version -fschedule-insns2 -fsched2-use-traces -o test.s
ignoring nonexistent directory
"/usr/local/opt/gcc-4.0/lib/gcc/i786-pc-linux-gnu/4.0.0/i786-pc-linux-gnu/4.0.0/include"
ignoring nonexistent directory
"/usr/local/opt/gcc-4.0/lib/gcc/i786-pc-linux-gnu/4.0.0/i786-pc-linux-gnu/4.0.0/../../../../i786-pc-linux-gnu/include"
ignoring nonexistent directory
"/usr/local/opt/gcc-4.0/lib/gcc/i786-pc-linux-gnu/4.0.0/../../../../i786-pc-linux-gnu/include"
ignoring duplicate directory "/usr/local/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory
"/usr/local/opt/gcc-4.0/lib/gcc/i786-pc-linux-gnu/4.0.0/include"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/opt/gcc-4.0/include
 /usr/local/opt/gcc-4.0/lib/gcc/i786-pc-linux-gnu/4.0.0/include
 /usr/include
End of search list.
GNU C version 4.0.0 20050107 (experimental) (i786-pc-linux-gnu)
        compiled by GNU C version 4.0.0 20050107 (experimental).
GGC heuristics: --param ggc-min-expand=90 --param ggc-min-heapsize=113230
test.c: In function 'g':
test.c:23: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
$
-----------------------------------------------

Following command lines (at least from those that I was testing) also segfault
the same way (don't know which ones are related and which ones could be
different bug ;):

-----------------------------------------------
gcc -S -O1 -fregmove -fschedule-insns2 -fsched2-use-traces -freorder-blocks
-freorder-blocks-and-partition test.c -o test.s
gcc -S -O2 -fregmove -fschedule-insns2 -fsched2-use-traces -freorder-blocks
-freorder-blocks-and-partition test.c -o test.s
gcc -S -O3 -fregmove -fschedule-insns2 -fsched2-use-traces -freorder-blocks
-freorder-blocks-and-partition test.c -o test.s
gcc -S -O1 -fregmove -fschedule-insns2 -fsched2-use-traces test.c -o test.s
gcc -S -O1 -fschedule-insns2 -fsched2-use-traces -freorder-blocks
-freorder-blocks-and-partition test.c -o test.s
gcc -S -O1 -fschedule-insns2 -fsched2-use-traces -freorder-blocks-and-partition
test.c -o test.s
-----------------------------------------------

Following command lines pass without a problem:

-----------------------------------------------
gcc -S -O1 -fregmove -fschedule-insns2 -fsched2-use-traces -freorder-blocks
test.c -o test.s
gcc -S -O1 -fregmove -fschedule-insns2 -fsched2-use-traces
-freorder-blocks-and-partition test.c -o test.s
gcc -S -O1 -fregmove -fschedule-insns2 -freorder-blocks
-freorder-blocks-and-partition test.c -o test.s
gcc -S -O1 -fregmove -fschedule-insns2 -freorder-blocks-and-partition test.c -o
test.s
gcc -S -O1 -fregmove -fschedule-insns2 test.c -o test.s
gcc -S -O1 -fregmove -fsched2-use-traces -freorder-blocks
-freorder-blocks-and-partition test.c -o test.s
gcc -S -O1 -fregmove -fsched2-use-traces -freorder-blocks-and-partition test.c
-o test.s
gcc -S -O1 -fregmove -fsched2-use-traces test.c -o test.s
-----------------------------------------------

(I hope it can help). However ALL of the above mentioned cases pass without a
problem on the following native x86_64 arch (same sources). compiler:

----------------------------------------------
$ gcc -v
Using built-in specs.
Configured with: ../../../gcc-CVS-20050107/gcc-CVS-20050107/configure
--host=x86_64-pc-linux-gnu --prefix=/usr/local/opt/gcc-4.0
--exec-prefix=/usr/local/opt/gcc-4.0 --sysconfdir=/etc
--libdir=/usr/local/opt/gcc-4.0/lib64
--libexecdir=/usr/local/opt/gcc-4.0/libexec64 --sharedstatedir=/var
--localstatedir=/var --program-suffix=-4.0 --with-x-includes=/usr/X11R6/include
--with-x-libraries=/usr/X11R6/lib64 --enable-shared --enable-static
--with-gnu-as --with-gnu-ld --with-stabs --enable-threads=posix
--enable-version-specific-runtime-libs --disable-coverage
--enable-gather-detailed-mem-stats --disable-libgcj --disable-checking
--enable-multilib --with-x --enable-cmath --enable-libstdcxx-debug
--enable-fast-character --enable-hash-synchronization --with-system-zlib
--with-libbanshee --with-demangler-in-ld --with-arch=athlon64 --disable-libada
--enable-languages=c,c++,f95,objc
Thread model: posix
gcc version 4.0.0 20050107 (experimental)
----------------------------------------------

Also removal of any part of the code within the g() function makes the code to
pass all the mentioned compilation command lines.

Here is the backtrace of the first mentioned command line:

----------------------------------------------
#0  stack_regs_mentioned_p (pat=0x9e8b3b5d) at
../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/reg-stack.c:279
#1  0x08297501 in stack_regs_mentioned_p (pat=Variable "pat" is not available.)
at ../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/reg-stack.c:293
#2  0x082974df in stack_regs_mentioned_p (pat=Variable "pat" is not available.)
at ../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/reg-stack.c:290
#3  0x08297598 in stack_regs_mentioned (insn=0xb7e0e258) at
../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/reg-stack.c:325
#4  0x08298195 in emit_swap_insn (insn=0xb7dffc64, regstack=Variable "regstack"
is not available.) at
../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/reg-stack.c:931
#5  0x08298d63 in change_stack (insn=0xb7dffc64, old=0xbfffe544, new=0x852d090,
where=EMIT_BEFORE) at
../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/reg-stack.c:2523
#6  0x0829a9bb in compensate_edge (e=0xb7df2488, file=0x0) at
../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/reg-stack.c:2780
#7  0x0829b103 in convert_regs_2 (file=0x0, block=Variable "block" is not
available.) at ../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/reg-stack.c:2985
#8  0x0829b6f3 in reg_to_stack (file=0x0) at
../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/reg-stack.c:3082
#9  0x082ede67 in rest_of_compilation () at
../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/passes.c:381
#10 0x0809f974 in execute_pass_list (pass=0x843fc20) at
../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/tree-optimize.c:526
#11 0x0809fc12 in tree_rest_of_compilation (fndecl=0xb7df1288) at
../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/tree-optimize.c:662
#12 0x0805ab96 in c_expand_body (fndecl=0xb7df1288) at
../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/c-decl.c:6424
#13 0x08311a5c in cgraph_expand_function (node=0xb7df1948) at
../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/cgraphunit.c:822
#14 0x08311b00 in cgraph_assemble_pending_functions () at
../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/cgraphunit.c:305
#15 0x08312058 in cgraph_finalize_function (decl=0xb7df1288, nested=0 '\0') at
../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/cgraphunit.c:388
#16 0x0805ae5b in finish_function () at
../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/c-decl.c:6396
#17 0x0804e497 in yyparse () at c-parse.y:401
#18 0x0804fc28 in c_parse_file () at c-parse.y:2936
#19 0x08083615 in c_common_parse_file (set_yydebug=-1635042467) at
../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/c-opts.c:1092
#20 0x082d3ef5 in toplev_main (argc=2659924829, argv=0xbffff144) at
../../../../gcc-CVS-20050107/gcc-CVS-20050107/gcc/toplev.c:996
#21 0xb7eb8ea0 in __libc_start_main (main=0x8091120 <main>, argc=16,
ubp_av=0xbffff144, init=0x83a3cc0 <__libc_csu_init>, fini=0xbffff0d0,
rtld_fini=0xbffff144, stack_end=0xbffff13c)
               at ../sysdeps/generic/libc-start.c:209
#22 0x08049aa1 in _start () at ../sysdeps/i386/elf/start.S:102
----------------------------------------------

-- 
           Summary: Compilation SEGFAULTs with -O1 -fschedule-insns2 -
                    fsched2-use-traces on an x86 architecture.
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P1
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: drab at kepler dot fjfi dot cvut dot cz
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 11+ messages in thread
[parent not found: <bug-19340-8902@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2005-11-11  8:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-08 23:43 [Bug target/19340] New: Compilation SEGFAULTs with -O1 -fschedule-insns2 -fsched2-use-traces on an x86 architecture drab at kepler dot fjfi dot cvut dot cz
2005-01-08 23:59 ` [Bug target/19340] " pinskia at gcc dot gnu dot org
2005-08-18  2:03 ` drab at kepler dot fjfi dot cvut dot cz
     [not found] <bug-19340-8902@http.gcc.gnu.org/bugzilla/>
2005-11-04 15:32 ` pinskia at gcc dot gnu dot org
2005-11-07 13:20 ` uros at kss-loka dot si
2005-11-08  6:21 ` uros at gcc dot gnu dot org
2005-11-08  7:59 ` uros at gcc dot gnu dot org
2005-11-08  8:12 ` uros at kss-loka dot si
2005-11-10  7:27 ` uros at gcc dot gnu dot org
2005-11-10  7:33 ` uros at kss-loka dot si
2005-11-11  8:20 ` uros at kss-loka dot si

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).