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

            Bug ID: 59627
           Summary: ICE with OpenMP "declare reduction" and -flto
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following valid code snippet (compiled with "-fopenmp -flto")
triggers an ICE on trunk since 2013-10-11:

==============================================================
struct A { int i; };

void foo()
{
  A a;
  #pragma omp declare reduction (+: A: omp_out.i += omp_in.i)
  #pragma omp parallel reduction (+: a)
  ;
}
==============================================================

bug.cc:6:11: internal compiler error: in discriminator_for_local_entity, at
cp/mangle.c:1745
   #pragma omp declare reduction (+: A: omp_out.i += omp_in.i)
           ^
0x73a658 discriminator_for_local_entity
        ../../gcc/gcc/cp/mangle.c:1745
0x73a658 write_local_name
        ../../gcc/gcc/cp/mangle.c:1833
0x73a658 write_name
        ../../gcc/gcc/cp/mangle.c:847
0x73a92b write_encoding
        ../../gcc/gcc/cp/mangle.c:714
0x743398 mangle_decl_string
        ../../gcc/gcc/cp/mangle.c:3433
0x743577 get_mangled_id
        ../../gcc/gcc/cp/mangle.c:3455
0x743577 mangle_decl(tree_node*)
        ../../gcc/gcc/cp/mangle.c:3478
0xd91200 decl_assembler_name(tree_node*)
        ../../gcc/gcc/tree.c:600
0xd92c46 assign_assembler_name_if_neeeded(tree_node*)
        ../../gcc/gcc/tree.c:5505
0xdacf2e free_lang_data_in_cgraph
        ../../gcc/gcc/tree.c:5560
0xdacf2e free_lang_data
        ../../gcc/gcc/tree.c:5597
0xdacf2e execute
        ../../gcc/gcc/tree.c:5646
Please submit a full bug report, [etc.]

Jakub, this appeared right after your big OpenMP 4.0 patch
(where "omp declare reduction" was introduced):

2013-10-11  Jakub Jelinek  <ja...@redhat.com>

    * decl.c (duplicate_decls): Error out for redeclaration of UDRs.
    (declare_simd_adjust_this): New function.
    (grokfndecl): If "omp declare simd" attribute is present,
    call declare_simd_adjust_this if needed and
    c_omp_declare_simd_clauses_to_numbers.
        [...]

Would you mind having a look?

Reply via email to