[Bug c++/88529] New: G++ clears the return register on x86_64 when returning an empty class

2018-12-17 Thread rohan at rohanlean dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88529

Bug ID: 88529
   Summary: G++ clears the return register on x86_64 when
returning an empty class
   Product: gcc
   Version: 8.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: rohan at rohanlean dot de
  Target Milestone: ---
Target: x86_64

The following code causes G++ to emit an "xorl %eax, %eax" on x86_64. I believe
the Itanium ABI does not require it, so this is a missed optimisation.

class A{};

A f() { return {}; }

[Bug c++/62240] New: A using-declaration within a class can publish a public base of a private base.

2014-08-23 Thread rohan at rohanlean dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62240

Bug ID: 62240
   Summary: A using-declaration within a class can publish a
public base of a private base.
   Product: gcc
   Version: 4.9.1
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: rohan at rohanlean dot de

Created attachment 33384
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33384action=edit
small testcase

Suppose that three classes are related by inheritance (B --- A : B inherits
from A) as follows:

  C ---private-- B ---public-- A

Then C can publish A via

  using B::A;

I think that the correct behaviour is to reject such a program.


[Bug c/58267] New: Alignment specifier allowed within array declarator;

2013-08-28 Thread rohan at rohanlean dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58267

Bug ID: 58267
   Summary: Alignment specifier allowed within array declarator;
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: rohan at rohanlean dot de

“char s[_Alignas (int) 7];” is accepted without warnings in strict C11 mode.  I
cannot construct that declaration using the grammar in appendix A.2 of the
standard.

[Bug c/55546] New: Static functions that are fully inlined can end up in the object file

2012-11-30 Thread rohan at rohanlean dot de


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



 Bug #: 55546

   Summary: Static functions that are fully inlined can end up in

the object file

Classification: Unclassified

   Product: gcc

   Version: 4.7.2

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: c

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

ReportedBy: ro...@rohanlean.de





Created attachment 28838

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

A rather minimal test-case for the bug.



If a static function has its address taken in the C code, but due to

optimisations the address is never used, then the function can still end up in

the object file.  I have attached a file to demonstrate the bug.  When I

compile it with -std=c11 -O3, the resulting executable will contain code for f,

even though it is not needed.  (As an aside, if you add another function

similar to f, and call h with each of them, then gcc will not resolve things so

nicely at compile time and also emit code for h.)