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



             Bug #: 55531

           Summary: peephole2 pattern with multiple insns with

                    match_parallel insn causes corrupted peephole2_insns

                    matching function

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: rtl-optimization

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: amyl...@gcc.gnu.org





Created attachment 28828

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28828

Preprocessed compatibility-atomic-c++0x.cc sources



with epiphany.md updated to r193918, libstdc++-v3 cannot be built:



[amylaar@rowan gcc]$ gdb --args  ./cc1plus -fpreprocessed

compatibility-atomic-c++0x.ii -quiet -dumpbase compatibility-atomic-c++0x.cc

-auxbase-strip compatibility-atomic-c++0x.o -g -O2 -Wall -Wextra

-Wwrite-strings -Wcast-qual -Wabi -std=gnu++11 -version -fno-implicit-templates

-fdiagnostics-show-location=once -ffunction-sections -fdata-sections

-frandom-seed=compatibility-atomic-c++0x.lo -ffixed-r40 -ffixed-r41 -ffixed-r42

-ffixed-r43 -o compatibility-atomic-c++0x.s

GNU gdb (GDB) Fedora (7.4.50.20120120-52.fc17)

Copyright (C) 2012 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.  Type "show copying"

and "show warranty" for details.

This GDB was configured as "i686-redhat-linux-gnu".

For bug reporting instructions, please see:

<http://www.gnu.org/software/gdb/bugs/>...

Reading symbols from /ssd/fsf/bld-epiphany/gcc/cc1plus...done.

Breakpoint 1 at 0x8a496f0: file ../../gcc/gcc/diagnostic.c, line 1145.

Breakpoint 2 at 0x8a4a7b0: file ../../gcc/gcc/diagnostic.c, line 1086.

Breakpoint 3 at 0x80d5d60

Breakpoint 4 at 0x80d6000

File ../../gcc/gcc/tree.h will be skipped when stepping.

(gdb) run

Starting program: /ssd/fsf/bld-epiphany/gcc/cc1plus -fpreprocessed

compatibility-atomic-c++0x.ii -quiet -dumpbase compatibility-atomic-c++0x.cc

-auxbase-strip compatibility-atomic-c++0x.o -g -O2 -Wall -Wextra

-Wwrite-strings -Wcast-qual -Wabi -std=gnu++11 -version -fno-implicit-templates

-fdiagnostics-show-location=once -ffunction-sections -fdata-sections

-frandom-seed=compatibility-atomic-c++0x.lo -ffixed-r40 -ffixed-r41 -ffixed-r42

-ffixed-r43 -o compatibility-atomic-c++0x.s

GNU C++ (GCC) version 4.8.0 20121129 (experimental) (epiphany-elf)

        compiled by GNU C version 4.8.0 20121026 (experimental), GMP version

5.0.2, MPFR version 3.1.0, MPC version 0.9

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096

GNU C++ (GCC) version 4.8.0 20121129 (experimental) (epiphany-elf)

        compiled by GNU C version 4.8.0 20121026 (experimental), GMP version

5.0.2, MPFR version 3.1.0, MPC version 0.9

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096

Compiler executable checksum: 491116e46d28e8306598e4f5150354ea



Program received signal SIGSEGV, Segmentation fault.

0x08958647 in peephole2_insns (x0=0xb6efdab0, insn=0xb6c187bc,

_pmatch_len=0xbfffe908) at ../../gcc/gcc/config/epiphany/epiphany.md:566

566                       (match_operand:SI 2 "arith_operand" "rL")))

(gdb) call debug_rtx(x0)

(parallel [

        (asm_operands/v ("") ("") 0 []

             []

             [] (null):0)

        (clobber (mem:BLK (scratch) [0 A8]))

    ])

(gdb) call debug_rtx(x1)

(return)



The line allegedly from epiphany.md:566 is actually this line in insn-recog.c:

  if (XVECLEN (x1, 0) >= 2

from the code generated for the peephole pattern in lines 1028..1034

of epiphany.md.



Here is a bit more context:



 L1407: ATTRIBUTE_UNUSED_LABEL

  x1 = XVECEXP (x0, 0, 0);

  operands[6] = x1;

  goto L1408;



 L1408: ATTRIBUTE_UNUSED_LABEL

  tem = peep2_next_insn (1);

  x1 = PATTERN (tem);

  if (XVECLEN (x1, 0) >= 2

      && float_operation (x1, VOIDmode))

    {

      operands[3] = x1;

      goto L1409;

    }

  goto L1540;



Note that XVECLEN (x1, 0) >= 2 is evaluated without checking first that

x1 is a PARALLEL.



I have attached preprocessed compatibility-atomic-c++0x.cc so that you merely

need cc1plus to reproducei the problem.



I have used the configure options

--target=epiphany-elf --enable-languages=c,c++ --enable-werror-always

and the Makefile target 'all-gcc'

Reply via email to