[Bug c++/116646] Compilation of code inside if constexpr with failed condition.

2024-09-09 Thread cas43 at cs dot stanford.edu via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116646

--- Comment #4 from Craig Schroeder  ---
Thank you for taking the time to explain this.  I understand why the code
snippet does not work now.

[Bug c++/116646] New: Compilation of code inside if constexpr with failed condition.

2024-09-08 Thread cas43 at cs dot stanford.edu via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116646

Bug ID: 116646
   Summary: Compilation of code inside if constexpr with failed
condition.
   Product: gcc
   Version: 12.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cas43 at cs dot stanford.edu
  Target Milestone: ---

When compiling the following code (g++ -std=c++20 file.cpp):

static const int y=0;
void f() {if constexpr(y<0){static_assert(y<0);}}

I expect no errors, but I get the following diagnostic with gcc version 12.3.0
(Ubuntu 12.3.0-1ubuntu1~22.04):

a.cpp: In function ‘void f()’:
a.cpp:2:44: error: static assertion failed
2 | void f() {if constexpr(y<0){static_assert(y<0);}}
  |   ~^~
a.cpp:2:44: note: the comparison reduces to ‘(0 < 0)’

I get similar diagnostics with every compiler I have ready access to:

gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04) 
gcc version 10.5.0 (Ubuntu 10.5.0-1ubuntu1~22.04) 
Ubuntu clang version 15.0.7
Ubuntu clang version 14.0.0-1ubuntu1.1
Ubuntu clang version 13.0.1-2ubuntu2.2
Ubuntu clang version 12.0.1-19ubuntu3
Ubuntu clang version 11.1.0-6

This suggests a mistake in my own code, but I don't see it.  My understanding
is that the "if constexpr" should fail and prevent compilation within its body.
 Declaring y as "static constexpr" still fails.  The static_assert can be
replaced with other types of errors, such as a call to a function call that
fails to match.

[Bug c++/92879] New: incorrect warning of __builtin_memset offset is out of the bounds on zero-size allocation and initialization

2019-12-09 Thread cas43 at cs dot stanford.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92879

Bug ID: 92879
   Summary: incorrect warning of __builtin_memset offset is out of
the bounds on zero-size allocation and initialization
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cas43 at cs dot stanford.edu
  Target Milestone: ---

DIAGNOSTIC:

