[Bug c++/81692] New: Bogus noreturn warning

2017-08-03 Thread gcc at sjor dot sg
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81692

Bug ID: 81692
   Summary: Bogus noreturn warning
   Product: gcc
   Version: 7.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gcc at sjor dot sg
  Target Milestone: ---

The following code will cause a -Wreturn-type warning to be emitted in the
'foo' function, even though 'foo' calls throw_exception_ which is marked
__attribute__((__noreturn__)).

This test case is as minimal as I could get it: the problem is gone if
throw_exception_ or foo are no longer templated, or if foo does not use
__PRETTY_FUNCTION__.

Confirmed on gcc 6.2.0-5ubuntu12 and gcc 7.1.1 from Arch.


__attribute__ ((__noreturn__)) void abort();

template 
__attribute__ ((__noreturn__))
void
throw_exception_( E const & x, char const * current_function)
{
abort();
}

template 
int foo() {
  int exc;
  throw_exception_(exc, __PRETTY_FUNCTION__);
}

[Bug c++/81410] New: O3 breaks code

2017-07-12 Thread gcc at sjor dot sg
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81410

Bug ID: 81410
   Summary: O3 breaks code
   Product: gcc
   Version: 7.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gcc at sjor dot sg
  Target Milestone: ---

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

See attached code. Tested on Ubuntu's gcc 6.2.0, Debian's 6.3.0, Arch's 7.1.1.
Testcase is about as minimal as I could get it.

Compile with -O3 -std=c++11.

As you see, it extracts data from a vector to two vectors. Then, it
checks whether the vector.first and vector have the same
values. If so, it exit(1)'s which confirms the bug is present.

[Bug c++/81410] O3 breaks code

2017-07-12 Thread gcc at sjor dot sg
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81410

--- Comment #1 from Sjors Gielen  ---
This is on x86_64 by the way. Doesn't happen with -m32.

[Bug c++/81410] O3 breaks code

2017-07-12 Thread gcc at sjor dot sg
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81410

--- Comment #3 from Sjors Gielen  ---
A trivial workaround is put inside the first loop:

  std::cout << "";

I suppose this prevents loop optimization by introducing potential side
effects.

[Bug tree-optimization/81410] [6 Regression] -O3 breaks code

2017-10-10 Thread gcc at sjor dot sg
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81410

--- Comment #14 from Sjors Gielen  ---
(In reply to Jakub Jelinek from comment #13)
> GCC 5 branch is being closed

Has there been a fix for this issue at all in a 5 branch release?

And, for the 6 branch, will there be a release with a fix for this issue?