[Bug c++/57845] New: ICE with -freg-struct-return on Sparc target

2013-07-07 Thread adam at os dot inf.tu-dresden.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57845

Bug ID: 57845
   Summary: ICE with -freg-struct-return on Sparc target
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: adam at os dot inf.tu-dresden.de
  Host: x86_64
Target: sparc

The following code produces an ICE for a Sparc target, with 4.9.0. Also tested
4.7.4 and 4.8.2 with same result. No ICE for target x86 for any version tested.
No ICE with-freg-struct-return removed.

class foo
{
public:
  struct r { };
};

class c
{ 
  foo::r func(foo::r);
};

foo::r c::func(foo::r x)
{
  return x;
}

$ sparc-linux-g++ -m32 -c  -freg-struct-return  x.i
x.i: In member function ‘foo::r c::func(foo::r)’:
x.i:15:10: internal compiler error: in emit_move_insn, at expr.c:3486
   return x;
  ^
0x85ba84 emit_move_insn(rtx_def*, rtx_def*)
/tmp/gcc/head/gcc/gcc/expr.c:3485
0xa80620 expand_value_return
/tmp/gcc/head/gcc/gcc/stmt.c:1460
0x78f5f1 expand_gimple_stmt_1
/tmp/gcc/head/gcc/gcc/cfgexpand.c:2248
0x78f5f1 expand_gimple_stmt
/tmp/gcc/head/gcc/gcc/cfgexpand.c:2370
0x7910a7 expand_gimple_basic_block
/tmp/gcc/head/gcc/gcc/cfgexpand.c:4204
0x793806 gimple_expand_cfg
/tmp/gcc/head/gcc/gcc/cfgexpand.c:4723
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.


Adam

[Bug middle-end/83764] internal compiler error: in gimple_get_virt_method_for_vtable

2018-01-10 Thread adam at os dot inf.tu-dresden.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83764

Adam Lackorzynski  changed:

   What|Removed |Added

 CC||adam at os dot 
inf.tu-dresden.de

--- Comment #3 from Adam Lackorzynski  ---
This is a duplicate of #81702, which has already been fixed.

[Bug c++/81702] New: ICE in gimple_get_virt_method_for_vtable

2017-08-03 Thread adam at os dot inf.tu-dresden.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81702

Bug ID: 81702
   Summary: ICE in gimple_get_virt_method_for_vtable
   Product: gcc
   Version: 7.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: adam at os dot inf.tu-dresden.de
  Target Milestone: ---

Created attachment 41918
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41918&action=edit
Code triggering the ICE

With the following reduced code I'm getting an ICE in gcc-7 and gcc-8. Only
happens with -O2.

$ g++
g++ (GCC) 7.1.1 20170803

$ g++ -c -O2 -std=gnu++11 t.i
t.i:107:33: internal compiler error: in gimple_get_virt_method_for_vtable, at
gimple-fold.c:6442
 Resource_factory_t _x;
 ^
0x8c4684 gimple_get_virt_method_for_vtable(long, tree_node*, unsigned long,
bool*)
../../gcc/gcc/gimple-fold.c:6442
0x111c8c4 ipa_get_indirect_edge_target_1
../../gcc/gcc/ipa-cp.c:2411
0x93b054 estimate_edge_devirt_benefit
../../gcc/gcc/ipa-inline-analysis.c:3141
0x93b3cb estimate_edge_size_and_time
../../gcc/gcc/ipa-inline-analysis.c:3182
0x93b3cb estimate_calls_size_and_time
../../gcc/gcc/ipa-inline-analysis.c:3254
0x93b688 estimate_node_size_and_time
../../gcc/gcc/ipa-inline-analysis.c:3352
0x93ce03 do_estimate_edge_size(cgraph_edge*)
../../gcc/gcc/ipa-inline-analysis.c:3910
0x93d07f estimate_edge_size
../../gcc/gcc/ipa-inline.h:297
0x93d07f estimate_edge_growth
../../gcc/gcc/ipa-inline.h:308
0x93d07f do_estimate_growth_1
../../gcc/gcc/ipa-inline-analysis.c:4030
0x93d0c5 cgraph_node::call_for_symbol_and_aliases(bool (*)(cgraph_node*,
void*), void*, bool)
../../gcc/gcc/cgraph.h:3150
0x93d0c5 estimate_growth(cgraph_node*)
../../gcc/gcc/ipa-inline-analysis.c:4044
0x11359e9 inline_small_functions
../../gcc/gcc/ipa-inline.c:1764
0x11359e9 ipa_inline
../../gcc/gcc/ipa-inline.c:2434
0x11359e9 execute
../../gcc/gcc/ipa-inline.c:2845
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Adding code as attachment as reducing it more shows to be tricky.

