[Bug c++/56251] no DW_AT_const_value for static const member of a template class

2017-03-23 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56251

chihin ko  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from chihin ko  ---
Verified on Solaris 11

[Bug debug/54773] no debug info generated for rvalue reference

2017-03-23 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54773

chihin ko  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from chihin ko  ---
g++ 5.4.0 on Solaris 11 does not have this problem.

[Bug c++/78761] New: C++14, compiler generate mangled name that can not be demangled

2016-12-09 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78761

Bug ID: 78761
   Summary: C++14, compiler generate mangled name that can not be
demangled
   Product: gcc
   Version: 6.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chihin.ko at oracle dot com
  Target Milestone: ---

cat t.cc

template 
decltype(auto) g_1(T t) {
return t;
}

template 
auto g_2(T t) {
return t;
}

int main() {
decltype(auto) res = g_1(10);
decltype(auto) res2 = g_2(10);
return 0;
}
==
g++ -g t.cc

> nm a.out | grep g_2
[71]| 4198535|   12|FUNC |WEAK |0|20 |_Z3g_2IiEDaT_
> /pkg/gnu/bin/gnu-c++filt _Z3g_2IiEDaT_
auto g_2(int) <=== this is OK

> nm a.out | grep g_1
[84]|  4198523|   12|FUNC |WEAK |0|19 |_Z3g_1IiEDcT_
> /pkg/gnu/bin/gnu-c++filt _Z3g_1IiEDcT_
_Z3g_1IiEDcT_   <=== can not be demangled

[Bug c++/78329] incorrect debug info for return type deduction C++14

2016-11-15 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78329

--- Comment #1 from chihin ko  ---
The bug only happen in member functions,
I tried multiple classes with deducted return type for multiple member
functions, they all point to the same DW_TAG_unspecified_type.

[Bug c++/78329] New: incorrect debug info for return type deduction C++14

2016-11-11 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78329

Bug ID: 78329
   Summary: incorrect debug info for return type deduction C++14
   Product: gcc
   Version: 6.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chihin.ko at oracle dot com
  Target Milestone: ---

cat t.cc
class AA {
public:
auto func(int arg) {
int i = 0;
for (; i < arg; i++);
return i;
}
} a;

auto func1(int arg) {
int i = 0;
for (; i < arg; i++);
return i;
}

int main() {
auto res = a.func(5);
res = func1(5);
return 0;
}

The return type of function "func" should resolved to type "int":

< 2><0x0034>  DW_TAG_subprogram
DW_AT_external  yes(1)
DW_AT_name  "func"
DW_AT_decl_file 0x0001
/workspace/chko/ws/dinstall/dbx_test/bugid/2484659
6/g61/t.cc
DW_AT_decl_line 0x0003
DW_AT_linkage_name  "_ZN2AA4funcEi"
DW_AT_type  <0x0054>
DW_AT_accessibility DW_ACCESS_public
DW_AT_declaration   yes(1)
DW_AT_object_pointer<0x0048>
< 3><0x0048>DW_TAG_formal_parameter
  DW_AT_type  <0x0059>
  DW_AT_artificialyes(1)
< 3><0x004d>DW_TAG_formal_parameter
  DW_AT_type  <0x0064>
< 1><0x0054>DW_TAG_unspecified_type
  DW_AT_name  "auto"  <== should resolve to
type "int"

[Bug debug/68904] DWARF for class ios_base says it's a declaration

2015-12-14 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68904