g++ prog.cpp -c -Wall -O3
In constructor ‘S::S(int)’,
inlined from ‘(static initializers for prog.cpp)’ at prog.cpp:16:6:
prog.cpp:13:30: warning: ‘void* __builtin_memset(void*, int, long unsigned
int)’ offset [0, 3] is out of the bounds [0, 0]
[]8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Warray-bounds-Warray-bounds]8;;]
   13 | for(int i=0;i

[Bug c++/84604] False positive "may be used uninitialized in this function" due to variable initialization eliminated as dead code

2018-02-27 Thread cas43 at cs dot stanford.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84604

--- Comment #2 from Craig Schroeder  ---
I was under the impression I was allowed to call the destructor just like any
other function.  On further investigation, this is undefined behavior, so this
bug report is invalid.

[Bug c++/84604] New: False positive "may be used uninitialized in this function" due to variable initialization eliminated as dead code

2018-02-27 Thread cas43 at cs dot stanford.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84604

Bug ID: 84604
   Summary: False positive "may be used uninitialized in this
function" due to variable initialization eliminated as
dead code
   Product: gcc
   Version: 8.0.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cas43 at cs dot stanford.edu
  Target Milestone: ---

WHAT HAPPENS:

The compiler eliminates a=0; and b=0; from the code below during the dce2
optimization pass, resulting in a warning for use of uninitialized variable. 
Curiously, the generate code seems to be okay.

OFFENDING CODE:

void f();

struct S
{
int a;
int b;

S() 
{
a=0;
b=0;
} 

~S()
{
}

void g(int) 
{
if(a<10)
{
f();
for(int i=0;i~S();
a=b+2;
}
} 
};

int foo() 
{
S s;
s.g(0);
s.g(0);
return s.a+s.b;
}

OPTIMIZED RESULT: (via -fdump-tree-all)

;; Function foo (_Z3foov, funcdef_no=7, decl_uid=2398, cgraph_uid=7,
symbol_order=7)

foo ()
{
  int s$b;
  int _5;
  int _16;

   [local count: 1073741825]:
  f ();
  _16 = s$b_12(D) + 2;
  if (_16 <= 9)
goto ; [33.00%]
  else
goto ; [67.00%]

   [local count: 1073741827]:
  _5 = s$b_12(D) + _16;
  return _5;

   [local count: 354334802]:
  f ();
  goto ; [100.00%]

}

GENERATED ASM:

.file   "prog.cpp"
.text
.p2align 4,,15
.globl  _Z3foov
.type   _Z3foov, @function
_Z3foov:
.LFB7:
.cfi_startproc
subq$8, %rsp
.cfi_def_cfa_offset 16
call_Z1fv
call_Z1fv
movl$2, %eax
addq$8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE7:
.size   _Z3foov, .-_Z3foov
.ident  "GCC: (GNU) 8.0.1 20180227 (experimental)"
.section.note.GNU-stack,"",@progbits

COMPILER VERSION:

Using built-in specs.
COLLECT_GCC=/home/craig/new-gcc/i-trunk/bin/g++
COLLECT_LTO_WRAPPER=/home/craig/new-gcc/i-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../s-trunk/configure --prefix=/home/craig/new-gcc/i-trunk
--disable-multilib
Thread model: posix
gcc version 8.0.1 20180227 (experimental) (GCC) 

COMPILATION FLAGS:

g++ prog.cpp -Wall -c -O2

OTHER VERSIONS that give false positev:

4.9.3 (Ubuntu 4.9.3-13ubuntu2)
5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)

[Bug c++/80907] New: False positive: "warning: array subscript is above array bounds"

2017-05-28 Thread cas43 at cs dot stanford.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80907

Bug ID: 80907
   Summary: False positive: "warning: array subscript is above
array bounds"
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cas43 at cs dot stanford.edu
  Target Milestone: ---

THIS PROGRAM:

int x[3];
int n=2;
void foo() 
{
for(int i=0;i

[Bug c++/79139] New: warning: argument 1 null where non-null expected [-Wnonnull]

2017-01-18 Thread cas43 at cs dot stanford.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79139

Bug ID: 79139
   Summary: warning: argument 1 null where non-null expected
[-Wnonnull]
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cas43 at cs dot stanford.edu
  Target Milestone: ---

THIS PROGRAM:

void foo(int n)
{
int * p = 0;
if(n>0)
{
if(4*n/3+2)
p = new int[n];
}
for(int i=0; i

[Bug c++/71210] New: internal compiler error: in assign_temp, at function.c:961

2016-05-19 Thread cas43 at cs dot stanford.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71210

Bug ID: 71210
   Summary: internal compiler error: in assign_temp, at
function.c:961
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cas43 at cs dot stanford.edu
  Target Milestone: ---

PROGRAM:


namespace std {class type_info { };}
[[noreturn]] void f1(const std::type_info& type);
struct S1{~S1();};
struct S2
{
virtual S1 f2() const { f1(typeid(*this)); } 
S1 f3() const { return f2(); } 
};
void f4() { S2 a; a.f3(); } 


RESULT:


prog.cpp: In function ‘void f4()’:
prog.cpp:7:31: internal compiler error: in assign_temp, at function.c:961
 S1 f3() const { return f2(); }
   ^
0xaa9163 assign_temp(tree_node*, int, int)
../../s-trunk/gcc/function.c:961
0x92fbb7 expand_call(tree_node*, rtx_def*, int)
../../s-trunk/gcc/calls.c:2569
0xa3fbcc expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../s-trunk/gcc/expr.c:10460
0x94069a expand_expr
../../s-trunk/gcc/expr.h:272
0x94069a expand_call_stmt
../../s-trunk/gcc/cfgexpand.c:2660
0x94069a expand_gimple_stmt_1
../../s-trunk/gcc/cfgexpand.c:3548
0x94069a expand_gimple_stmt
../../s-trunk/gcc/cfgexpand.c:3714
0x941d76 expand_gimple_basic_block
../../s-trunk/gcc/cfgexpand.c:5720
0x947ed6 execute
../../s-trunk/gcc/cfgexpand.c:6335
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.


HOW TO RUN:


g++ -c -O2 prog.cpp


NOTES:


No ICE with -O1.


COMPILER VERSION:

Using built-in specs.
COLLECT_GCC=/home/craig/new-gcc/i-trunk/bin/g++
COLLECT_LTO_WRAPPER=/home/craig/new-gcc/i-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../s-trunk/configure --prefix=/home/craig/new-gcc/i-trunk
Thread model: posix
gcc version 7.0.0 20160519 (experimental) (GCC)

[Bug c++/67468] New: compiler changes template argument

2015-09-06 Thread cas43 at cs dot stanford.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67468

Bug ID: 67468
   Summary: compiler changes template argument
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cas43 at cs dot stanford.edu
  Target Milestone: ---

When compiled with:

g++ -c prog.cpp -Q

The compiler output contains "B::x>" but the input contains "B::x>". 
The compiler has replaced the template argument R with the template argument S.

CODE:

template struct A
{
const static int x=0;
};
template struct B;
template class C
{
const static int x=A::x::x?A::x:A::x;
};
template int Get_Block_At_Mask(const C&
c,B::x>* b)
{
return 0;
}

COMPILER OUTPUT:

 int Get_Block_At_Mask(const C&, B::x>*)
Analyzing compilation unit
Performing interprocedural optimizations
 <*free_lang_data>   
  Assembling functions:

Execution times (seconds)
 phase setup :   0.00 ( 0%) usr   0.00 ( 0%) sys   0.01 (100%) wall
   1381 kB (80%) ggc
 TOTAL :   0.00 0.00 0.01  
1734 kB
Extra diagnostic checks enabled; compiler may run slowly.
Configure with --enable-checking=release to disable checks.

COMPILER VERSIONS TESTED:

Using built-in specs.
COLLECT_GCC=/home/craig/new-gcc/i-trunk/bin/g++
COLLECT_LTO_WRAPPER=/home/craig/new-gcc/i-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../s-trunk/configure --prefix=/home/craig/new-gcc/i-trunk
Thread model: posix
gcc version 6.0.0 20150906 (experimental) (GCC) 

-- and --

g++-5 (Ubuntu 5.1.0-0ubuntu11~14.04.1) 5.1.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


[Bug c++/66690] New: error: use of ‘X’ before deduction of ‘auto’

2015-06-27 Thread cas43 at cs dot stanford.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66690

Bug ID: 66690
   Summary: error: use of ‘X’ before deduction of ‘auto’
   Product: gcc
   Version: 5.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cas43 at cs dot stanford.edu
  Target Milestone: ---

PROBLEM:

When compiling the (invalid) code below, two diagnostics are issued.  The first
is valid (constructor is private).  The second diagnostic is perplexing. 
Fixing the error results in a clean compile.

CODE:

template auto foo(T t) {return 3;}
class B {B();};
template class D:public B
{
D()
{
T x00;
foo(x00);
}
};
D d;

DIAGNOSTIC:

prog.cpp:5:5: error: ‘D::D() [with T = int]’ is private
 D()
 ^
prog.cpp:11:8: error: within this context
 D d;
^
prog.cpp: In instantiation of ‘D::D() [with T = int]’:
prog.cpp:11:8:   required from here
prog.cpp:2:10: error: ‘B::B()’ is private
 class B {B();};
  ^
prog.cpp:6:5: error: within this context
 {
 ^
prog.cpp:8:12: error: use of ‘auto foo(T) [with T = int]’ before deduction of
‘auto’
 foo(x00);
^


VERSION:

Using built-in specs.
COLLECT_GCC=g++-5
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
5.1.0-0ubuntu11~14.04.1' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-5 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=c++98 --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.1.0 (Ubuntu 5.1.0-0ubuntu11~14.04.1)

[Bug c++/63367] New: internal compiler error: tree check: expected function_decl, have template_decl in warn_hidden, at cp/class.c:2824

2014-09-25 Thread cas43 at cs dot stanford.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63367

Bug ID: 63367
   Summary: internal compiler error: tree check: expected
function_decl, have template_decl in warn_hidden, at
cp/class.c:2824
   Product: gcc
   Version: 5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cas43 at cs dot stanford.edu

When trying to compile this:


class A {virtual void f();};
class B : public A {template void f();};


Run like this:


g++ -Woverloaded-virtual -c prog.cpp


I get this output:


prog.cpp:2:7: internal compiler error: tree check: expected function_decl, have
template_decl in warn_hidden, at cp/class.c:2824
 class B : public A {template void f();};
   ^
0xdf6bf4 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../s-trunk/gcc/tree.c:9167
0x64165c tree_check(tree_node*, char const*, int, char const*, tree_code)
../../s-trunk/gcc/tree.h:2733
0x64165c warn_hidden
../../s-trunk/gcc/cp/class.c:2824
0x64165c finish_struct_1(tree_node*)
../../s-trunk/gcc/cp/class.c:6518
0x641df4 finish_struct(tree_node*, tree_node*)
../../s-trunk/gcc/cp/class.c:6698
0x66fd32 cp_parser_class_specifier_1
../../s-trunk/gcc/cp/parser.c:19627
0x672690 cp_parser_class_specifier
../../s-trunk/gcc/cp/parser.c:19855
0x672690 cp_parser_type_specifier
../../s-trunk/gcc/cp/parser.c:14531
0x68d594 cp_parser_decl_specifier_seq
../../s-trunk/gcc/cp/parser.c:11772
0x693549 cp_parser_simple_declaration
../../s-trunk/gcc/cp/parser.c:11362
0x6748c3 cp_parser_block_declaration
../../s-trunk/gcc/cp/parser.c:11311
0x69eff5 cp_parser_declaration
../../s-trunk/gcc/cp/parser.c:11208
0x69dca8 cp_parser_declaration_seq_opt
../../s-trunk/gcc/cp/parser.c:11094
0x69f502 cp_parser_translation_unit
../../s-trunk/gcc/cp/parser.c:4059
0x69f502 c_parse_file()
../../s-trunk/gcc/cp/parser.c:32089
0x7c6112 c_common_parse_file()
../../s-trunk/gcc/c-family/c-opts.c:1043
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.


Compiler:


Using built-in specs.
COLLECT_GCC=/home/craig/new-gcc/i-trunk/bin/g++
COLLECT_LTO_WRAPPER=/home/craig/new-gcc/i-trunk/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-trunk/configure --prefix=/home/craig/new-gcc/i-trunk
Thread model: posix
gcc version 5.0.0 20140924 (experimental) (GCC)


[Bug other/63159] New: Demangler crash

2014-09-03 Thread cas43 at cs dot stanford.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63159

Bug ID: 63159
   Summary: Demangler crash
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: other
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cas43 at cs dot stanford.edu

The demangler crashes when given this symbol:

_ZN7PhysBAM11HETERO_DIFFmlINS_6VECTORIfLi3EEENS0_10MAT_HOLDERINS_16SYMMETRIC_MATRIXIfLi3EEENS0_7VEC_ENDENS0_7MAT_ENDENS0_7HESSIANIT_DTclsrNS0_9MAT_MAP_1INS0_3MULINS0_3ARGILi0EEENSE_ILi1ENS0_9VEC_MAP_1ISH_4TypecvT0__EcvNSB_6SCALARE_ESM_RKNSA_ISB_SL_EE

See https://sourceware.org/bugzilla/show_bug.cgi?id=17043


[Bug tree-optimization/61481] Poor optimization of simple small-sized matrix routines with constant data

2014-06-12 Thread cas43 at cs dot stanford.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61481

--- Comment #3 from Craig Schroeder  ---
Created attachment 32930
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32930&action=edit
More practical (but more complex) example

I am trying to optimize an auto-differentiation utility.  The example above was
the result of simplifying a very complex program down to a simple one that
exhibits many of the same problems.  Auto-differentiation frequently produces
calculations that are trivial or unused, but shaving those computations out in
the code would be quite difficult.

Attached is portion of an application of it, stripped down to the routines that
are actually used and with some unneeded templatization removed.

As in the simpler example, the relative order of loop unrolling and sccp seems
to be the source of problem.  After flattening, there are three loops, with no
nested loops.  None are unrolled during prog.cpp.058t.cunrolli.  All three are
unrolled during prog.cpp.118t.cunroll, but that is too late for the
prog.cpp.103t.sccp step.


[Bug tree-optimization/61481] Poor optimization of simple small-sized matrix routines with constant data

2014-06-11 Thread cas43 at cs dot stanford.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61481

--- Comment #1 from Craig Schroeder  ---
The compiler used in the above compilation was:

Using built-in specs.
COLLECT_GCC=/home/craig/new-gcc/i-trunk/bin/g++
COLLECT_LTO_WRAPPER=/home/craig/new-gcc/i-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.10.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-trunk/configure --prefix=/home/craig/new-gcc/i-trunk
Thread model: posix
gcc version 4.10.0 20140602 (experimental) (GCC)


[Bug tree-optimization/61481] New: Poor optimization of simple small-sized matrix routines with constant data

2014-06-11 Thread cas43 at cs dot stanford.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61481

Bug ID: 61481
   Summary: Poor optimization of simple small-sized matrix
routines with constant data
   Product: gcc
   Version: 4.10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cas43 at cs dot stanford.edu

Created attachment 32927
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32927&action=edit
Output of the

The following function does some simple matrix operations.  All of the data is
constant, and N is small.  The function optimizes to a return statement for N=1
and N=2.  For N=3, optimization is incomplete after tree optimizations but
benifits significantly from later optimizations.  For N=4, the final result is
not good.

template
int foo()
{
int x[N*N],y[N*N],z[N*N];
for(int i=0;i();
template int foo<2>();
template int foo<3>();
template int foo<4>();


Compiled with: g++ test.cpp -c -S -O3

The full test.s file is attached, but the most immediate bits are summarized
below.

=== Asm produced for foo<1>(); ===

movl $2, %eax
ret

=== Asm produced for foo<2>(); ===

movl $4, %eax
ret

=== Asm produced for foo<3>(); ===

subq $32, %rsp
.cfi_def_cfa_offset 40
movl $6, %eax
addq $32, %rsp
.cfi_def_cfa_offset 8
ret

=== Asm produced for foo<4>(); ===

subq $96, %rsp
.cfi_def_cfa_offset 104
xorl %eax, %eax
movl $8, %ecx
leaq -104(%rsp), %rdx
pxor %xmm7, %xmm7
pxor %xmm10, %xmm10
movq %rdx, %rdi
rep; stosq
movl $1, -104(%rsp)
movl $1, -84(%rsp)
movl $1, -64(%rsp)
movl $1, -44(%rsp)
movdqa %xmm7, %xmm11
shufps $136, %xmm7, %xmm11
movdqa -104(%rsp), %xmm0
shufps $221, %xmm7, %xmm7
movdqa -88(%rsp), %xmm3
... lots and lots of SSE instructions ...
movdqa %xmm2, %xmm0
punpckhdq %xmm5, %xmm2
punpckldq %xmm5, %xmm0
movaps %xmm6, -120(%rsp)
movl -120(%rsp), %eax
addl 44(%rsp), %eax
movaps %xmm0, 56(%rsp)
movaps %xmm2, 72(%rsp)
addl 64(%rsp), %eax
addl 84(%rsp), %eax
addq $96, %rsp
.cfi_def_cfa_offset 8
ret


[Bug c++/61392] New: internal compiler error: in write_template_arg_literal, at cp/mangle.c:3072

2014-06-02 Thread cas43 at cs dot stanford.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61392

Bug ID: 61392
   Summary: internal compiler error: in
write_template_arg_literal, at cp/mangle.c:3072
   Product: gcc
   Version: 4.10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cas43 at cs dot stanford.edu

THIS PROGRAM:


template struct A { };
template struct B
{
A ddx;
template decltype(f(A(),ddx)) operator-(B) const;
};
B f(A,A);
B x,y=x-x;


CAUSES THIS OUTPUT:


prog.cpp: In instantiation of ‘decltype (f(A(), ((B*)(void)0)->B::ddx)) B::operator-(B) const [with U = int; V = int; S = int; T
= int; decltype (f(A(), ((B*)(void)0)->B::ddx)) = B]’:

prog.cpp:5:55: internal compiler error: in write_template_arg_literal, at
cp/mangle.c:3072
 template decltype(f(A(),ddx)) operator-(B) const;
   ^
0x72af8b write_template_arg_literal
../../s-trunk/gcc/cp/mangle.c:3072
0x72522f write_expression
../../s-trunk/gcc/cp/mangle.c:3008
0x7262b8 write_expression
../../s-trunk/gcc/cp/mangle.c:2900
0x724ed4 write_expression
../../s-trunk/gcc/cp/mangle.c:2955
0x7289cc write_type
../../s-trunk/gcc/cp/mangle.c:2106
0x72a5d4 write_bare_function_type
../../s-trunk/gcc/cp/mangle.c:2443
0x72ced9 mangle_decl_string
../../s-trunk/gcc/cp/mangle.c:3443
0x72d117 get_mangled_id
../../s-trunk/gcc/cp/mangle.c:3465
0x72d117 mangle_decl(tree_node*)
../../s-trunk/gcc/cp/mangle.c:3488
0xdab370 decl_assembler_name(tree_node*)
../../s-trunk/gcc/tree.c:602
0x83b864 insert_to_assembler_name_hash
../../s-trunk/gcc/symtab.c:183
0x83b9c1 symtab_initialize_asm_name_hash
../../s-trunk/gcc/symtab.c:359
0x84a964 analyze_functions
../../s-trunk/gcc/cgraphunit.c:1135
0x84bea5 finalize_compilation_unit()
../../s-trunk/gcc/cgraphunit.c:2331
0x63b03e cp_write_global_declarations()
../../s-trunk/gcc/cp/decl2.c:4647
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.


WITH THIS COMPILER:


Using built-in specs.
COLLECT_GCC=/home/craig/new-gcc/i-trunk/bin/g++
COLLECT_LTO_WRAPPER=/home/craig/new-gcc/i-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.10.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-trunk/configure --prefix=/home/craig/new-gcc/i-trunk
Thread model: posix
gcc version 4.10.0 20140602 (experimental) (GCC) 



WHEN RUN LIKE THIS:


g++ -c --std=c++0x  prog.cpp


BUT COMPILES CLEANLY WHEN RUN THE SAME WAY WITH THIS COMPILER:


Using built-in specs.
COLLECT_GCC=g++-4.8
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.8.1-2ubuntu1~12.04' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin
--with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
--enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.1 (Ubuntu 4.8.1-2ubuntu1~12.04)

[Bug c++/58537] New: internal compiler error: in gen_rtx_SUBREG, at emit-rtl.c:776

2013-09-25 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58537

Bug ID: 58537
   Summary: internal compiler error: in gen_rtx_SUBREG, at
emit-rtl.c:776
   Product: gcc
   Version: 4.8.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cas43 at cs dot stanford.edu

Created attachment 30898
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30898&action=edit
Program that triggers ICE

When compiling the attached program like this (all options except -c are
required):

g++ -c -march=nocona -O2 -funroll-loops -fno-signed-zeros -gdwarf-2  prog.cpp

I get this result

prog.cpp: In member function ‘SYMMETRIC_MATRIX TORUS::Hessian(const
TV&) const [with T = float; TORUS::TV = VECTOR]’:
prog.cpp:102:1: internal compiler error: in gen_rtx_SUBREG, at emit-rtl.c:776
 }
 ^
0x6d5fbb gen_rtx_SUBREG(machine_mode, rtx_def*, int)
../../s-4.8/gcc/emit-rtl.c:776
0xa15d2c dead_debug_insert_temp(dead_debug_local*, unsigned int, rtx_def*,
debug_temp_where)
../../s-4.8/gcc/valtrack.c:731
0xc04e9f dce_process_block
../../s-4.8/gcc/dce.c:995
0xc04e9f fast_dce
../../s-4.8/gcc/dce.c:1068
0xc05544 rest_of_handle_fast_dce
../../s-4.8/gcc/dce.c:1132
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.



compiler version:

Using built-in specs.
COLLECT_GCC=/home/craig/new-gcc/i-4.8/bin/g++
COLLECT_LTO_WRAPPER=/home/craig/new-gcc/i-4.8/libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.8/configure --prefix=/home/craig/new-gcc/i-4.8
Thread model: posix
gcc version 4.8.2 20130925 (prerelease) (GCC) 



I get similar results with this version:

Using built-in specs.
COLLECT_GCC=/home/craig/new-gcc/i-trunk/bin/g++
COLLECT_LTO_WRAPPER=/home/craig/new-gcc/i-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-trunk/configure --prefix=/home/craig/new-gcc/i-trunk
Thread model: posix
gcc version 4.9.0 20130730 (experimental) (GCC) 


The program compiles cleanly with this version (even with -Wall):

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 

And it also builds cleanly with a fairly recent build of clang:

clang version 3.4 (trunk 187482)
Target: x86_64-unknown-linux-gnu
Thread model: posix

[Bug c++/57947] internal compiler error: Segmentation fault using extended initializer lists without -std=c++11 or -std=gnu++11

2013-07-22 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57947

--- Comment #2 from Craig Schroeder  ---
Unfortunately that is because I tried cleaning up the test case some more after
reducing it down.  How about this:

namespace std
{
template  class initializer_list {};
template  struct D {D(std::initializer_list) {}};
D<0> d{1, 2, 3};
}


[Bug c++/57948] New: internal compiler error: in initialize_reference, at cp/call.c:9285

2013-07-20 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57948

Bug ID: 57948
   Summary: internal compiler error: in initialize_reference, at
cp/call.c:9285
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cas43 at cs dot stanford.edu

With this input:

struct Base {   };
struct Derived : Base
{
struct Derived2 : Base
{
struct ConvertibleToBothDerivedRef
{
operator Derived&();
operator Derived2&();
void bind_lvalue_to_conv_lvalue_ambig(ConvertibleToBothDerivedRef
both)
{
Base &br1 = both;
}
};
};
};


compiled like this:  g++ prog.cpp


I get this output:

prog.cpp: In member function ‘void
Derived::Derived2::ConvertibleToBothDerivedRef::bind_lvalue_to_conv_lvalue_ambig(Derived::Derived2::ConvertibleToBothDerivedRef)’:
prog.cpp:12:29: error: conversion from
‘Derived::Derived2::ConvertibleToBothDerivedRef’ to ‘Base&’ is ambiguous
 Base &br1 = both;
 ^
prog.cpp:10:18: note: candidates are:
 void bind_lvalue_to_conv_lvalue_ambig(ConvertibleToBothDerivedRef
both)
  ^
prog.cpp:9:13: note: Derived::Derived2::ConvertibleToBothDerivedRef::operator
Derived::Derived2&()
 operator Derived2&();
 ^
prog.cpp:8:13: note: Derived::Derived2::ConvertibleToBothDerivedRef::operator
Derived&()
 operator Derived&();
 ^
prog.cpp:12:29: internal compiler error: in initialize_reference, at
cp/call.c:9285
 Base &br1 = both;
 ^
0x52061e initialize_reference(tree_node*, tree_node*, int, int)
../../s-4.9/gcc/cp/call.c:9285
0x52d9a4 grok_reference_init
../../s-4.9/gcc/cp/decl.c:4762
0x52d9a4 check_initializer
../../s-4.9/gcc/cp/decl.c:5630
0x54006d cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
../../s-4.9/gcc/cp/decl.c:6349
0x6260fd cp_parser_init_declarator
../../s-4.9/gcc/cp/parser.c:16527
0x62673e cp_parser_simple_declaration
../../s-4.9/gcc/cp/parser.c:10946
0x6285a0 cp_parser_block_declaration
../../s-4.9/gcc/cp/parser.c:10827
0x6296a0 cp_parser_declaration_statement
../../s-4.9/gcc/cp/parser.c:10471
0x612527 cp_parser_statement
../../s-4.9/gcc/cp/parser.c:9229
0x61382e cp_parser_statement_seq_opt
../../s-4.9/gcc/cp/parser.c:9509
0x613976 cp_parser_compound_statement
../../s-4.9/gcc/cp/parser.c:9463
0x624733 cp_parser_function_body
../../s-4.9/gcc/cp/parser.c:18257
0x624733 cp_parser_ctor_initializer_opt_and_function_body
../../s-4.9/gcc/cp/parser.c:18293
0x62578f cp_parser_function_definition_after_declarator
../../s-4.9/gcc/cp/parser.c:22271
0x60b49c cp_parser_late_parsing_for_member
../../s-4.9/gcc/cp/parser.c:22923
0x60b49c cp_parser_class_specifier_1
../../s-4.9/gcc/cp/parser.c:19016
0x60d610 cp_parser_class_specifier
../../s-4.9/gcc/cp/parser.c:19040
0x60d610 cp_parser_type_specifier
../../s-4.9/gcc/cp/parser.c:14042
0x622ad9 cp_parser_decl_specifier_seq
../../s-4.9/gcc/cp/parser.c:11288
0x626599 cp_parser_simple_declaration
../../s-4.9/gcc/cp/parser.c:10878
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.


Compiler version:

Using built-in specs.
COLLECT_GCC=/home/craig/new-gcc/i-4.9/bin/g++
COLLECT_LTO_WRAPPER=/home/craig/new-gcc/i-4.9/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.9/configure --prefix=/home/craig/new-gcc/i-4.9
Thread model: posix
gcc version 4.9.0 20130718 (experimental) (GCC)

[Bug c++/57947] New: internal compiler error: Segmentation fault using extended initializer lists without -std=c++11 or -std=gnu++11

2013-07-20 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57947

Bug ID: 57947
   Summary: internal compiler error: Segmentation fault using
extended initializer lists without -std=c++11 or
-std=gnu++11
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cas43 at cs dot stanford.edu

Program:

templateclass initializer_list {};
template  struct D {D(std::initializer_list) {}};
D<0> d{1, 2, 3};


Compile like this: g++ prog.cpp


Output:

prog.cpp:8:12: warning: extended initializer lists only available with
-std=c++11 or -std=gnu++11 [enabled by default]
   D<0> d{
^
prog.cpp:9:11: error: in C++98 ‘std::d’ must be initialized by constructor, not
by ‘{...}’
1, 2, 3};
   ^
prog.cpp:9:11: internal compiler error: Segmentation fault
0xaac4cf crash_signal
../../s-4.9/gcc/toplev.c:333
0x519ce3 contains_struct_check
../../s-4.9/gcc/tree.h:3803
0x519ce3 convert_like_real
../../s-4.9/gcc/cp/call.c:6055
0x51b671 build_over_call
../../s-4.9/gcc/cp/call.c:6943
0x517b3b build_new_method_call_1
../../s-4.9/gcc/cp/call.c:
0x517b3b build_new_method_call(tree_node*, tree_node*, vec**, tree_node*, int, tree_node**, int)
../../s-4.9/gcc/cp/call.c:7847
0x518d12 build_special_member_call(tree_node*, tree_node*, vec**, tree_node*, int, int)
../../s-4.9/gcc/cp/call.c:7412
0x6657d7 expand_default_init
../../s-4.9/gcc/cp/init.c:1664
0x6657d7 expand_aggr_init_1
../../s-4.9/gcc/cp/init.c:1765
0x66835a build_aggr_init(tree_node*, tree_node*, int, int)
../../s-4.9/gcc/cp/init.c:1516
0x52d01d build_aggr_init_full_exprs
../../s-4.9/gcc/cp/decl.c:5545
0x52d01d check_initializer
../../s-4.9/gcc/cp/decl.c:5680
0x54006d cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
../../s-4.9/gcc/cp/decl.c:6349
0x6260fd cp_parser_init_declarator
../../s-4.9/gcc/cp/parser.c:16527
0x62673e cp_parser_simple_declaration
../../s-4.9/gcc/cp/parser.c:10946
0x6285a0 cp_parser_block_declaration
../../s-4.9/gcc/cp/parser.c:10827
0x63160b cp_parser_declaration
../../s-4.9/gcc/cp/parser.c:10724
0x6302dd cp_parser_declaration_seq_opt
../../s-4.9/gcc/cp/parser.c:10610
0x6304f0 cp_parser_namespace_body
../../s-4.9/gcc/cp/parser.c:15530
0x6304f0 cp_parser_namespace_definition
../../s-4.9/gcc/cp/parser.c:15511
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.


Version:

Using built-in specs.
COLLECT_GCC=/home/craig/new-gcc/i-4.9/bin/g++
COLLECT_LTO_WRAPPER=/home/craig/new-gcc/i-4.9/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.9/configure --prefix=/home/craig/new-gcc/i-4.9
Thread model: posix
gcc version 4.9.0 20130718 (experimental) (GCC)

[Bug c++/57946] New: internal compiler error: Segmentation fault in int_fits_type_p

2013-07-20 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57946

Bug ID: 57946
   Summary: internal compiler error: Segmentation fault in
int_fits_type_p
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cas43 at cs dot stanford.edu

when compiling this program:

enum ENUM2 {  ENUM2_a = (enum ENUM2) 4,  ENUM2_b = 0x9FFF,  ENUM2_c =
0x1 };

like this:  g++ prog.cpp

I get this output:

prog.cpp:1:40: internal compiler error: Segmentation fault
   enum ENUM2 {  ENUM2_a = (enum ENUM2) 4,  ENUM2_b = 0x9FFF,  ENUM2_c =
0x1 };
^
0xaac4cf crash_signal
../../s-4.9/gcc/toplev.c:333
0xc9c684 int_fits_type_p(tree_node const*, tree_node const*)
../../s-4.9/gcc/tree.c:8543
0x6587ae ocp_convert(tree_node*, tree_node*, int, int, int)
../../s-4.9/gcc/cp/cvt.c:754
0x656437 cp_build_c_cast(tree_node*, tree_node*, int)
../../s-4.9/gcc/cp/typeck.c:7052
0x619f1f cp_parser_binary_expression
../../s-4.9/gcc/cp/parser.c:7692
0x61a3df cp_parser_assignment_expression
../../s-4.9/gcc/cp/parser.c:7928
0x61a836 cp_parser_assignment_expression
../../s-4.9/gcc/cp/parser.c:7978
0x61a836 cp_parser_constant_expression
../../s-4.9/gcc/cp/parser.c:8188
0x60dfc7 cp_parser_enumerator_definition
../../s-4.9/gcc/cp/parser.c:15361
0x60dfc7 cp_parser_enumerator_list
../../s-4.9/gcc/cp/parser.c:15308
0x60dfc7 cp_parser_enum_specifier
../../s-4.9/gcc/cp/parser.c:15234
0x60dfc7 cp_parser_type_specifier
../../s-4.9/gcc/cp/parser.c:14014
0x622ad9 cp_parser_decl_specifier_seq
../../s-4.9/gcc/cp/parser.c:11288
0x626599 cp_parser_simple_declaration
../../s-4.9/gcc/cp/parser.c:10878
0x6285a0 cp_parser_block_declaration
../../s-4.9/gcc/cp/parser.c:10827
0x63160b cp_parser_declaration
../../s-4.9/gcc/cp/parser.c:10724
0x6302dd cp_parser_declaration_seq_opt
../../s-4.9/gcc/cp/parser.c:10610
0x631b92 cp_parser_translation_unit
../../s-4.9/gcc/cp/parser.c:3930
0x631b92 c_parse_file()
../../s-4.9/gcc/cp/parser.c:28827
0x742ad4 c_common_parse_file()
../../s-4.9/gcc/c-family/c-opts.c:1046
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.


Compiler version:

Using built-in specs.
COLLECT_GCC=/home/craig/new-gcc/i-4.9/bin/g++
COLLECT_LTO_WRAPPER=/home/craig/new-gcc/i-4.9/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.9/configure --prefix=/home/craig/new-gcc/i-4.9
Thread model: posix
gcc version 4.9.0 20130718 (experimental) (GCC)


[Bug c++/57945] New: internal compiler error: in varpool_get_node, at cgraph.h:840

2013-07-20 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57945

Bug ID: 57945
   Summary: internal compiler error: in varpool_get_node, at
cgraph.h:840
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cas43 at cs dot stanford.edu

== Compiling this code: ==

static __typeof(pthread_once) __gthrw_pthread_once __attribute__
((__weakref__("pthread_once")));


== like this: ==

g++ prog.cpp


== produces this output: ==

prog.cpp:1:17: error: ‘pthread_once’ was not declared in this scope
 static __typeof(pthread_once) __gthrw_pthread_once __attribute__
((__weakref__("pthread_once")));
 ^
prog.cpp:1:97: error: invalid type in declaration before ‘;’ token
 static __typeof(pthread_once) __gthrw_pthread_once __attribute__
((__weakref__("pthread_once")));
   
 ^
prog.cpp:1:97: internal compiler error: in varpool_get_node, at cgraph.h:840
0x4f087f varpool_get_node
../../s-4.9/gcc/cgraph.h:840
0xcea462 varpool_get_node
../../s-4.9/gcc/varpool.c:281
0xcea462 varpool_analyze_node(varpool_node*)
../../s-4.9/gcc/varpool.c:288
0x7d42c7 analyze_functions
../../s-4.9/gcc/cgraphunit.c:935
0x7d5735 finalize_compilation_unit()
../../s-4.9/gcc/cgraphunit.c:2097
0x5edde0 cp_write_global_declarations()
../../s-4.9/gcc/cp/decl2.c:4356
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.

== using this version of gcc: ==

Using built-in specs.
COLLECT_GCC=../new-gcc/i-4.9/bin/g++
COLLECT_LTO_WRAPPER=/home/craig/new-gcc/i-4.9/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.9/configure --prefix=/home/craig/new-gcc/i-4.9
Thread model: posix
gcc version 4.9.0 20130718 (experimental) (GCC)

[Bug c++/55405] New: ICE with optimization

2012-11-19 Thread cas43 at cs dot stanford.edu

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

 Bug #: 55405
   Summary: ICE with optimization
Classification: Unclassified
   Product: gcc
   Version: 4.6.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ca...@cs.stanford.edu


How to compile: g++ prog.cpp -O3 -c

Result:
prog.cpp: In function ‘void foo()’:
prog.cpp:22:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
Preprocessed source stored into /tmp/ccLwjBSn.out file, please attach this to
your bugreport.

Code:

template
struct A
{
A(){}
~A(){}
T a[1];
void f(int i);
};
struct B
{
virtual ~B();
};
void bar();
void foo()
{
B b;
A > x;
for(int i=0;i<4;i++) x.f(0);
A > > y,z;
bar();
bar();
}

Version:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)


[Bug c++/54929] New: internal compiler error: in tsubst_copy, at cp/pt.c:12349

2012-10-14 Thread cas43 at cs dot stanford.edu

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

 Bug #: 54929
   Summary: internal compiler error: in tsubst_copy, at
cp/pt.c:12349
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ca...@cs.stanford.edu


Input:

template class A {void F(){sizeof(double);}};
template class A;


Expected result: compile successfully.

Output:

prog.cpp: In instantiation of ‘void A::F() [with T = int]’:
prog.cpp:2:16:   required from here
prog.cpp:1:43: internal compiler error: in tsubst_copy, at cp/pt.c:12349
 template class A {void F(){sizeof(double);}};
   ^
0x5835ca tsubst_copy
../../s-4.8/gcc/cp/pt.c:12349
0x57364e tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../s-4.8/gcc/cp/pt.c:13476
0x573543 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../s-4.8/gcc/cp/pt.c:13501
0x57aeba tsubst_expr
../../s-4.8/gcc/cp/pt.c:13156
0x57c8c8 tsubst_expr
../../s-4.8/gcc/cp/pt.c:12641
0x57c465 tsubst_expr
../../s-4.8/gcc/cp/pt.c:12811
0x579d86 instantiate_decl(tree_node*, int, bool)
../../s-4.8/gcc/cp/pt.c:18633
0x5b43a3 instantiate_pending_templates(int)
../../s-4.8/gcc/cp/pt.c:18732
0x5efc00 cp_write_global_declarations()
../../s-4.8/gcc/cp/decl2.c:3993
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.


Output from g++ -v:
Using built-in specs.
COLLECT_GCC=/new-gcc/i-4.8/bin/g++
COLLECT_LTO_WRAPPER=/new-gcc/i-4.8/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.8/configure --prefix=/new-gcc/i-4.8
Thread model: posix
gcc version 4.8.0 20121014 (experimental) (GCC) 


Sorry if this bugs gets duplicated; I cannot find the original.


[Bug c++/54928] New: Infinite output with after ICE with macro

2012-10-14 Thread cas43 at cs dot stanford.edu

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

 Bug #: 54928
   Summary: Infinite output with after ICE with macro
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ca...@cs.stanford.edu


Compiling this without options produces infinite output.

#define M(x) x
template class A {void F(){M(sizeof(double));}};
template class A;


Beginning of output:

prog.cpp: In instantiation of ‘void A::F() [with T = int]’:
prog.cpp:3:16:   required from here
prog.cpp:2:45: internal compiler error: in tsubst_copy, at cp/pt.c:12349
 template class A {void F(){M(sizeof(double));}};
 ^
prog.cpp:1:14: note: in definition of macro 'M'
 #define M(x) x
  ^
prog.cpp:2:45: internal compiler error: in internal_error, at diagnostic.c:1069
 template class A {void F(){M(sizeof(double));}};
 ^
prog.cpp:1:14: note: in definition of macro 'M'
 #define M(x) x
  ^



Output of g++ -v:
Using built-in specs.
COLLECT_GCC=/new-gcc/i-4.8/bin/g++
COLLECT_LTO_WRAPPER=/new-gcc/i-4.8/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.8/configure --prefix=/new-gcc/i-4.8
Thread model: posix
gcc version 4.8.0 20121014 (experimental) (GCC) 


I filed the ICE leading up to the infinite loop as a separate bug.


[Bug c++/54927] New: internal compiler error: in tsubst_copy, at cp/pt.c:12349

2012-10-14 Thread cas43 at cs dot stanford.edu

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

 Bug #: 54927
   Summary: internal compiler error: in tsubst_copy, at
cp/pt.c:12349
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ca...@cs.stanford.edu


When compiling this program without options:

template class A {void F(){sizeof(double);}};
template class A;


The compilation should succeed, but I get the following output:


prog.cpp: In instantiation of ‘void A::F() [with T = int]’:
prog.cpp:2:16:   required from here
prog.cpp:1:43: internal compiler error: in tsubst_copy, at cp/pt.c:12349
 template class A {void F(){sizeof(double);}};
   ^
0x5835ca tsubst_copy
../../s-4.8/gcc/cp/pt.c:12349
0x57364e tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../s-4.8/gcc/cp/pt.c:13476
0x573543 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../s-4.8/gcc/cp/pt.c:13501
0x57aeba tsubst_expr
../../s-4.8/gcc/cp/pt.c:13156
0x57c8c8 tsubst_expr
../../s-4.8/gcc/cp/pt.c:12641
0x57c465 tsubst_expr
../../s-4.8/gcc/cp/pt.c:12811
0x579d86 instantiate_decl(tree_node*, int, bool)
../../s-4.8/gcc/cp/pt.c:18633
0x5b43a3 instantiate_pending_templates(int)
../../s-4.8/gcc/cp/pt.c:18732
0x5efc00 cp_write_global_declarations()
../../s-4.8/gcc/cp/decl2.c:3993
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.


Output of g++ -v:

Using built-in specs.
COLLECT_GCC=/new-gcc/i-4.8/bin/g++
COLLECT_LTO_WRAPPER=/new-gcc/i-4.8/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.8/configure --prefix=/new-gcc/i-4.8
Thread model: posix
gcc version 4.8.0 20121014 (experimental) (GCC)


[Bug c/52290] New: internal compiler error: tree check: expected function_decl, have var_decl in start_function, at c-decl.c:7712

2012-02-16 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52290

 Bug #: 52290
   Summary: internal compiler error: tree check: expected
function_decl, have var_decl in start_function, at
c-decl.c:7712
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ca...@cs.stanford.edu


Triggered by the (invalid) C source:
int f()[j]

Diagnostic:
2.c:1:9: error: ‘j’ undeclared here (not in a function)
2.c:1:1: internal compiler error: tree check: expected function_decl, have
var_decl in start_function, at c-decl.c:7712
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

Compiler version:
Using built-in specs.
COLLECT_GCC=/new-gcc/i-4.7/bin/gcc
COLLECT_LTO_WRAPPER=/new-gcc/i-4.7/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.7/configure --prefix=/new-gcc/i-4.7
Thread model: posix
gcc version 4.7.0 20120216 (experimental) (GCC)


[Bug c++/51661] New: ICE when template class list repeated

2011-12-22 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51661

 Bug #: 51661
   Summary: ICE when template class list repeated
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ca...@cs.stanford.edu


g++ crashes when compiling this program:

namespace
{
template struct s{s();};
template s::s(){}
extern template struct s;
}

How to run:   g++ prog.cpp

Output:

prog.cpp:4:19: error: ‘{anonymous}::s’ is not a template
prog.cpp:4:30: error: declaration of ‘{anonymous}::s s()’ not in a namespace
surrounding ‘::’
prog.cpp:4:30: error: ‘{anonymous}::s s()’ should have been declared inside
‘::’
prog.cpp:5:24: error: using typedef-name ‘s’ after ‘struct’
prog.cpp:5:24: internal compiler error: tree check: expected tree that contains
‘decl minimal’ structure, have ‘template_id_expr’ in
check_elaborated_type_specifier, at cp/decl.c:11443
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

Compiler version:

COLLECT_GCC=/new-gcc/i-4.7/bin/g++
COLLECT_LTO_WRAPPER=/new-gcc/i-4.7/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.7/configure --prefix=/new-gcc/i-4.7
Thread model: posix
gcc version 4.7.0 20111223 (experimental) (GCC)


[Bug c++/51660] New: ICE on function missing argument list

2011-12-22 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51660

 Bug #: 51660
   Summary: ICE on function missing argument list
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ca...@cs.stanford.edu


g++ crashes on this (invalid) program:

struct s
{
static int x {return 0;}
};


Output:

crashes/6.cpp:3:16: warning: extended initializer lists only available with
-std=c++11 or -std=gnu++11 [enabled by default]
crashes/6.cpp:3:19: error: expected primary-expression before ‘return’
crashes/6.cpp:3:19: error: expected ‘}’ before ‘return’
crashes/6.cpp:3:19: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

How to run: g++ file.cpp

Note that this program does not cause gcc to crash if compiled as C.

Compiler version:

Using built-in specs.
COLLECT_GCC=/new-gcc/i-4.7/bin/g++
COLLECT_LTO_WRAPPER=/new-gcc/i-4.7/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.7/configure --prefix=/new-gcc/i-4.7
Thread model: posix
gcc version 4.7.0 20111223 (experimental) (GCC)


[Bug c++/51488] New: ICE on infinite template recursion

2011-12-09 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51488

 Bug #: 51488
   Summary: ICE on infinite template recursion
Classification: Unclassified
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ca...@cs.stanford.edu


OFFENDING CODE:

template struct s;
template struct s::a> {};
s ca;


HOW TO REPRODUCE:

g++ file.cpp


WHAT HAPPENS:

g++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.


WHICH COMPILERS PRODUDE THIS RESULT:

I have tried with 6 different versions of gcc, and it fails the same way with
each:

#1:
Using built-in specs.
COLLECT_GCC=/home/cas43/new-gcc/i-4.7/bin/g++
COLLECT_LTO_WRAPPER=/home/cas43/new-gcc/i-4.7/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.7/configure --prefix=/home/cas43/new-gcc/i-4.7
Thread model: posix
gcc version 4.7.0 20111208 (experimental) (GCC) 

#2:
Using built-in specs.
COLLECT_GCC=/home/cas43/new-gcc/i-4.6/bin/g++
COLLECT_LTO_WRAPPER=/home/cas43/new-gcc/i-4.6/libexec/gcc/x86_64-unknown-linux-gnu/4.6.3/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.6/configure --prefix=/home/cas43/new-gcc/i-4.6
Thread model: posix
gcc version 4.6.3 2021 (prerelease) (GCC) 

#3:
Using built-in specs.
COLLECT_GCC=/home/cas43/new-gcc/i-4.5/bin/g++
COLLECT_LTO_WRAPPER=/home/cas43/new-gcc/i-4.5/libexec/gcc/x86_64-unknown-linux-gnu/4.5.4/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.5/configure --prefix=/home/cas43/new-gcc/i-4.5
Thread model: posix
gcc version 4.5.4 20111208 (prerelease) (GCC) 

#4:
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.4/configure --prefix=/home/cas43/new-gcc/i-4.4
Thread model: posix
gcc version 4.4.7 20111208 (prerelease) (GCC) 

#5:
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
--disable-werror --with-arch-32=i486 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) 

#6:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.5 --enable-shared --enable-multiarch
--with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/x86_64-linux-gnu
--enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default
--with-plugin-ld=ld.gold --enable-objc-gc --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)


[Bug c++/51154] internal compiler error: gimplification failed

2011-11-15 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51154

--- Comment #2 from Craig Schroeder  2011-11-16 
07:30:12 UTC ---
Created attachment 25835
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25835
Another file variant causing a third diagnostic on ICE.

This variant on the file produces the following diagnostic:

four.cpp: In member function ‘void ADVECTION_DRIVER::Scalar_Advance()’:
four.cpp:30:33: error: ‘T’ was not declared in this scope
four.cpp:30:35: error: ‘TV_INT’ was not declared in this scope
four.cpp:30:41: error: template argument 1 is invalid
four.cpp:30:41: error: template argument 2 is invalid
four.cpp:30:56: error: invalid type in declaration before ‘(’ token
four.cpp: In instantiation of ‘void ADVECTION_DRIVER::Scalar_Advance()
[with TV = VECTOR]’:
four.cpp:33:16:   required from here
four.cpp:30:64: error: expression list treated as compound expression in
initializer [-fpermissive]
four.cpp: In member function ‘void ARRAY >::Resize() [with T
= float; int d = 1]’:
four.cpp:21:20: internal compiler error: in create_tmp_var, at gimplify.c:468
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.


[Bug c++/51154] internal compiler error: gimplification failed

2011-11-15 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51154

--- Comment #1 from Craig Schroeder  2011-11-16 
07:28:29 UTC ---
Created attachment 25834
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25834
Variation on same source causing failure with different message.

This variant on the source file ICE's with this message:

[lots of errors here]
g++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

Full diagnostic:

two.cpp:7:33: error: expected ‘;’ after class definition
two.cpp:19:20: error: ‘T’ was not declared in this scope
two.cpp:19:21: error: template argument 1 is invalid
two.cpp:39:36: error: ‘T’ does not name a type
two.cpp:39:38: error: ISO C++ forbids declaration of ‘dt’ with no type
[-fpermissive]
two.cpp:39:47: error: ‘T’ does not name a type
two.cpp:39:49: error: ISO C++ forbids declaration of ‘time’ with no type
[-fpermissive]
two.cpp:45:18: error: ‘STREAM_TYPE’ does not name a type
two.cpp:52:80: error: ‘T’ does not name a type
two.cpp:52:82: error: ISO C++ forbids declaration of ‘dt’ with no type
[-fpermissive]
two.cpp:52:91: error: ‘T’ does not name a type
two.cpp:52:93: error: ISO C++ forbids declaration of ‘time’ with no type
[-fpermissive]
two.cpp: In member function ‘void ADVECTION_DRIVER::Scalar_Advance(int,
int)’:
two.cpp:53:15: error: ‘T’ was not declared in this scope
two.cpp:53:17: error: ‘TV_INT’ was not declared in this scope
two.cpp:53:23: error: template argument 1 is invalid
two.cpp:53:23: error: template argument 2 is invalid
two.cpp:53:38: error: invalid type in declaration before ‘(’ token
two.cpp: In instantiation of ‘class VECTOR’:
two.cpp:43:37:   required from ‘class ADVECTION_EXAMPLE >’
two.cpp:53:79:   required from ‘void ADVECTION_DRIVER::Scalar_Advance(int,
int) [with TV = VECTOR]’
two.cpp:55:25:   required from here
two.cpp:8:37: error: invalid use of incomplete type ‘class VECTOR_BASE >’
two.cpp:6:40: error: declaration of ‘class VECTOR_BASE
>’
two.cpp: In instantiation of ‘class ADVECTION_EXAMPLE >’:
two.cpp:53:79:   required from ‘void ADVECTION_DRIVER::Scalar_Advance(int,
int) [with TV = VECTOR]’
two.cpp:55:25:   required from here
two.cpp:12:21: error: ‘typedef float VECTOR::SCALAR’ is private
two.cpp:43:37: error: within this context
two.cpp:9:35: error: ‘template struct VECTOR::REBIND’ is
private
two.cpp:44:57: error: within this context
two.cpp:12:21: error: ‘typedef float VECTOR::SCALAR’ is private
two.cpp:47:25: error: within this context
two.cpp:9:35: error: ‘template struct VECTOR::REBIND’ is
private
two.cpp:47:25: error: within this context
two.cpp: In instantiation of ‘class ARRAYS_ND_BASE >’:
two.cpp:23:37:   required from ‘class ARRAY >’
two.cpp:47:25:   required from ‘class ADVECTION_EXAMPLE >’
two.cpp:53:79:   required from ‘void ADVECTION_DRIVER::Scalar_Advance(int,
int) [with TV = VECTOR]’
two.cpp:55:25:   required from here
two.cpp:14:32: error: no type named ‘ELEMENT’ in ‘class VECTOR’
two.cpp:15:14: error: ‘dimension’ is not a member of ‘VECTOR’
two.cpp: In instantiation of ‘class VECTOR’:
two.cpp:18:16:   required from ‘class ARRAYS_ND_BASE >’
two.cpp:23:37:   required from ‘class ARRAY >’
two.cpp:47:25:   required from ‘class ADVECTION_EXAMPLE >’
two.cpp:53:79:   required from ‘void ADVECTION_DRIVER::Scalar_Advance(int,
int) [with TV = VECTOR]’
two.cpp:55:25:   required from here
two.cpp:8:37: error: invalid use of incomplete type ‘class VECTOR_BASE >’
two.cpp:6:40: error: declaration of ‘class VECTOR_BASE >’
two.cpp: In instantiation of ‘class ARRAY >’:
two.cpp:47:25:   required from ‘class ADVECTION_EXAMPLE >’
two.cpp:53:79:   required from ‘void ADVECTION_DRIVER::Scalar_Advance(int,
int) [with TV = VECTOR]’
two.cpp:55:25:   required from here
two.cpp:19:23: error: ‘int ARRAYS_ND_BASE >::array’ is private
two.cpp:23:37: error: within this context
two.cpp:18:16: error: ‘ARRAYS_ND_BASE >::TV_INT
ARRAYS_ND_BASE >::counts’ is private
two.cpp:23:37: error: within this context
two.cpp: In instantiation of ‘void ADVECTION_DRIVER::Scalar_Advance(int,
int) [with TV = VECTOR]’:
two.cpp:55:25:   required from here
two.cpp:53:79: error: expression list treated as compound expression in
initializer [-fpermissive]
two.cpp: In instantiation of ‘class VECTOR’:
two.cpp:53:79:   required from ‘void ADVECTION_DRIVER::Scalar_Advance(int,
int) [with TV = VECTOR]’
two.cpp:55:25:   required from here
two.cpp:8:37: error: invalid use of incomplete type ‘class VECTOR_BASE >’
two.cpp:6:40: error: declaration of ‘class VECTOR_BASE >’
two.cpp: In instantiation of ‘void ARRAY >::Resize(const
RANGE >&, bool, bool, const T&) [with T = float; int d = 1]’:
two.cpp:50:9:   required from ‘void ADVECTION_DRIVER::Initialize() [with TV
= VECTOR]’
two.cpp:55:25:   required from here
two.cpp:31:46: error: ‘const class RANGE >’ has no member named
‘Edge_Lengths’
two.cpp:20:55: error: ‘ARRAYS_ND_BASE& ARRAYS_ND_BASE::operator=(const
T_ARRAY

[Bug c++/51154] New: internal compiler error: gimplification failed

2011-11-15 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51154

 Bug #: 51154
   Summary: internal compiler error: gimplification failed
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ca...@cs.stanford.edu


Created attachment 25833
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25833
Program that cuases g++ to ICE.

How to reproduce: g++ -c prog.cpp

DIAGNOSTIC:

gimplification failed:
<<< Unknown tree: using_decl >>> 
unit size 
align 32 symtab 0 alias set -1 canonical type 0x7f3d605e7d20
fields 
nonlocal decl_3 SI file prog.cpp line 5 col 9
size 
unit size 
align 32 offset_align 128
offset 
bit offset  context
 chain > context 
full-name "ARRAY >::BASE"
X() X(constX&) this=(X&) n_parents=0 use_template=1 interface-unknown
pointer_to_this  reference_to_this
 chain >
ignored VOID file prog.cpp line 16 col 17
align 1 context  initial 
chain >
prog.cpp: In member function ‘void ARRAY >::Resize() [with T =
float]’:
prog.cpp:17:20: internal compiler error: gimplification failed
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

COMPILER VERSION:

Using built-in specs.
COLLECT_GCC=/home/cas43/new-gcc/inst/bin/g++
COLLECT_LTO_WRAPPER=/home/cas43/new-gcc/inst/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../current-gcc/configure --prefix=/home/cas43/new-gcc/inst
Thread model: posix
gcc version 4.7.0 2016 (experimental) (GCC)


[Bug c++/51152] error: X has no member named Y on code that seems valid

2011-11-15 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51152

--- Comment #1 from Craig Schroeder  2011-11-16 
06:14:29 UTC ---
Created attachment 25832
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25832
File that fails to compile cleanly.


[Bug c++/51152] New: error: X has no member named Y on code that seems valid

2011-11-15 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51152

 Bug #: 51152
   Summary: error: X has no member named Y on code that seems
valid
Classification: Unclassified
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ca...@cs.stanford.edu


How to run:  g++ -c prog.cpp

prog.cpp is attached.

Diagnostic produced:

prog.cpp: In member function ‘void C::f()’:
prog.cpp:21:12: error: ‘struct B’ has no member named ‘a’

Version of g++ that produces this diagnostic:

Using built-in specs.
COLLECT_GCC=/home/cas43/new-gcc/inst/bin/g++
COLLECT_LTO_WRAPPER=/home/cas43/new-gcc/inst/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../current-gcc/configure --prefix=/home/cas43/new-gcc/inst
Thread model: posix
gcc version 4.7.0 2016 (experimental) (GCC) 

Expected: should compile cleanly.  (Compiles cleanly with gcc version 4.4.3
(Ubuntu 4.4.3-4ubuntu5))


[Bug c++/50872] New: internal compiler error: in inline_small_functions, at ipa-inline.c:1413

2011-10-25 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50872

 Bug #: 50872
   Summary: internal compiler error: in inline_small_functions, at
ipa-inline.c:1413
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ca...@cs.stanford.edu


Created attachment 25615
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25615
Program that causes g++ to ICE.

Command: /home/cas43/new-gcc/inst/bin/g++ prog.cpp -c -O3

Compiler output:

prog.cpp:108:24: internal compiler error: in inline_small_functions, at
ipa-inline.c:1413
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

Looks like it could be the same as Bug ID 50823, based on the flags and
location of the fault.

Compiler version:

Using built-in specs.
COLLECT_GCC=/home/cas43/new-gcc/inst/bin/g++
COLLECT_LTO_WRAPPER=/home/cas43/new-gcc/inst/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../current-gcc/configure --prefix=/home/cas43/new-gcc/inst
Thread model: posix
gcc version 4.7.0 20111024 (experimental) (GCC)


[Bug c++/50861] New: ICE: internal compiler error: tree check: expected tree that contains ‘decl minimal’ structure, have ‘error_mark’ in tsubst_copy_and_build, at cp/pt.c:13526

2011-10-24 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50861

 Bug #: 50861
   Summary: ICE: internal compiler error: tree check: expected
tree that contains ‘decl minimal’ structure, have
‘error_mark’ in tsubst_copy_and_build, at
cp/pt.c:13526
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ca...@cs.stanford.edu


Created attachment 25607
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25607
Program that causes g++ to ICE.

g++ ICE's with error "internal compiler error: tree check: expected tree that
contains ‘decl minimal’ structure, have ‘error_mark’ in tsubst_copy_and_build,
at cp/pt.c:13526"

Command to reproduce: /home/cas43/new-gcc/inst/bin/g++ prog.cpp -c -O3

Full diagnostic:

prog.cpp:1:40: error: there are no arguments to ‘k’ that depend on a template
parameter, so a declaration of ‘k’ must be available [-fpermissive]
prog.cpp:1:40: note: (if you use ‘-fpermissive’, G++ will accept your code, but
allowing the use of an undeclared name is deprecated)
prog.cpp: In constructor ‘A::A(int) [with T = int]’:
prog.cpp:2:22: error: use of parameter from containing function
prog.cpp:2:6: error:   ‘int k’ declared here
prog.cpp:2:22: error: ‘k’ was not declared in this scope, and no declarations
were found by argument-dependent lookup at the point of instantiation
[-fpermissive]
prog.cpp:2:22: internal compiler error: tree check: expected tree that contains
‘decl minimal’ structure, have ‘error_mark’ in tsubst_copy_and_build, at
cp/pt.c:13526
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

Compiler Version:

Using built-in specs.
COLLECT_GCC=/home/cas43/new-gcc/inst/bin/g++
COLLECT_LTO_WRAPPER=/home/cas43/new-gcc/inst/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../current-gcc/configure --prefix=/home/cas43/new-gcc/inst
Thread model: posix
gcc version 4.7.0 20111024 (experimental) (GCC)


[Bug c++/50852] New: ICE: internal compiler error: in tsubst, at cp/pt.c:11030

2011-10-24 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50852

 Bug #: 50852
   Summary: ICE: internal compiler error: in tsubst, at
cp/pt.c:11030
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ca...@cs.stanford.edu


Created attachment 25592
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25592
Compiling this file causes ICE

ICE on compiling attached file.

How to reproduce: /home/cas43/new-gcc/inst/bin/g++ prog.ii

Diagnostic:

prog.cpp: In instantiation of ‘class D >, 3>’:
prog.cpp:13:16:   required from here
prog.cpp:11:23: internal compiler error: in tsubst, at cp/pt.c:11030
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

Compiler version:

/home/cas43/new-gcc/inst/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/home/cas43/new-gcc/inst/bin/g++
COLLECT_LTO_WRAPPER=/home/cas43/new-gcc/inst/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../current-gcc/configure --prefix=/home/cas43/new-gcc/inst
Thread model: posix
gcc version 4.7.0 20111024 (experimental) (GCC)


[Bug c++/50851] New: ICE: verify_ssa failed, definition in block x does not dominate use in block y with -O2

2011-10-24 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50851

 Bug #: 50851
   Summary: ICE: verify_ssa failed, definition in block x does not
dominate use in block y with -O2
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ca...@cs.stanford.edu


Created attachment 25591
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25591
Source file causing ICE

Compilation of the attached file with -O2 causes ICE.

Compiler output:

prog.cpp: In member function ‘void
ANGLE_JOINT::Constrain_Angles(VECTOR&) const [with TV = int]’:
prog.cpp:7:10: error: definition in block 5 does not dominate use in block 3
for SSA_NAME: .MEM_12 in statement:
.MEM_12 = PHI <.MEM_8(D)(2), .MEM_12(3)>
PHI argument
.MEM_12
for PHI node
.MEM_12 = PHI <.MEM_8(D)(2), .MEM_12(3)>
prog.cpp:7:10: internal compiler error: verify_ssa failed
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

How to reproduce: /home/cas43/new-gcc/inst/bin/g++ prog.cpp -O2

Compiler version:

/home/cas43/new-gcc/inst/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/home/cas43/new-gcc/inst/bin/g++
COLLECT_LTO_WRAPPER=/home/cas43/new-gcc/inst/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../current-gcc/configure --prefix=/home/cas43/new-gcc/inst
Thread model: posix
gcc version 4.7.0 20111024 (experimental) (GCC)


[Bug c++/50848] New: ICE in derived template class missing using for member of template base class

2011-10-24 Thread cas43 at cs dot stanford.edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50848

 Bug #: 50848
   Summary: ICE in derived template class missing using for member
of template base class
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ca...@cs.stanford.edu


Created attachment 25588
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25588
Source file causing ICE

Compiling the attached source file causes g++ to ICE.

Command to reproduce:  /home/cas43/new-gcc/inst/bin/g++ prog.cpp

System type: 64-bit Ubuntu Linux

Compiler version:

$ /home/cas43/new-gcc/inst/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/home/cas43/new-gcc/inst/bin/g++
COLLECT_LTO_WRAPPER=/home/cas43/new-gcc/inst/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../current-gcc/configure --prefix=/home/cas43/new-gcc/inst
Thread model: posix
gcc version 4.7.0 20111024 (experimental) (GCC) 

OUTPUT:

prog.cpp: In member function ‘void B::f()’:
prog.cpp:2:53: error: there are no arguments to ‘u’ that depend on a template
parameter, so a declaration of ‘u’ must be available [-fpermissive]
prog.cpp:2:53: note: (if you use ‘-fpermissive’, G++ will accept your code, but
allowing the use of an undeclared name is deprecated)
prog.cpp: In instantiation of ‘void B::f() [with T = int]’:
prog.cpp:3:16:   required from here
prog.cpp:2:50: error: ‘u’ was not declared in this scope, and no declarations
were found by argument-dependent lookup at the point of instantiation
[-fpermissive]
prog.cpp:2:50: internal compiler error: tree check: expected tree that contains
‘decl minimal’ structure, have ‘indirect_ref’ in tsubst_copy_and_build, at
cp/pt.c:13526
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.