[Bug c++/81702] [7/8 Regression] ICE in gimple_get_virt_method_for_vtable

2017-10-29 Thread adam at os dot inf.tu-dresden.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81702

--- Comment #6 from Adam Lackorzynski  ---
So assuming removing the assert is ok, the following would address it:

--- gimple-fold.c   (revision 254205)
+++ gimple-fold.c   (working copy)
@@ -6439,7 +6439,6 @@
   gcc_assert (init);
   if (init == error_mark_node)
 {
-  gcc_assert (in_lto_p);
   /* Pass down that we lost track of the target.  */
   if (can_refer)
*can_refer = false;

Do you think this could be applied?

[Bug inline-asm/66274] New: gcc6: x86 -m32 emits 64bit register in inline asm

2015-05-24 Thread adam at os dot inf.tu-dresden.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66274

Bug ID: 66274
   Summary: gcc6: x86 -m32 emits 64bit register in inline asm
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: inline-asm
  Assignee: unassigned at gcc dot gnu.org
  Reporter: adam at os dot inf.tu-dresden.de
  Target Milestone: ---

The following reduced test-case:

void f()
{
  asm ("push %0" : : "r" ((unsigned long long)456 >> 32));
}

produces:

$ gcc -c -m32 t.i
t.i: Assembler messages:
t.i:3: Error: bad register name `%rax'
$ gcc --version
gcc (GCC) 6.0.0 20150524 (experimental)

Works with gcc-5 and previous versions.


[Bug c++/68359] New: ice: tree check: expected integer_cst, have nop_expr in get_len

2015-11-15 Thread adam at os dot inf.tu-dresden.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68359

Bug ID: 68359
   Summary: ice: tree check: expected integer_cst, have nop_expr
in get_len
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: adam at os dot inf.tu-dresden.de
  Target Milestone: ---

With gcc version 6.0.0 20151115 (experimental) (GCC), x86_64:

$ cat t.i
struct G {};
struct L
{
  enum class T { S } t;
  G f() const
  {
switch (t)
  {
  case T::S: return G();
  }
  }
};
$ g++ -c t.i
t.i: In member function ‘G L::f() const’:
t.i:10:15: internal compiler error: tree check: expected integer_cst, have
nop_expr in get_len, at tree.h:5167
   case T::S: return G();
   ^

0xf534ec tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc/gcc/tree.c:9587
0x8502b8 tree_check(tree_node const*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:3212
0x8502b8 wi::extended_tree<192>::get_len() const
../../gcc/gcc/tree.h:5167
0x8502b8 wi::int_traits >
>::decompose(long*, unsigned int, generic_wide_int >
const&)
../../gcc/gcc/wide-int.h:898
0x8502b8
wide_int_ref_storage::wide_int_ref_storage
> >(generic_wide_int > const&, unsigned int)
../../gcc/gcc/wide-int.h:945
0x8502b8 generic_wide_int
>::generic_wide_int >
>(generic_wide_int > const&, unsigned int)
../../gcc/gcc/wide-int.h:722
0x8502b8 int wi::cmps >,
generic_wide_int >
>(generic_wide_int > const&,
generic_wide_int > const&)
../../gcc/gcc/wide-int.h:1900
0x8502b8 tree_int_cst_compare(tree_node const*, tree_node const*)
../../gcc/gcc/tree.h:5236
0x8502b8 c_add_case_label(unsigned int, splay_tree_s*, tree_node*, tree_node*,
tree_node*, tree_node*, bool*)
../../gcc/gcc/c-family/c-common.c:6633
0x5f07e3 finish_case_label(unsigned int, tree_node*, tree_node*)
../../gcc/gcc/cp/decl.c:3417
0x6fec62 cp_parser_label_for_labeled_statement
../../gcc/gcc/cp/parser.c:10259
0x711c00 cp_parser_statement
../../gcc/gcc/cp/parser.c:10132
0x712fc1 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:10456
0x7130c3 cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:10410
0x71a8fd cp_parser_implicitly_scoped_statement
../../gcc/gcc/cp/parser.c:11550
0x712404 cp_parser_selection_statement
../../gcc/gcc/cp/parser.c:10632
0x712404 cp_parser_statement
../../gcc/gcc/cp/parser.c:10040
0x712fc1 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:10456
0x7130c3 cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:10410
0x713250 cp_parser_function_body
../../gcc/gcc/cp/parser.c:20225
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.


The ICE goes away when removing the 'const'.
The code works/compiles with gcc <= 5 and with gcc6 about a week old.

[Bug middle-end/66214] [6 Regression] ICE verify_type failed with -O0 -g via gen_type_die_with_usage's dwarf2out.c:20250

2015-11-19 Thread adam at os dot inf.tu-dresden.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66214

Adam Lackorzynski  changed:

   What|Removed |Added

 CC||adam at os dot 
inf.tu-dresden.de

--- Comment #25 from Adam Lackorzynski  ---
I've also came across this ICE, with this reduced testcase:

template< typename C > class Dl
{
  class __ii { };
  typedef __ii It;
  It ii(typename C::I *e) { return It(e); }
};

template class X1 { typename E::L foo; };

struct M
{
  struct CO { typedef M I; };
  enum Type { };
  typedef Dl L;
  Type t;
  struct R { X1 f; };
};

With: gcc version 6.0.0 20151119 (experimental) (GCC) 

t.i: In instantiation of ‘class Dl’:
t.i:8:47:   required from ‘class X1’
t.i:16:20:   required from here
t.i:1:30: error: TYPE_CANONICAL is not compatible
 template< typename C > class Dl
  ^~

 
asm_written unsigned SI
size 
unit size 
align 32 symtab -862572224 alias set -1 canonical type
0x7f1ccca8c348 precision 32 min  max  context 
chain >
decl_3 VOID file t.i line 15 col 8
align 1 offset_align 1 context 
chain 
used nonlocal decl_4 VOID file t.i line 11 col 1
align 1 context  result 
chain >> context

full-name "struct M"
n_parents=0 use_template=0 interface-unknown
pointer_to_this  chain >
 
full-name "struct M"
n_parents=0 use_template=0 interface-unknown
chain >
used nonlocal decl_4 VOID file t.i line 11 col 1
align 1 context 
result  context

full-name "struct M"
n_parents=0 use_template=0 interface-unknown
pointer_to_this  chain >

chain 
public decl_2 VOID file t.i line 12 col 10
align 8 context  chain >> context 
full-name "M::CO::I"
n_parents=0 use_template=0 interface-unknown
pointer_to_this  chain >
t.i:1:30: internal compiler error: verify_type failed
0xf75d1c verify_type(tree_node const*)
../../gcc/gcc/tree.c:13818
0x991de4 gen_type_die_with_usage
../../gcc/gcc/dwarf2out.c:20739
0x992428 gen_type_die_with_usage
../../gcc/gcc/dwarf2out.c:20836
0x9932e6 gen_type_die
../../gcc/gcc/dwarf2out.c:20932
0x99efb7 gen_formal_types_die
../../gcc/gcc/dwarf2out.c:18283
0x9978b5 gen_subprogram_die
../../gcc/gcc/dwarf2out.c:19141
0x9996ac gen_decl_die
../../gcc/gcc/dwarf2out.c:21496
0x994563 gen_member_die
../../gcc/gcc/dwarf2out.c:20432
0x994563 gen_struct_or_union_type_die
../../gcc/gcc/dwarf2out.c:20516
0x994563 gen_tagged_type_die
../../gcc/gcc/dwarf2out.c:20717
0x99278d gen_type_die_with_usage
../../gcc/gcc/dwarf2out.c:20877
0x9932e6 gen_type_die
../../gcc/gcc/dwarf2out.c:20932
0x999c71 gen_decl_die
../../gcc/gcc/dwarf2out.c:21519
0x99a6bc dwarf2out_decl
../../gcc/gcc/dwarf2out.c:21974
0x99a9fb dwarf2out_type_decl
../../gcc/gcc/dwarf2out.c:21684
0xc0175f rest_of_type_compilation(tree_node*, int)
../../gcc/gcc/passes.c:335
0x6b0956 finish_struct_1(tree_node*)
../../gcc/gcc/cp/class.c:6776
0x67ff9b instantiate_class_template_1
../../gcc/gcc/cp/pt.c:10198
0x67ff9b instantiate_class_template(tree_node*)
../../gcc/gcc/cp/pt.c:10238
0x723f4b complete_type(tree_node*)
../../gcc/gcc/cp/typeck.c:131
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.

[Bug c++/63649] New: 5.0: ICE with init_priority

2014-10-26 Thread adam at os dot inf.tu-dresden.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63649

Bug ID: 63649
   Summary: 5.0: ICE with init_priority
   Product: gcc
   Version: 5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: adam at os dot inf.tu-dresden.de

The following code causes an ICE:

struct Per_cpu_ctor_data
{
  typedef void (*Func)();
  Per_cpu_ctor_data() = default;
  void *_base;
};

class Per_cpu_data
{
private:
  typedef Per_cpu_ctor_data Ctor;
  struct Ctor_vector { void push_back(Ctor::Func func); };
  static Ctor_vector ctors;
};

template< typename T >
class Per_cpu : private Per_cpu_data
{
public:
  typedef T Type;
  Per_cpu();
  static void f1();
};

template< typename T > Per_cpu::Per_cpu() { ctors.push_back(&f1); }
template< typename T > void Per_cpu::f1() {}

class A { static Per_cpu a; };

static Per_cpu_ctor_data __b;
__attribute__((init_priority(0xfffe))) Per_cpu A::a;

$ g++ --version
g++ (GCC) 5.0.0 20141026 (experimental)
$ uname -m
x86_64
$ g++ -c -std=c++0x -O1 t.i
mem_space.i:31:59: internal compiler error: Segmentation fault
 __attribute__((init_priority(0xfffe))) Per_cpu A::a;
   ^
0xc022af crash_signal
../../gcc/gcc/toplev.c:349
0x11df22c ipa_comdats
../../gcc/gcc/ipa-comdats.c:330
0x11df22c execute
../../gcc/gcc/ipa-comdats.c:371
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.

I could not reduce the testcase more as the segfault would not happen.
The segfault also does not happen with -O0, and it also does not happen with
init_priority 0x.
Code compiles with gcc <= 4.9.


[Bug target/36722] ICE with inline asm in 64bit mode because of type size

2014-10-26 Thread adam at os dot inf.tu-dresden.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36722

Adam Lackorzynski  changed:

   What|Removed |Added

 CC||adam at os dot 
inf.tu-dresden.de
  Known to work||4.5.4, 4.6.4, 4.7.4, 4.8.4,
   ||4.9.2, 5.0
  Known to fail||

--- Comment #5 from Adam Lackorzynski  ---
Cannot reproduce with 4.5 and later.


[Bug c++/33661] template methods forget explicit local reg vars

2014-10-26 Thread adam at os dot inf.tu-dresden.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33661

--- Comment #11 from Adam Lackorzynski  ---
Confirming issue still exists for 4.7.4, 4.8.4, 4.9.2 and 5.0 (tested on
x86_64).


[Bug ipa/63649] [5 Regression] ICE: Segmentation fault in gcc/ipa-comdats.c:332

2014-10-31 Thread adam at os dot inf.tu-dresden.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63649

--- Comment #3 from Adam Lackorzynski  ---
Thanks, seems to fix the issue for me.


[Bug c++/64353] New: ICE: in execute_todo, at passes.c:1986

2014-12-18 Thread adam at os dot inf.tu-dresden.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64353

Bug ID: 64353
   Summary: ICE: in execute_todo, at passes.c:1986
   Product: gcc
   Version: 5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: adam at os dot inf.tu-dresden.de

The following code generates an ICE:

class C 
{
  int y, x;
  void i();
  bool __attribute__((const)) xx() { return x; }
};

void C::i()
{
  if (xx())
x = 1;
}

$ g++ -c -O2 t.i
t.i: In member function ‘void C::i()’:
t.i:12:1: internal compiler error: in execute_todo, at passes.c:1986
 }
 ^
0xbc7b28 execute_todo
../../gcc/gcc/passes.c:1986
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.

$ g++ --version
g++ (GCC) 5.0.0 20141218 (experimental)

Admittedly the attribute((const)) should not be there. Also, removing 'y' will
also not emit an ICE.

[Bug ipa/64068] [5 Regression] ICE: in remove_unreachable_nodes, at ipa.c:546

2014-12-20 Thread adam at os dot inf.tu-dresden.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64068

Adam Lackorzynski  changed:

   What|Removed |Added

 CC||adam at os dot 
inf.tu-dresden.de

--- Comment #4 from Adam Lackorzynski  ---
Created attachment 34304
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34304&action=edit
Another test-case

This is another test-case that triggers this ICE.

$ g++ -c  -std=c++0x -m32 -O2   t.i   
t.i:105:1: internal compiler error: in remove_unreachable_nodes, at ipa.c:574
 }
 ^
0xb2a991 symbol_table::remove_unreachable_nodes(_IO_FILE*)
../../gcc/gcc/ipa.c:574
0x12bc193 ipa_inline
../../gcc/gcc/ipa-inline.c:2196
0x12bc193 execute
../../gcc/gcc/ipa-inline.c:2562
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.
zsh: exit 1 /usr/local/gcc/host-x86_64/head/bin/g++ -c -std=c++0x -m32 -O2 

$ g++ --version
g++ (GCC) 5.0.0 20141220 (experimental)

Adding -fno-ipa-icf also makes it go away.


[Bug c++/62164] New: 5.0: ICE: error: Both section and comdat group is set

2014-08-17 Thread adam at os dot inf.tu-dresden.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62164

Bug ID: 62164
   Summary: 5.0: ICE: error: Both section and comdat group is set
   Product: gcc
   Version: 5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: adam at os dot inf.tu-dresden.de

The following code causes an ICE:

class T { static void t(); };

class U
{
public:
  static void u() __attribute__ ((__section__ (".initcall.text")));
};

inline void U::u() {}

void T::t() { U::u(); }

$ g++ --version
g++ (GCC) 5.0.0 20140817 (experimental)
$ g++ -c t.c
t.c:11:23: error: Both section and comdat group is set
 void T::t() { U::u(); }
   ^
_ZN1U1uEv/0 (static void U::u()) @0x7f3c83ebe000
  Type: function definition analyzed
  Visibility: public weak comdat comdat_group:_ZN1U1uEv one_only
section:.initcall.text
  References: 
  Referring: 
  First run: 0
  Function flags: body
  Called by: _ZN1T1tEv/2 (1.00 per call) 
  Calls: 
t.c:11:23: internal compiler error: verify_cgraph_node failed
0x858967 cgraph_node::verify_node()
../../gcc/gcc/cgraph.c:2978
0x84f757 symtab_node::verify()
../../gcc/gcc/symtab.c:1200
0x850eb7 symtab_node::verify_symtab_nodes()
../../gcc/gcc/symtab.c:1220
0x85e73a compile()
../../gcc/gcc/cgraphunit.c:2157
0x860874 finalize_compilation_unit()
../../gcc/gcc/cgraphunit.c:2331
0x6500b5 cp_write_global_declarations()
../../gcc/gcc/cp/decl2.c:4649
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.

The problem seems to be that U::u() is tagged inline. If it is not inline,
there is no ICE.
No ICE for <= 4.9.