--- Comment #4 from chihin ko  ---
(In reply to Andrew Pinski from comment #1)
> Can you try:
> -fno-eliminate-unused-debug-types
> 
> I bet the full type debug info is going to be emitted in a different TU
> which is why GCC is not emitting it here.
> 
> 
> Also look at the debug info inside libstdc++.so/libstdc++.a to see if the
> full debug info is emitted there.

The problem is for class "ios_base", the attribute 
DW_AT_declaration   yes(1)
should not be there, because the full definition of the class is here:

< 2><0xb0f9>  DW_TAG_class_type
DW_AT_name "ios_base"
DW_AT_declaration  yes(1)  <=== should not have
this
DW_AT_sibling  <0xb4ab>
< 3><0xb103>DW_TAG_enumeration_type
  DW_AT_name "event"
  DW_AT_byte_size0x0004
  DW_AT_decl_file0x0025
/pkg/gnu/include/c++/4.9.3/bits/ios_base
.h
  DW_AT_decl_line0x01a3
  DW_AT_sibling  <0xb123>
< 4><0xb110>  DW_TAG_enumerator
DW_AT_name "erase_event"
DW_AT_const_value  0x

[Bug debug/68904] DWARF for class ios_base says it's a declaration

2015-12-14 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68904

--- Comment #3 from chihin ko  ---
Created attachment 37033
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37033&action=edit
dwarf dump of test case test.cc

[Bug debug/68904] DWARF for class ios_base says it's a declaration

2015-12-14 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68904

--- Comment #2 from chihin ko  ---
Created attachment 37032
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37032&action=edit
test case

[Bug debug/68904] New: DWARF for class ios_base says it's a declaration

2015-12-14 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68904

Bug ID: 68904
   Summary: DWARF for class ios_base says it's a declaration
   Product: gcc
   Version: 5.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chihin.ko at oracle dot com
  Target Milestone: ---

We've build the appended program with all manner of g++'s (from 3.4.3 to 5.2.0)
and in all cases the DWARF information for class ios_base is "weird":

< 2><0x0601>  DW_TAG_class_type
DW_AT_name  "ios_base"
DW_AT_declaration   yes(1)
DW_AT_sibling   <0x080d>
   BUT IT HAS THE USUAL MEMBER DEFINITIONS ETC FOLLOWING HERE!

The test program has some other only-forward, empty and within-namespace
definitions
and for them the DWARF is as expected:

class Fwd;
< 1><0x18d2>DW_TAG_class_type
  DW_AT_name  "Fwd"
  DW_AT_declaration   yes(1)

class Foo {
public:
int foo;
};

< 1><0x14b6>DW_TAG_class_type
  DW_AT_name  "Foo"
  DW_AT_byte_size 0x0004
  DW_AT_decl_file 0x0001
/net/djomolungma/export/home/test/gnu/class/t.cc
  DW_AT_decl_line 0x0012
  DW_AT_sibling   <0x14e6>
< 2><0x14c2>  DW_TAG_member
ADDITIONAL MEMBER INFO


class Bar {
};
< 1><0x14ec>DW_TAG_class_type
  DW_AT_name  "Bar"
  DW_AT_byte_size 0x0001
  DW_AT_decl_file 0x0001
/net/djomolungma/export/home/test/gnu/class/t.cc
  DW_AT_decl_line 0x0019


something gets the compiler confused about 'ios_base' such that it emits
attributes that say it's a declaration but then the compiler also
outputs full member information for 'ios_base'.

[Bug c++/66116] New: no DW_TAG_template_type_parameter for template instantiation

2015-05-11 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66116

Bug ID: 66116
   Summary: no DW_TAG_template_type_parameter for template
instantiation
   Product: gcc
   Version: 4.8.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chihin.ko at oracle dot com
  Target Milestone: ---

Created attachment 35520
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35520&action=edit
test case

For attached std_list_iterators.cc, there is no DW_TAG_template_type_parameter
for DW_TAG_class_type  "allocator" :

< 2><0x3bd7>  DW_TAG_class_type
DW_AT_name  "allocator"
DW_AT_byte_size 0x0001
DW_AT_decl_file 0x0006 allocator.h
DW_AT_decl_line 0x005c
DW_AT_sibling   <0x3cbc>
< 3><0x3be3>DW_TAG_inheritance
  DW_AT_type  <0x80f8>
  DW_AT_data_member_location  DW_OP_plus_uconst 0
  DW_AT_accessibility DW_ACCESS_public
< 3><0x3bec>DW_TAG_typedef
  DW_AT_name  "reference"
  DW_AT_decl_file 0x0006 allocator.h
  DW_AT_decl_line 0x0063
  DW_AT_type  <0x8ee9>
...
...


[Bug c++/66080] New: incorrect debug info for CTOR

2015-05-08 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66080

Bug ID: 66080
   Summary: incorrect debug info for CTOR
   Product: gcc
   Version: 4.7.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chihin.ko at oracle dot com
  Target Milestone: ---

Created attachment 35505
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35505&action=edit
test case

for attach delegating_constructors.cc test case,
due to incorrect debug info, gdb behave strange:
can't stop at line bpt:

(gdb) b 15
Breakpoint 1 at 0x4009d2: file delegating_constructors.cc, line 15.
(gdb) b 16
Breakpoint 2 at 0x400a07: file delegating_constructors.cc, line 16.
(gdb) b 20
Breakpoint 3 at 0x400a3a: file delegating_constructors.cc, line 20.
(gdb) run
Starting program:
/workspace/chko/ws/dinstall/intel_S11_gcc482/delegating_constructors.dbx,gcc/intel-Linux/a.out
Error in re-setting breakpoint 1: Function
"/workspace/chko/ws/dinstall/intel_S11_gcc482/delegating_constructors.dbx" not
defined.
Error in re-setting breakpoint 2: Function
"/workspace/chko/ws/dinstall/intel_S11_gcc482/delegating_constructors.dbx" not
defined.
Error in re-setting breakpoint 3: Function
"/workspace/chko/ws/dinstall/intel_S11_gcc482/delegating_constructors.dbx" not
defined.
a:
x=1
y=2.00
z=3
st=4
arr:
x=1
y=2.00
z=3
st=4
x=1
y=2.00
z=3
st=4
a2:
x=11
y=22.00
z=33
st=77
[Inferior 1 (process 7687) exited normally]
(gdb) quit

here is one example in dwarf dump:

< 2><0x0052>  DW_TAG_subprogram
DW_AT_external  yes(1)
DW_AT_name  "St"
DW_AT_decl_file 0x0001
delegating_constructors.cc
DW_AT_decl_line 0x0006
DW_AT_declaration   yes(1)
...
...
< 1><0x01c5>DW_TAG_subprogram
  DW_AT_specification <0x0052> <== shouldn't
point to "St"
  DW_AT_inlineDW_INL_declared_not_inlined
  DW_AT_object_pointer<0x01d3>
  DW_AT_sibling   <0x01e6>
...
...
< 1><0x01eb>DW_TAG_subprogram
  DW_AT_abstract_origin   <0x01c5>
  DW_AT_linkage_name  "_ZN2StC2Ei"
  DW_AT_low_pc0x004009a6
  DW_AT_high_pc   22


[Bug debug/54773] no debug info generated for rvalue reference

2015-04-22 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54773

--- Comment #3 from chihin ko  ---
g++ 4.8.2 on intel-Linux regress again. DW_TAG_rvalue_reference_type did not
get generated.
g++ 4.8.2 on intel Solaris is broken too.

g++ 4.9.0 works on intel-Linux but not on intel Solaris.


[Bug debug/65821] [4.8/4.9/5/6 regression] incorrect debug line # info for main

2015-04-21 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65821

--- Comment #5 from chihin ko  ---
Created attachment 35381
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35381&action=edit
test case 1/1


[Bug debug/65821] [4.8/4.9/5/6 regression] incorrect debug line # info for main

2015-04-21 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65821

--- Comment #4 from chihin ko  ---
(In reply to Richard Biener from comment #3)
> What version works correctly?  (please provide the testcase as attachment as
> well)

< 0><0x000b>  DW_TAG_compile_unit
DW_AT_producer  "GNU C++ 4.7.2"
DW_AT_language  DW_LANG_C_plus_plus
...
...
< 1><0x0547>DW_TAG_subprogram
  DW_AT_external  yes(1)
  DW_AT_name  "main"
  DW_AT_decl_file 0x0001
/workspace/chko/ws/dinstall/dbx_test/intel_S11_gcc482/c++defargs3.dbx,gcc/g47/c++defargs3.cc
  DW_AT_decl_line 0x001d
  DW_AT_type  <0x0371>
  DW_AT_low_pc0x00400b02
  DW_AT_high_pc   0x00400b62
...
...

0x00400b02  [  30, 0] NS
0x00400b0a  [  31, 0] NS
0x00400b22  [  32, 0] NS DI=0x1
0x00400b35  [  33, 0] NS
0x00400b3f  [  34, 0] NS
0x00400b49  [  35, 0] NS


[Bug debug/65821] [4.8.2 regression] incorrect debug line # info for main

2015-04-20 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65821

--- Comment #2 from chihin ko  ---
(In reply to Andrew Pinski from comment #1)
> It is doing (b+3) first which is from :5 which seems correct to me.  Default
> arguments should have a line information right?

Then gdb should stop at line 30 first and when I step into foo(),
it stop at line 5. line 5 should belongs to foo().

Current behavior is confusing to user.


[Bug debug/65822] New: [4.8.2 regression] Used variant fun names in dwarf info for CTORs

2015-04-20 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65822

Bug ID: 65822
   Summary: [4.8.2 regression] Used variant fun names in dwarf
info for CTORs
   Product: gcc
   Version: 4.8.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chihin.ko at oracle dot com

Created attachment 35372
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35372&action=edit
test case 1/1

for attached *.cc, there are 3 A CTORS and 3 variant A CTORS:

 nm a.out | grep _ZN1AC
00400a8c W _ZN1AC1Ei
00400ab2 W _ZN1AC1Eifci
00400a5a W _ZN1AC1Ev
00400a8c W _ZN1AC2Ei
00400ab2 W _ZN1AC2Eifci
00400a5a W _ZN1AC2Ev

In dwarf dump, _ZN1AC2... was used :

 grep _ZN1AC a.out.dw
  DW_AT_MIPS_linkage_name "_ZN1AC2Ev"
  DW_AT_MIPS_linkage_name "_ZN1AC2Ei"
  DW_AT_MIPS_linkage_name "_ZN1AC2Eifci"
name at offset 0x011a, length9 is '_ZN1AC2Ei'
name at offset 0x0143, length   12 is '_ZN1AC2Eifci'
name at offset 0x015a, length9 is '_ZN1AC2Ev'

I don't see _ZN1AC1... were used in a.out.dw


[Bug debug/65821] New: [4.8.2 regression] incorrect debug line # info for main

2015-04-20 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65821

Bug ID: 65821
   Summary: [4.8.2 regression] incorrect debug line # info for
main
   Product: gcc
   Version: 4.8.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chihin.ko at oracle dot com

this happen since 4.8.2, 4.9.0 also have same problem.

cat t.cc
==
  1 #include 
  2
  3 int b = 12;
  4
  5 inline void foo(const int &x = (b+3))
  6 {
  7 printf("%d\n", x);
  8 }   9
 10 inline void baz(const int &x = 200)
 11 {
 12 printf("%d\n", x);
 13 }
 14
 15 inline void bar(int &x = b)
 16 {  17 printf("%d\n", x);
 18 x = 100;
 19 printf("%d\n", x);
 20 }
 21
 22
 23 void
 24 bob(char *s = "hello")  25 {
 26 printf("%s\n", s);
 27 }  28
 29 int main()
 30 {
 31   foo();  32   baz();
 33   bar();
 34   bob();
 35   return 0;
 36 }

The line table for main is incorrect:

< 1><0x067e>DW_TAG_subprogram
  DW_AT_external  yes(1)
  DW_AT_name  "main"
  DW_AT_decl_file 0x0001 t.cc
  DW_AT_decl_line 0x001d
  DW_AT_type  <0x0491>
  DW_AT_low_pc0x0040129f
  DW_AT_high_pc   0x004012ff
.debug_line
---

0x0040129f  [  30, 0] NS
0x004012a7  [   5, 0] NS   < extra line info
0x004012b0  [  31, 0] NS
0x004012bf  [  32, 0] NS DI=0x1
0x004012d2  [  33, 0] NS
0x004012dc  [  34, 0] NS

This cause follwing problem:
(gdb) b main
Breakpoint 1 at 0x4006ea: file c++defargs3.cc, line 5.  <== should be line 31
(gdb) run
Starting program:
/workspace/chko/ws/dinstall/dbx_test/intel_S11_gcc482/c++defargs3.dbx,gcc/g47/a.out

Breakpoint 1, main () at c++defargs3.cc:5
5   inline void foo(const int &x = (b+3))


[Bug c++/64912] New: no debug info for struct that pass by reference

2015-02-02 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64912

Bug ID: 64912
   Summary: no debug info for struct that pass by reference
   Product: gcc
   Version: 4.8.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chihin.ko at oracle dot com

For following t.cc:

extern "C" int printf(const char*, ...);
#include   
using namespace std;

deque gl_li(5,100);  
int main ()
{ 
deque tmp_deque(5,200);
gl_li.assign(tmp_deque.cbegin(),tmp_deque.cend());
gl_li.assign(tmp_deque.begin(),tmp_deque.end());  
for ( auto el: gl_li )
printf("el = %d\n", el);

return 0;   

} 

/gcc/4.8.1/intel-Linux/bin/g++ -m64 -std=c++11 t.cc -Xlinker
-R/gcc/4.8.1/intel-Linux/lib64  

There is no debug info to indicate struct "_Deque_iterator"
is passed type reference:

< 2><0x09be>  DW_TAG_structure_type
DW_AT_name  "_Deque_iterator"
DW_AT_byte_size 0x0020
DW_AT_decl_file 0x0001
/net/dv104/export/tools/gcc/4.8.1/intel-Linux/include/c++/4.8.1/bits/stl_deque.h
DW_AT_decl_line 0x006a
DW_AT_sibling   <0x0c55>
< 3><0x09ca>DW_TAG_member
  DW_AT_name  "_M_cur"

===
Oracle C++ compiler would generate something like this:
< 2><0x1bee>  DW_TAG_structure_type
DW_AT_name  "_Deque_iterator"
DW_AT_SUN_link_name
"_ZSt15_Deque_iteratorIiRiPiE"
DW_AT_decl_file 0x0002
/ws/cia/builds/dodona/latest/inte
l-S2/lib/compilers/CC-gcc/include/c++/4.8.2/bits/stl_deque.h
DW_AT_decl_line 0x0069
DW_AT_VMS_rtnbeg_pd_address <0x1b9f>
DW_AT_byte_size 0x0020
DW_AT_SUN_pass_with_const   yes(1)   <=== passed by
reference
DW_AT_SUN_return_with_const yes(1)   <=== returned by
reference


[Bug c++/63759] New: did not use DW_TAG_template_alias for template alias

2014-11-05 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63759

Bug ID: 63759
   Summary: did not use DW_TAG_template_alias for template alias
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chihin.ko at oracle dot com

Created attachment 33905
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33905&action=edit
test case

For attached test case t.cc, g++ did not generate appropriate debug info for
template alias, instead it used DW_TAG_typedef :

/net/dv104/export/tools/gcc/4.9.0/$VARIANT1/bin/g++ -m64 -std=c++11 -Xlinker
-R/net/dv104/export/tools/gcc/4.9.0/$VARIANT1/lib/amd64 t.cc

< 0><0x000b>  DW_TAG_compile_unit
DW_AT_producer  "GNU C++ 4.9.0 -m64
-mtune=generic -march=x86-64 -g -std=c++11"
DW_AT_language  DW_LANG_C_plus_plus
DW_AT_name  "t.cc"
...
...
< 1><0x4a55>DW_TAG_typedef
  DW_AT_name  "PrintStr"
  DW_AT_decl_file 0x0001
.../gnu/intel-Linux/t.cc
  DW_AT_decl_line 0x0010
  DW_AT_type  <0x44b8>

Here is the DWARF4 doc for  DW_TAG_template_alias

http://www.dwarfstd.org/ShowIssue.php?issue=090112.1


[Bug debug/54773] no debug info generated for rvalue reference

2014-08-12 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54773

--- Comment #2 from chihin ko  ---
g++ 4.8.1 on Linux fixed the problem, but problem still exists in g++ 4.8.1 on
solaris.


[Bug debug/57939] incorrect debug info of wchar_t

2014-06-25 Thread chihin.ko at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57939

--- Comment #2 from chihin ko  ---
Yeah, difference version of gdb resulting different behavior:

On Red Hat Enterprise Linux Server release 5.4 (Tikanga)
GNU gdb Fedora (6.8-37.el5)
(gdb) p L
$1 = 98
gcc version 4.7.2 (GCC) 

On Oracle Linux Server release 6.3
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-56.el6)
gcc version 4.7.2 (GCC) 
(gdb) p L
$1 = 98 L'b'


so newer gdb work around compiler's problem.
OK you can close this IZ now.


[Bug c++/60948] New: incorrect debug info for reference type of function parameters

2014-04-23 Thread chihin.ko at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60948

Bug ID: 60948
   Summary: incorrect debug info for reference type of function
parameters
   Product: gcc
   Version: 4.8.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chihin.ko at oracle dot com

cat t.cc

#include 

int f(int &r) {
   r = r + 1;
   return r;
}

main(void) {

int j = 99;
int i = 99;

printf("i = %d\n",i);
printf("f(i) = %d\n",f(i));
printf("i = %d\n",i);

return 0;
} 

(dbx) stop at 11;run
(2) stop at "calls_with_refs.cc":11
Running: a.out
(process id 14632)
stopped in main at line 11 in file "calls_with_refs.cc"
   11   int i = 99;
(dbx) call f(33)  <== should have errmsg "dbx: The ref (&) parameters to `f'
cannot be literals" 
-
this is due to g++ generate wrong debug info
for function f(int &), there is an extra "const" , f(const int &),
if there is no "const", then call "f" with constant e.g. f(33), is illegal,
if there is "const", then "call f(33)" is legal. 

There is an extra DW_TAG_const_type for parameter "r" of function "f"
< 2><0x0482>  DW_TAG_formal_parameter
DW_AT_name  "r"
DW_AT_decl_line 0x0003
DW_AT_type  <0x048f>
...
...
< 1><0x048f>DW_TAG_const_type   <== should not have this TAG
  DW_AT_type  <0x0494>


[Bug c++/58198] duplicate codes generated for variant function and base function

2013-08-20 Thread chihin.ko at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58198

--- Comment #2 from chihin ko  ---
(In reply to Jakub Jelinek from comment #1)
> For book keeping of what?  GCC before 4.7.0 are no longer supported.

oracle solstudtio debugger dbx support gnu compiler v4.1 v4.5.2...etc, 
this is to show why dbx has problem with variant function.


[Bug c++/58178] variant function name was used for user defined constructor

2013-08-20 Thread chihin.ko at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58178

--- Comment #9 from chihin ko  ---
(In reply to Eric Botcazou from comment #8)
> The configure line for the compiler is needed on Solaris as well.

Using built-in specs.
COLLECT_GCC=/pkg/gnu/bin/g++-4.8.1-5.10
COLLECT_LTO_WRAPPER=/pkg/gnu/libexec/gcc/i386-pc-solaris2.10/4.8.1/lto-wrapper
Target: i386-pc-solaris2.10
Configured with: ../gcc-4.8.1-src/configure --prefix=/pkg/gnu
--with-as=/pkg/gnu/bin/gnu-as --with-gnu-as
--enable-languages=c++,fortran,go,java --enable-shared --enable-shared
--with-gmp=/pkg/gnu --with-mpc=/pkg/local
--with-boot-ldflags=-R/pkg/local/lib:/pkg/gnu/lib --program-suffix=-4.8.1-5.10
Thread model: posix
gcc version 4.8.1 (GCC)


[Bug c++/58198] New: duplicate codes generated for variant function and base function

2013-08-19 Thread chihin.ko at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58198

Bug ID: 58198
   Summary: duplicate codes generated for variant function and
base function
   Product: gcc
   Version: 4.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chihin.ko at oracle dot com

Created attachment 30675
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30675&action=edit
test case

This problem was fixed after g++ 4.4, I file this bug is only for book keeping.

test case was attached.

pirandello 1017> nm a.out | grep mybase
00400528 T _ZN6mybase10mybasefuncEv
0040054e T _ZN6mybaseC1Ev  <=== base function
0040053a T _ZN6mybaseC2Ev  <=== variant function

base function (_ZN6mybaseC1Ev) and variant function (_ZN6mybaseC2Ev) should
have same addresses, but they're not.

Use gdb to debug a.out, shows bpt stop in variant function instead of base
function:


(gdb) b mybase::mybase
Breakpoint 1 at 0x400542: file base.cc, line 21. (2 locations)
(gdb) run
Starting program:
/net/benjamin2.us.oracle.com/export/ws/jeanko/dinstall/maxirun/intel-Linux/pirandello-chko/results/Customlist_list.master.maxi/gplus_base.dbx,gcc/a.out
 

Breakpoint 1, mybase (this=0x7fff1343ed50) at base.cc:21
21mybaseint = ; 
(gdb) disassemb $pc
Dump of assembler code for function mybase:
0x0040053a :  push   %rbp
0x0040053b :  mov%rsp,%rbp
0x0040053e :  mov%rdi,-0x8(%rbp)
0x00400542 :  mov-0x8(%rbp),%rax
0x00400546 : movl   $0x15b3,(%rax)
0x0040054c : leaveq 
0x0040054d : retq   
End of assembler dump.
(gdb) 

# disassemble base function address shows both functions has exact same codes
(gdb) disassemb 0x40054e
Dump of assembler code for function mybase:
0x0040054e :  push   %rbp
0x0040054f :  mov%rsp,%rbp
0x00400552 :  mov%rdi,-0x8(%rbp)
0x00400556 :  mov-0x8(%rbp),%rax
0x0040055a : movl   $0x15b3,(%rax)
0x00400560 : leaveq 
0x00400561 : retq   
End of assembler dump.
(gdb)


[Bug c++/58178] variant function name was used for user defined constructor

2013-08-19 Thread chihin.ko at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58178

--- Comment #6 from chihin ko  ---
On Linux:

pirandello 934> cat /etc/*release*
Enterprise Linux Enterprise Linux Server release 5.4 (Carthage)
cat: /etc/lsb-release.d: Is a directory
Red Hat Enterprise Linux Server release 5.4 (Tikanga)

/usr/bin/g++ -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic
--host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)


[Bug c++/58178] variant function name was used for user defined constructor

2013-08-19 Thread chihin.ko at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58178

--- Comment #5 from chihin ko  ---
Oracle Solaris 10 8/11 s10x_u10wos_17b X86

DW_AT_producer  "GNU C++ 4.8.1 -mtune=generic -march=pentium4 -g"


[Bug c++/58178] variant function name was used for user defined constructor

2013-08-19 Thread chihin.ko at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58178

--- Comment #3 from chihin ko  ---
a.out execution does not have problem, it is the debugging support would have
problem.


[Bug c++/58178] New: variant function name was used for user defined constructor

2013-08-16 Thread chihin.ko at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58178

Bug ID: 58178
   Summary: variant function name was used for user defined
constructor
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chihin.ko at oracle dot com

test case:
cat t.cc

#include 
struct base {
   int x;
   base() { x= 2;};
};

struct A {
static int x;
struct B :base{
void f() {
x++;
printf("x= %d\n",x);
}
};
};

 int A::x = 12;

 main()
 {
 A::B z;
 z.f();
 }
/pkg/gnu/bin/g++  -R/pkg/gnu/lib -R/pkg/gnu/lib/amd64 -g t.cc

mandelstam.us.oracle.com 2528> nm a.out | grep base
[95]| 134548914|14|FUNC |WEAK |0|11 |_ZN4baseC2Ev

base class has user defined constructor, I'm expecting _ZN4baseC1Ev from nm
dump


[Bug debug/57939] New: incorrect debug info of wchar_t

2013-07-19 Thread chihin.ko at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57939

Bug ID: 57939
   Summary: incorrect debug info of wchar_t
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: chihin.ko at oracle dot com

cat t.cc
#include 

void foo(wchar_t c) { printf("In foo(wchar_t) %d\n", c); }

main()
{
wchar_t L = L'b';
}

g++ -std=c++11 -g t.cc

gdb a.out

Breakpoint 1, main () at t.cc:7
7   wchar_t L = L'b';
(gdb) next
8   }
(gdb) p L
$2 = 98  <== should be 'b'


DW_TAG_base_type
DW_AT_byte_size 0x0004
DW_AT_encoding  DW_ATE_signed << should be DW_ATE_unsigned_char
DW_AT_name  "wchar_t"


[Bug c++/56251] no DW_AT_const_value for static const member of a template class

2013-02-08 Thread chihin.ko at oracle dot com


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



--- Comment #4 from chihin ko  2013-02-08 22:01:36 
UTC ---

Note, this is a const static member, the initialization is the definition,

if I don't initialize it, I would get an "Undefined symbol" linking error.

This code is valid.


[Bug c++/56251] no DW_AT_const_value for static const member of a template class

2013-02-08 Thread chihin.ko at oracle dot com


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



--- Comment #2 from chihin ko  2013-02-08 21:24:55 
UTC ---

How is it invalid ? it was compilable and runnable:



benjamin2 906> /pkg/gnu/bin/g++ -v

Using built-in specs.

COLLECT_GCC=/pkg/gnu/bin/g++-4.7.1-5.10

COLLECT_LTO_WRAPPER=/pkg/gnu/libexec/gcc/i386-pc-solaris2.10/4.7.1/lto-wrapper

Target: i386-pc-solaris2.10

Configured with: ../gcc-4.7.1-src/configure --prefix=/pkg/gnu

--with-as=/pkg/gnu/bin/gas --with-gnu-as --enable-languages=c++,fortran

--enable-shared --enable-shared --with-gmp=/pkg/gnu --with-mpc=/pkg/local

--with-boot-ldflags=-R/pkg/local/lib:/pkg/gnu/lib --program-suffix=-4.7.1-5.10

Thread model: posix

gcc version 4.7.1 (GCC) 



benjamin2 907> /pkg/gnu/bin/g++ -std=c++11 -R/pkg/gnu/lib t1.cc



benjamin2 908> a.out

tcc.value1 = 100 

cc.value1 = 200


[Bug c++/56251] New: no DW_AT_const_value for static const member of a template class

2013-02-07 Thread chihin.ko at oracle dot com


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



 Bug #: 56251

   Summary: no DW_AT_const_value  for static const member of a

template class

Classification: Unclassified

   Product: gcc

   Version: 4.6.2

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: c++

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

ReportedBy: chihin...@oracle.com





If a static const member is in template class, there is no DW_AT_const_value

info,

compare these tvalue/value





< 2><0x005a>  DW_TAG_member

DW_AT_name  "value"

DW_AT_decl_file 0x0001 t.cc

DW_AT_decl_line 0x0009

DW_AT_type  <0x0069>

DW_AT_external  yes(1)

DW_AT_declaration   yes(1)

DW_AT_const_value   200(as signed = -56)  <===

const value

< 1><0x0069>DW_TAG_const_type

  DW_AT_type  <0x002c>



-



< 2><0x007a>  DW_TAG_member

DW_AT_name  "tvalue"

DW_AT_decl_file 0x0001 t.cc

DW_AT_decl_line 0x0005

DW_AT_type  <0x0069>

DW_AT_external  yes(1)

DW_AT_declaration   yes(1)

< no

const value

< 2><0x0087>  DW_TAG_template_type_parameter

DW_AT_name  "T0"





cat t.cc



#include 



template

struct TCC {

static const T0 tvalue = 100;

};



struct CC {

static const int value = 200;

};



int main()

{

CC cc;

TCC tcc;



printf("tcc.value1 = %u \n", tcc.tvalue);

printf("cc.value1 = %u \n", cc.value);

}


[Bug debug/56236] New: incorrect debug info for decltype(nullptr)

2013-02-06 Thread chihin.ko at oracle dot com


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



 Bug #: 56236

   Summary: incorrect debug info for decltype(nullptr)

Classification: Unclassified

   Product: gcc

   Version: 4.6.2

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: debug

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

ReportedBy: chihin...@oracle.com





g++ does not resolve decltype(nullptr) to base type nullptr_t, instead it

generate following: 



  < 1><0x05d3>DW_TAG_unspecified_type

  DW_AT_name  "decltype(nullptr)"



g++ should generate something like this:



< 1><0x05d3>DW_TAG_base_type

  DW_AT_name  "nullptr_t"

  DW_AT_encoding  DW_ATE_boolean

  DW_AT_byte_size 0x0004



main() {

int i;

decltype(nullptr) np;



np = 0;

i = sizeof(np);

}


[Bug c++/55785] New: gcc4.5.2 incorrect line # of caller for destructor

2012-12-21 Thread chihin.ko at oracle dot com


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



 Bug #: 55785

   Summary: gcc4.5.2 incorrect line # of caller for destructor

Classification: Unclassified

   Product: gcc

   Version: 4.5.2

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: c++

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

ReportedBy: chihin...@oracle.com





Created attachment 29024

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

c++ test case



platform Solaris intel



build command

/net/gozo/sqe/tools/gcc/4.5.2/intel-S2/bin/g++   002.cc -g



(dbx) stop in stack::~stack

(dbx) run

Running: a.out

(process id 13901)

stopped in stack::~stack at line 73 in file "002.cc"

   73delete bottom;

stack::~stack(this = 0x8044c90) called from function reverse_name



(dbx) where

=>[1] stack::~stack(this = 0x8044c90), line 73 in "002.cc"

  [2] reverse_name(name = 0x80511dc "Honey"), line 77 in "002.cc"  <== should

be line 87

  [3] main(), line 96 in "002.cc"



gcc4.7 does not have this problem.



This is due to gcc4.5.2 compiler generate extra line 77 in line table:



a.out dwarfdump:



0x080510c8  [  84, 0] NS

0x080510e3  [  86, 0] NS

0x080510f4  [  87, 0] NS

0x080510f7  [  77, 0] NS  <== extra line 77

0x08051104  [  88, 0] NS

0x0805110c  [  77, 0] NS  <== extra

0x08051121  [  91, 0] NS



compare the address 0x080510fd of "call ~stack" down below, the extra line 77

in line table, mess up the address/line mapping when doing command "where".



   87 return reverse;

0x080510f4: reverse_name+0x00b4:movl 0xfff0(%ebp),%ebx

0x080510f7: reverse_name+0x00b7:leal 0xffe8(%ebp),%eax

0x080510fa: reverse_name+0x00ba:movl %eax,(%esp)

0x080510fd: reverse_name+0x00bd:call ~stack [ 0x805102a, .-0xd3 ]

0x08051102: reverse_name+0x00c2:movl %ebx,%eax

   88   }

0x08051104: reverse_name+0x00c4:addl $0x0024,%esp

0x08051107: reverse_name+0x00c7:popl %ebx

0x08051108: reverse_name+0x00c8:popl %ebp

0x08051109: reverse_name+0x00c9:ret  

0x0805110a: reverse_name+0x00ca:movl %eax,%ebx

0x0805110c: reverse_name+0x00cc:leal 0xffe8(%ebp),%eax

0x0805110f: reverse_name+0x00cf:movl %eax,(%esp)

0x08051112: reverse_name+0x00d2:call ~stack [ 0x805102a, .-0xe8 ]

0x08051117: reverse_name+0x00d7:movl %ebx,%eax

0x08051119: reverse_name+0x00d9:movl %eax,(%esp)

0x0805111c: reverse_name+0x00dc:call _Unwind_Resume [PLT]   [

0x8050d64, .-0x3b8 ]

   89


[Bug debug/54774] [4.4.4, 4.5, 4.6, 4.7] insufficient debug info for strong typed enum

2012-12-06 Thread chihin.ko at oracle dot com


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



chihin ko  changed:



   What|Removed |Added



Summary|insufficient debug info for |[4.4.4, 4.5, 4.6, 4.7]

   |strong typed enum   |insufficient debug info for

   ||strong typed enum



--- Comment #3 from chihin ko  2012-12-06 19:57:46 
UTC ---

This problem can trace back from gcc 4.4.4.


[Bug c++/55541] New: unable to see local variables due extra lexical block was generated

2012-11-29 Thread chihin.ko at oracle dot com


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



 Bug #: 55541

   Summary: unable to see local variables due extra lexical block

was generated

Classification: Unclassified

   Product: gcc

   Version: 4.6.2

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: c++

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

ReportedBy: chihin...@oracle.com





There is a regression present gcc4.4.4: the compiler 

generates a bogus lexical block marker in the debug info, more precisely 

between the parameters and the local variables of functions.  This is related 

to http://gcc.gnu.org/ml/gcc-patches/2010-08/msg02111.html



This affect gdb/dbx behavior, that debugger users are not able to inspect local

variable value when stop at "}" line of a function, for detail, please refer to

gdb bugzilla



http://sourceware.org/bugzilla/show_bug.cgi?id=14850



for following test cast



int

main() {

int i;

i = 10;

}



if I stop at  } of main and print i, gdb gave error:

tarting program: /home/chko/core/g++/g45/a.out



Breakpoint 1, main () at t.cc:4

4   i = 10;

(gdb) p i

$1 = 0

(gdb) n

5   }

(gdb) p i

No symbol "i" in current context.

(gdb)



This is due to "i" was within DW_TAG_lexical_block:



< 1><0x0025>DW_TAG_subprogram

  DW_AT_external  yes(1)

  DW_AT_name  "main"

  DW_AT_decl_file 0x0001 /tmp/t.cc

  DW_AT_decl_line 0x0003

  DW_AT_type  <0x0059>

  DW_AT_low_pc0x08050990

  DW_AT_high_pc   0x080509a4

  DW_AT_frame_base

[ 0]DW_OP_breg4+4

[ 1]DW_OP_breg4+8

[ 2]DW_OP_breg5+8

[ 3]DW_OP_breg4+4

  DW_AT_GNU_all_call_sitesyes(1)

  DW_AT_sibling   <0x0059>

< 2><0x0042>  DW_TAG_lexical_block

DW_AT_low_pc0x08050996

DW_AT_high_pc   0x0805099d

< 3><0x004b>DW_TAG_variable

  DW_AT_name  "i"

  DW_AT_decl_file 0x0001 /tmp/t.cc

  DW_AT_decl_line 0x0004

  DW_AT_type  <0x0059>

  DW_AT_location  DW_OP_fbreg -12

< 1><0x0059>DW_TAG_base_type

  DW_AT_byte_size 0x0004

  DW_AT_encoding  DW_ATE_signed

  DW_AT_name  "int"


[Bug debug/54774] New: insufficient debug info for strong typed enum

2012-10-01 Thread chihin.ko at oracle dot com


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



 Bug #: 54774

   Summary: insufficient debug info for strong typed enum

Classification: Unclassified

   Product: gcc

   Version: 4.6.2

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: debug

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

ReportedBy: chihin...@oracle.com





Created attachment 28320

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

compileable c++ test case and dwarf dump



For strong typed enum, there is no  type information:



#include 



enum UI: unsigned int

{

None = 0,

Single = 1,

Multiple = 0xU

};



 <1><26aa>: Abbrev Number: 69 (DW_TAG_enumeration_type)

 DW_AT_name: UI

 DW_AT_byte_size   : 4

 DW_AT_decl_file   : 1

 DW_AT_decl_line   : 3

 DW_AT_sibling : <26cc>



  Should have a DW_AT_type :  under DW_TAG_enumeration_type


[Bug debug/54773] New: no debug info generated for rvalue reference

2012-10-01 Thread chihin.ko at oracle dot com


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



 Bug #: 54773

   Summary: no debug info generated for rvalue reference

Classification: Unclassified

   Product: gcc

   Version: 4.6.2

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: debug

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

ReportedBy: chihin...@oracle.com





Created attachment 28318

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

compileable c++ test case and dwarf dump



for c++0x feature rvalue reference, g++ should generate

DW_TAG_rvalue_reference_type, g++ generate DW_TAG_reference_type instead:



see attachment for test cases: a.out.dw 

shows debug info for function "void foo(int&& ii)" are





< 2><0x0992>  DW_TAG_formal_parameter

DW_AT_name  "ii"

DW_AT_decl_file 0x0001

/net/benjamin2/export/ws/jeanko/ws/dbx_test/bugid/7189973/intel-Linux/t.cc

DW_AT_decl_line 0x001b

DW_AT_type  <0x09a0>

DW_AT_location  DW_OP_fbreg -24

< 1><0x09a0>DW_TAG_const_type

  DW_AT_type  <0x09a5>

< 1><0x09a5>DW_TAG_reference_type

  DW_AT_byte_size 0x0008

  DW_AT_type  <0x0062>