[Bug debug/86362] New: Members of enum class in .debug_gnu_pubnames without scope, leading to gdbindex issues

2018-06-29 Thread loic.yhuel at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86362

Bug ID: 86362
   Summary: Members of enum class in .debug_gnu_pubnames without
scope, leading to gdbindex issues
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: loic.yhuel at gmail dot com
  Target Milestone: ---

Enum class values are added to .debug_gnu_pubnames without scope, which leads
to conflicts in gdbindex when there are classes with the same name (for example
WebCore::Frame class and WebCore::ObjectContentType::Frame enum class value in
WebKit). Then gdb isn't able to get the correct type info for the class.

I think .debug_gnu_pubnames in bar.o should either :
 - don't have the enum class value (gdb seems to be able to get it looking at
the enum class debuginfo)
 - have it with the class scope

foo.cpp :
class Foo {
Foo();
};
// make sure g++ will put class type in debug info
// .debug_gnu_pubtypes will contain "g,type Foo"
Foo::Foo()
{
}

bar.cpp :
enum class Bar {
Foo
};
// .debug_gnu_pubnames will contain "g,variable Foo" !
Bar var = Bar::Foo;


g++ -gsplit-dwarf -c foo.cpp -o foo.o
g++ -gsplit-dwarf -c bar.cpp -o bar.o
g++ -fuse-ld=gold -shared -o lib.so -Wl,--gdb-index bar.o foo.o

=> "readelf --debug-dump=gdb_index lib.so" shows :
[661] Foo:
0 [global, variable]
1 [global, type]

In gdb, "ptype Foo" returns "No symbol "Foo" in current context." (due to
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blobdiff;f=gdb/dwarf2read.c;h=c5c3b5c225493d52cd96ddd52d57244e02485128;hp=7e87ed9adde38402d707ac2bd7c3757ba87847a6;hb=8943b874760d9cf35b71890a70af9866e4fab2a6;hpb=6adcee1866fe6b700bc1cc5a9675479530af7205,
gdb only loads the first CU).
If I put foo.o before bar.o, it works since the CU are swapped.

With -g instead of -gsplit-dwarf, and gdb_index still generated by gold
[661] Foo:
0 [global, no info]
1 [global, no info]
=> "ptype Foo" correctly prints "class Foo ...", since symbol attributes aren't
present so the gdb loads both CUs

With -g instead of -gsplit-dwarf, and gdb_index generated by gdb
[661] Foo:
1 [global, type]
0 [global, variable]
=> "ptype Foo" correctly prints "class Foo ...", since the CU 1 is first
I don't know if it's by chance or not.

With clang, it generates .debug_pubnames/.debug_pubtypes by default, then gold
produces an empty index, and gdb loads both CU on start.
But with -ggnu-pubnames, I get .debug_gnu_pubnames/.debug_gnu_pubtypes, and an
index with only the class for "Foo".

[Bug ipa/67368] Inlining failed due to no_sanitize_address and always_inline conflict

2017-10-04 Thread loic.yhuel at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368

Loïc Yhuel  changed:

   What|Removed |Added

 CC||loic.yhuel at gmail dot com

