https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69318

            Bug ID: 69318
           Summary: [6 regression] ICE in symtab_node::verify with
                    -fabi-version=7 -Wabi=8 -m32
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

While testing the -fabi-version= and -Wabi options for a patch for bug 69277 I
came across the following ICE.  5.1.0 compiles the code successfully so I'm
marking this a regression.

For reference, the since resolved bug 65531 reported against 5.0 points out
another problem triggered by the function but for a different test case and
with slightly different symptoms and stack trace.

$ (f=/home/msebor/scm/fsf/gcc-svn/gcc/testsuite/g++.dg/abi/mangle-regparm.C;
cat $f && /home/msebor/build/gcc-trunk-svn/gcc/xg++
-B/home/msebor/build/gcc-trunk-svn/gcc -S -Wall -fabi-version=7 -Wabi=8 -m32 -o
/dev/null -xc++ $f)
// { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } }
// { dg-options "-Wabi=8 -save-temps" }
// { dg-final { scan-assembler
"_Z18IndirectExternCallIPU7stdcallU7regparmILi3EEFviiEiEvT_T0_S3_" } }

typedef __SIZE_TYPE__ size_t;

template <typename F, typename T>
void IndirectExternCall(F f, T t1, T t2) { // { dg-warning "mangled name" }
  typedef F (*WrapF)(F);
  f (t1, t2);
}

__attribute__((regparm(3), stdcall))
void regparm_func (int i, int j)
{
  if (i != 24 || j != 42)
    __builtin_abort();
}

void normal_func (int i, int j)
{
  if (i != 24 || j != 42)
    __builtin_abort();
}

int main()
{
  IndirectExternCall (regparm_func, 24, 42);
  IndirectExternCall (normal_func, 24, 42);
}
/home/msebor/scm/fsf/gcc-svn/gcc/testsuite/g++.dg/abi/mangle-regparm.C: In
function ‘void IndirectExternCall(F, T, T)’:
/home/msebor/scm/fsf/gcc-svn/gcc/testsuite/g++.dg/abi/mangle-regparm.C:9:15:
warning: typedef ‘WrapF’ locally defined but not used [-Wunused-local-typedef]
   typedef F (*WrapF)(F);
               ^~~~~

/home/msebor/scm/fsf/gcc-svn/gcc/testsuite/g++.dg/abi/mangle-regparm.C: At
global scope:
/home/msebor/scm/fsf/gcc-svn/gcc/testsuite/g++.dg/abi/mangle-regparm.C:30:1:
error: Two symbols with same comdat_group are not linked by the
same_comdat_group list.
 }
 ^

_Z18IndirectExternCallIPFviiEiEvT_T0_S3_/4 (void IndirectExternCall(F, T, T)
[with F = void (*)(int, int); T = int]) @0x7f0eb93585c0
  Type: function definition analyzed
  Visibility: public weak comdat
comdat_group:_Z18IndirectExternCallIPFviiEiEvT_T0_S3_ one_only
  previous sharing asm name: 3
  References: 
  Referring: 
  First run: 0
  Function flags: body
  Called by: main/2 (1.00 per call) (can throw external) 
  Calls: 
   Indirect call(1.00 per call) (can throw external) 
_Z18IndirectExternCallIPFviiEiEvT_T0_S3_/3 (void IndirectExternCall(F, T, T)
[with F = void (__attribute__((stdcall, regparm(3))) *)(int, int); T = int])
@0x7f0eb9358450
  Type: function definition analyzed
  Visibility: public weak comdat
comdat_group:_Z18IndirectExternCallIPFviiEiEvT_T0_S3_ one_only
  next sharing asm name: 4
  References: 
  Referring: 
  First run: 0
  Function flags: body
  Called by: main/2 (1.00 per call) (can throw external) 
  Calls: 
   Indirect call(1.00 per call) (can throw external) 
/home/msebor/scm/fsf/gcc-svn/gcc/testsuite/g++.dg/abi/mangle-regparm.C:30:1:
internal compiler error: symtab_node::verify failed
0xb5e535 symtab_node::verify_symtab_nodes()
        /home/msebor/scm/fsf/gcc-svn/gcc/symtab.c:1212
0xb7c4a0 symtab_node::checking_verify_symtab_nodes()
        /home/msebor/scm/fsf/gcc-svn/gcc/cgraph.h:602
0xb7bb4e symbol_table::compile()
        /home/msebor/scm/fsf/gcc-svn/gcc/cgraphunit.c:2371
0xb7bfb1 symbol_table::finalize_compilation_unit()
        /home/msebor/scm/fsf/gcc-svn/gcc/cgraphunit.c:2553
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Reply via email to