--- Comment #4 from Loïc Yhuel  ---
(In reply to Andrey Ryabinin from comment #3)
> Nope, it was prohibited because no_sanitize_address didn't work for inlined
> function https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59600.

So this case should work : functions inlined into a no_sanitize_address
function would have the sanitizer disabled.
Unlike the opposite, which could crash, this one only could fail to detect
issues at runtime, so perhaps it should only be a warning.

[Bug c++/78724] New: Incorrect ambiguous reference error when templace class was forward declarated as a friend

2016-12-07 Thread loic.yhuel at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78724

Bug ID: 78724
   Summary: Incorrect ambiguous reference error when templace
class was forward declarated as a friend
   Product: gcc
   Version: 6.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: loic.yhuel at gmail dot com
  Target Milestone: ---

namespace A {
template
class B {
template friend class C;
};
}

void foo()
{
A::B b;
}

namespace A {
template
class C {
};
}

using namespace A;

void bar()
{
C c;
}

=>
test.cpp: In function ‘void bar()’:
hello.cpp:23:5: error: reference to ‘C’ is ambiguous
 C c;
 ^
test.cpp:4:38: note: candidates are: template class A::C
 template friend class C;
  ^
hello.cpp:15:11: note: template class A::C
 class C {
   ^

Note that the error doesn't happen when using "A::C c".


The bug is seen with libc++ 3.9.0 headers :
#include 
void foo()
{
std::map<void*,void*>::iterator it;
}
#include 
using namespace std;
void bar()
{
set<void*> s;
}

[Bug c++/69521] -Wdeprecated-declarations errors in unused inline methods

2016-01-27 Thread loic.yhuel at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69521

Loïc Yhuel  changed:

   What|Removed |Added

 CC||loic.yhuel at gmail dot com

--- Comment #1 from Loïc Yhuel  ---
> If it's easier to do, perhaps using a deprecated function in a deprecated
> function shouldn't produce a warning (deprecated code would be able to use
> other deprecated code).
Clang seems to do this.
Testing with clang 3.7, the 3 cases (first code, second code in C++ mode,
second code in C mode) don't produce any warning, unless I remove the
deprecated attribute from qLowerBound.

[Bug c++/69521] New: -Wdeprecated-declarations errors in unused inline methods

2016-01-27 Thread loic.yhuel at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69521

Bug ID: 69521
   Summary: -Wdeprecated-declarations errors in unused inline
methods
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: loic.yhuel at gmail dot com
  Target Milestone: ---

In Qt's qalgorithms.h, there is a deprecated inline method using a deprecated
class, which can be simplified to :
class __attribute__((deprecated)) qLess { };

__attribute__((deprecated)) inline void qLowerBound()
{
qLess();
}

int main()
{
return 0;
}
=> "warning: ‘qLess’ is deprecated [-Wdeprecated-declarations]" with g++ 4.9.3
/ 5.2.1 / 5.3.0 / 5.3.1
With g++ 4.8.4, there was no warning.


It's even worse using a deprecated method :
__attribute__((deprecated)) inline void qLess() {}

__attribute__((deprecated)) inline void qLowerBound()
{
qLess();
}

int main()
{
return 0;
}
=> "warning: ‘void qLess()’ is deprecated [-Wdeprecated-declarations]"
The warning is printed :
 - 3 times in C++ mode with g++ 5.2.1 / 5.3 / 5.3.1
 - 2 times in C++ mode with g++ 4.8.4 / 4.9.3
 - 1 time in C mode with gcc 4.8.4 / 4.9.3 / 5.2.1 / 5.3 / 5.3.1


Perhaps there are two issues here, with the same warning being reported several
times in C++ mode, but the first problem is : should the compiler report
deprecated-declarations warning when the usage is in an unused (especially
inline) function ?

If it's easier to do, perhaps using a deprecated function in a deprecated
function shouldn't produce a warning (deprecated code would be able to use
other deprecated code).

[Bug c++/52746] New: [4.7 Regression] Explicit virtual destructor call replaced by direct call in template function

2012-03-27 Thread loic.yhuel at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52746

 Bug #: 52746
   Summary: [4.7 Regression] Explicit virtual destructor call
replaced by direct call in template function
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: major
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: loic.yh...@gmail.com
  Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu


#include stdio.h

class A
{
public:
virtual ~A()
{
printf(~A()\n);
}
};

class B : public A
{
public:
virtual ~B()
{
printf(~B()\n);
}
};

templateint void test()
{
B * b = new B;

A * a = reinterpret_castA*(b);
a-~A();

::operator delete(b);
}

int main(void)
{
test0();

return 0;
}


Compile with g++
With 4.6.3, it outputs ~B() and ~A(), since a-~A() is the expected virtual
call, which will target B::~B() in this case.
With 4.7.0, it only outputs ~A(), a-~A() is a direct call to A::~A().

The bug doesn't happen if test() function is not a template.