[Bug middle-end/79665] gcc's signed (x*x)/200 is slower than clang's

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79665

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Jakub Jelinek  ---
Fixed.  If this makes -mcpu=cortex-a53 slower, then it doesn't have right costs
function.

[Bug middle-end/79665] gcc's signed (x*x)/200 is slower than clang's

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79665

--- Comment #7 from Jakub Jelinek  ---
Author: jakub
Date: Thu Feb 23 07:49:06 2017
New Revision: 245676

URL: https://gcc.gnu.org/viewcvs?rev=245676=gcc=rev
Log:
PR middle-end/79665
* internal-fn.c (get_range_pos_neg): Moved to ...
* tree.c (get_range_pos_neg): ... here.  No longer static.
* tree.h (get_range_pos_neg): New prototype.
* expr.c (expand_expr_real_2) : If both arguments
are known to be in between 0 and signed maximum inclusive, try to
expand both unsigned and signed divmod and use the cheaper one from
those.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/expr.c
trunk/gcc/internal-fn.c
trunk/gcc/tree.c
trunk/gcc/tree.h

[Bug tree-optimization/79578] Unnecessary instructions in generated code

2017-02-22 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79578

Jeffrey A. Law  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Jeffrey A. Law  ---
Fixed on the trunk.

[Bug tree-optimization/79578] Unnecessary instructions in generated code

2017-02-22 Thread law at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79578

--- Comment #6 from Jeffrey A. Law  ---
Author: law
Date: Thu Feb 23 05:47:43 2017
New Revision: 245675

URL: https://gcc.gnu.org/viewcvs?rev=245675=gcc=rev
Log:
PR tree-optimization/79578
* tree-ssa-dse.c (clear_bytes_written_by): Use operand_equal_p
to compare base operands.

PR tree-optimization/79578
* g++.dg/tree-ssa/ssa-dse-3.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/tree-ssa/ssa-dse-3.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-dse.c

[Bug c++/79679] [7 Regression] [C++17] Missing destruction of temporary within constructor's mem-initializer-list

2017-02-22 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79679

--- Comment #4 from Jason Merrill  ---
Author: jason
Date: Thu Feb 23 01:15:43 2017
New Revision: 245672

URL: https://gcc.gnu.org/viewcvs?rev=245672=gcc=rev
Log:
PR c++/79679 - missing destructor for argument
* call.c (build_over_call): Don't pass tf_no_cleanup to argument
conversions.

Added:
trunk/gcc/testsuite/g++.dg/init/cleanup4.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c

[Bug c++/79679] [7 Regression] [C++17] Missing destruction of temporary within constructor's mem-initializer-list

2017-02-22 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79679

Jason Merrill  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |7.0

--- Comment #3 from Jason Merrill  ---
Fixed.

[Bug tree-optimization/79683] New: SLP vectorizer drops gs: prefix

2017-02-22 Thread me at manueljacob dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79683

Bug ID: 79683
   Summary: SLP vectorizer drops gs: prefix
   Product: gcc
   Version: 7.0.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: me at manueljacob dot de
CC: amker at gcc dot gnu.org, jakub at redhat dot com,
rguenth at gcc dot gnu.org
  Target Milestone: ---

This happens at least on x86-64 with -ftree-slp-vectorize.  This is the C
source:

struct s {
long a;
long b;
};
void test(struct s __seg_gs *x) {
x->a += 1;
x->b -= 1;
}

This is the resulting code with -O1:

addq$1, %gs:(%rdi)
subq$1, %gs:8(%rdi)

This is the resulting code with -O1 -ftree-slp-vectorize:

movdqu  (%rdi), %xmm0
paddq   .LC0(%rip), %xmm0
movups  %xmm0, %gs:(%rdi)
[...]
.LC0:
.quad   1
.quad   -1

The memory access in movdqu is missing the gs: prefix.

(Apart from that I would say that this transformation, even if done right, may
not be a good idea, but that's not part of this bug report).

[Bug c++/79679] [7 Regression] [C++17] Missing destruction of temporary within constructor's mem-initializer-list

2017-02-22 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79679

Jason Merrill  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jason at gcc dot gnu.org

[Bug target/79211] [7 Regression] ICE in extract_insn, at recog.c:2311

2017-02-22 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79211

Segher Boessenkool  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Segher Boessenkool  ---
Fixed.

[Bug target/79211] [7 Regression] ICE in extract_insn, at recog.c:2311

2017-02-22 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79211

--- Comment #6 from Segher Boessenkool  ---
Author: segher
Date: Wed Feb 22 23:50:46 2017
New Revision: 245667

URL: https://gcc.gnu.org/viewcvs?rev=245667=gcc=rev
Log:
rs6000: Fix fsel pattern (PR79211)

The fsel define_insn uses fpr_reg_operand for its predicates.  This
won't work because passes can put a hard register in the operands: in
the testcase, combine likes to forward the parameter registers to what
then is still an smin, and then split1 uses "*s3_fpr"
(which has gpc_reg_operand).  And then we have a GPR in the operand,
which does not match fpr_reg_operand.

It seems to me the predicates should be gpc_reg_operand here as well.
This patch changes that.


PR target/79211
* config/rs6000/rs6000.md (*fsel4): Use
gpc_reg_operand instead of fpr_reg_operand.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/rs6000/rs6000.md

[Bug c++/77958] printf format checking -vs- variadic template functions

2017-02-22 Thread bugzi...@poradnik-webmastera.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77958

--- Comment #3 from Daniel Fruzynski  ---
This attribute should also work when some parameters are not variadic ones. One
use case presented in bug 79680 is to have two overloaded logging function: one
printf-like, and another one which accepts constant string only. So something
like this should work too:

template
static void
 __attribute__ ((format (printf, 1, 2)))
whatever(const char *fmt, Arg1&& arg1, Args&&... args)
{
  printf(fmt, arg1, args...);
}

Please also consider case when type of arg1 is specified explicitly, someone
may find it useful too:

template
static void
 __attribute__ ((format (printf, 1, 2)))
whatever(const char *fmt, int arg1, Args&&... args)
{
  printf(fmt, arg1, args...);
}

[Bug c++/79682] New: [concepts] ambiguous overload with functionally equivalent predicate constraints compiles

2017-02-22 Thread hstong at ca dot ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79682

Bug ID: 79682
   Summary: [concepts] ambiguous overload with functionally
equivalent predicate constraints compiles
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hstong at ca dot ibm.com
  Target Milestone: ---

Given the following source, the normalized constraints of the foo() returning
int contains predicate constraints:
N > 1
- and -
(N & 0x1) != 0

The normalized constraints of the foo() returning void contains:
(N & 0x1) != 0x0

The similar looking predicate constraints are not equivalent
([temp.over.link]).

The call in main() should therefore be ambiguous.

### Source ():
template 
requires (N & 0x1) != 0 && (N > 1)
int foo() { return 0; }

template 
requires (N & 0x1) != 0x0
void foo() { }

int main(void) {
  return foo<0x03>();
}

### Compiler invocation:
g++ -std=c++1z -fconcepts -c -o /dev/null -x c++ -

### Actual output:
(Clean compile)

### Expected output:
: In function 'int main()':
:10:20: error: call of overloaded 'foo<3>()' is ambiguous
:3:5: note: candidate: int foo() [with unsigned int N = 3]
:7:6: note: candidate: void foo() [with unsigned int N = 3]

### Compiler version (g++ -v):
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-head/bin/g++
COLLECT_LTO_WRAPPER=/usr/local/gcc-head/libexec/gcc/x86_64-pc-linux-gnu/7.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/heads/gcc/gcc-source/configure
--prefix=/usr/local/gcc-head --enable-languages=c,c++ --enable-lto
--disable-multilib --without-ppl --without-cloog-ppl --enable-checking=release
--disable-nls
Thread model: posix
gcc version 7.0.1 20170125 (experimental) (GCC)

[Bug c++/79679] [7 Regression] [C++17] Missing destruction of temporary within constructor's mem-initializer-list

2017-02-22 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79679

Jonathan Wakely  changed:

   What|Removed |Added

 CC||jason at gcc dot gnu.org

--- Comment #2 from Jonathan Wakely  ---
Started with r245612

PR c++/78139 - destructor needed by new-expression

* call.c (build_special_member_call): Use tf_no_cleanup.

[Bug target/79261] vec_xxpermdi appears to have endian issues

2017-02-22 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79261

--- Comment #3 from Bill Schmidt  ---
Author: wschmidt
Date: Wed Feb 22 22:52:36 2017
New Revision: 245663

URL: https://gcc.gnu.org/viewcvs?rev=245663=gcc=rev
Log:
[gcc]

2017-02-22  Bill Schmidt  

Backport from mainline
2017-02-17  Bill Schmidt  

PR target/79261
* config/rs6000/rs6000.c (rs6000_expand_ternop_builtin): Add
support for CODE_FOR_vsx_xxpermdi_v2d[fi]_be.
* config/rs6000/rs6000.md (reload_gpr_from_vsx): Call
generator for vsx_xxpermdi__be.
* config/rs6000/vsx.md (vsx_xxpermdi_): Remove logic to
force big-endian semantics.
(vsx_xxpermdi__be): New define_expand with same
implementation as previous version of vsx_xxpermdi_.

[gcc/testsuite]

2017-02-22  Bill Schmidt  

Backport from mainline
2017-02-17  Bill Schmidt  

PR target/79261
* gcc.target/powerpc/vec-xxpermdi.c: New file.


Added:
branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/vec-xxpermdi.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/config/rs6000/rs6000.c
branches/gcc-6-branch/gcc/config/rs6000/rs6000.md
branches/gcc-6-branch/gcc/config/rs6000/vsx.md
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug target/79261] vec_xxpermdi appears to have endian issues

2017-02-22 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79261

Bill Schmidt  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Bill Schmidt  ---
Fixed everywhere.

[Bug c++/79681] New: ICE with constexpr and bitfield

2017-02-22 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79681

Bug ID: 79681
   Summary: ICE with constexpr and bitfield
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following valid code snippet triggers an ICE since GCC 5.1.0:


struct A
{
  int i : 4;
};

constexpr bool foo()
{
  A x[] = { 1 };
  return x[0].i;
}

bool b = foo();


bug.cc:12:13:   in constexpr expansion of 'foo()'
bug.cc:12:14: internal compiler error: tree check: expected field_decl, have
integer_cst in bit_position, at tree.c:3022
 bool b = foo();
  ^
0xffc41c tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc/gcc/tree.c:9813
0xffc5b8 tree_check(tree_node const*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:3320
0xffc5b8 bit_position(tree_node const*)
../../gcc/gcc/tree.c:3022
0x83a8c3 cxx_eval_bit_field_ref
../../gcc/gcc/cp/constexpr.c:2472
0x83a8c3 cxx_eval_constant_expression
../../gcc/gcc/cp/constexpr.c:4276
0x844b12 cxx_eval_binary_expression
../../gcc/gcc/cp/constexpr.c:1935
0x83a59a cxx_eval_constant_expression
../../gcc/gcc/cp/constexpr.c:4233
0x844b12 cxx_eval_binary_expression
../../gcc/gcc/cp/constexpr.c:1935
0x83a59a cxx_eval_constant_expression
../../gcc/gcc/cp/constexpr.c:4233
0x83e5ed cxx_eval_store_expression
../../gcc/gcc/cp/constexpr.c:3530
0x83a1b8 cxx_eval_constant_expression
../../gcc/gcc/cp/constexpr.c:4051
0x83c629 cxx_eval_constant_expression
../../gcc/gcc/cp/constexpr.c:4063
0x83ab94 cxx_eval_statement_list
../../gcc/gcc/cp/constexpr.c:3738
0x83ab94 cxx_eval_constant_expression
../../gcc/gcc/cp/constexpr.c:4434
0x83ad22 cxx_eval_constant_expression
../../gcc/gcc/cp/constexpr.c:4440
0x8390f2 cxx_eval_call_expression
../../gcc/gcc/cp/constexpr.c:1641
0x83ad43 cxx_eval_constant_expression
../../gcc/gcc/cp/constexpr.c:3973
0x840ace cxx_eval_outermost_constant_expr
../../gcc/gcc/cp/constexpr.c:4615
0x844194 maybe_constant_init(tree_node*, tree_node*)
../../gcc/gcc/cp/constexpr.c:4938
0x6b4c64 store_init_value(tree_node*, tree_node*, vec**, int)
../../gcc/gcc/cp/typeck2.c:819
Please submit a full bug report, [etc.]

[Bug target/79261] vec_xxpermdi appears to have endian issues

2017-02-22 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79261

--- Comment #4 from Bill Schmidt  ---
Author: wschmidt
Date: Wed Feb 22 22:54:56 2017
New Revision: 245664

URL: https://gcc.gnu.org/viewcvs?rev=245664=gcc=rev
Log:
[gcc]

2017-02-22  Bill Schmidt  

Backport from mainline
2017-02-17  Bill Schmidt  

PR target/79261
* config/rs6000/rs6000.c (rs6000_expand_ternop_builtin): Add
support for CODE_FOR_vsx_xxpermdi_v2d[fi]_be.
* config/rs6000/rs6000.md (reload_gpr_from_vsx): Call
generator for vsx_xxpermdi__be.
* config/rs6000/vsx.md (vsx_xxpermdi_): Remove logic to
force big-endian semantics.
(vsx_xxpermdi__be): New define_expand with same
implementation as previous version of vsx_xxpermdi_.

[gcc/testsuite]

2017-02-22  Bill Schmidt  

Backport from mainline
2017-02-17  Bill Schmidt  

PR target/79261
* gcc.target/powerpc/vec-xxpermdi.c: New file.


Added:
branches/gcc-5-branch/gcc/testsuite/gcc.target/powerpc/vec-xxpermdi.c
Modified:
branches/gcc-5-branch/gcc/ChangeLog
branches/gcc-5-branch/gcc/config/rs6000/rs6000.c
branches/gcc-5-branch/gcc/config/rs6000/rs6000.md
branches/gcc-5-branch/gcc/config/rs6000/vsx.md
branches/gcc-5-branch/gcc/testsuite/ChangeLog

[Bug c++/79679] [7 Regression] [C++17] Missing destruction of temporary within constructor's mem-initializer-list

2017-02-22 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79679

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords||wrong-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-02-22
  Known to work||6.3.0
Summary|[C++17] Missing destruction |[7 Regression] [C++17]
   |of temporary within |Missing destruction of
   |constructor's   |temporary within
   |mem-initializer-list|constructor's
   ||mem-initializer-list
 Ever confirmed|0   |1
  Known to fail||7.0.1

--- Comment #1 from Jonathan Wakely  ---
int count;
struct S {
S() { ++count; }
S(const S&) { ++count; }
~S() { --count; }
};

struct T {
T(S) {}
};

int main() {
  {
S s;
T u(s);
  }
  if (count)
__builtin_abort();
}

[Bug c++/79664] ICE with #pragma omp parallel in constexpr function

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79664

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Jakub Jelinek  ---
Fixed.

[Bug c++/79664] ICE with #pragma omp parallel in constexpr function

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79664

--- Comment #2 from Jakub Jelinek  ---
Author: jakub
Date: Wed Feb 22 22:36:20 2017
New Revision: 245662

URL: https://gcc.gnu.org/viewcvs?rev=245662=gcc=rev
Log:
PR c++/79664
* parser.c (cp_parser_omp_teams, cp_parser_omp_target): Use
SET_EXPR_LOCATION on OMP_TARGET/OMP_TEAMS tree.
* constexpr.c (potential_constant_expression_1): Handle
OMP_*, OACC_* and CILK_* trees.  Use error_at with
EXPR_LOC_OR_LOC (t, input_location) computed early
instead of error, or error_at with location_of (t).

* g++.dg/gomp/teams-1.C: Adjust expected diagnostic location.
* g++.dg/cpp1y/constexpr-throw.C: Likewise.
* g++.dg/gomp/pr79664.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/gomp/pr79664.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/constexpr.c
trunk/gcc/cp/parser.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/cpp1y/constexpr-throw.C
trunk/gcc/testsuite/g++.dg/gomp/teams-1.C

[Bug target/69880] Linking Windows resource + implicit 'default-manifest.o' creates bad .exe

2017-02-22 Thread mati865 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69880

--- Comment #18 from mati865 at gmail dot com ---
Nick I applied
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=ec8f76882145c71bef81a9cadf0bf51ff9fa5b35
on top of 2.27 binutils and cannot reproduce issue anymore.

[Bug middle-end/79665] gcc's signed (x*x)/200 is slower than clang's

2017-02-22 Thread tulipawn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79665

--- Comment #6 from PeteVine  ---
But that's related to -mcpu=cortex-a53 again, so never mind I guess.

[Bug middle-end/79665] gcc's signed (x*x)/200 is slower than clang's

2017-02-22 Thread tulipawn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79665

PeteVine  changed:

   What|Removed |Added

 CC||tulipawn at gmail dot com

--- Comment #5 from PeteVine  ---
Psst! GCC 7 was already 1.75x faster than Clang 3.8 on my aarch64 machine when
I benchmarked this code 3 weeks ago, but with this patch, it seems to take a 5%
hit.

[Bug c/79680] format attribute cannot be used with template parameters

2017-02-22 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79680

Martin Sebor  changed:

   What|Removed |Added

   Keywords||diagnostic
 Status|UNCONFIRMED |RESOLVED
   Last reconfirmed||2017-2-22
 CC||msebor at gcc dot gnu.org
 Resolution|--- |DUPLICATE
   Severity|normal  |enhancement

--- Comment #1 from Martin Sebor  ---
Confirmed as a duplicate of bug 77958.

*** This bug has been marked as a duplicate of bug 77958 ***

[Bug c++/77958] printf format checking -vs- variadic template functions

2017-02-22 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77958

Martin Sebor  changed:

   What|Removed |Added

 CC||bugzilla@poradnik-webmaster
   ||a.com

--- Comment #2 from Martin Sebor  ---
*** Bug 79680 has been marked as a duplicate of this bug. ***

[Bug c/79662] ICE on invalid code in convert_arguments in c/c-typeck.c:3452

2017-02-22 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79662

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Marek Polacek  ---
Fixed for GCC 7.

[Bug c/79662] ICE on invalid code in convert_arguments in c/c-typeck.c:3452

2017-02-22 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79662

--- Comment #2 from Marek Polacek  ---
Author: mpolacek
Date: Wed Feb 22 21:28:42 2017
New Revision: 245660

URL: https://gcc.gnu.org/viewcvs?rev=245660=gcc=rev
Log:
PR c/79662
* c-typeck.c (convert_arguments): Handle error_mark_node.

* gcc.dg/enum-incomplete-4.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/enum-incomplete-4.c
Modified:
trunk/gcc/c/ChangeLog
trunk/gcc/c/c-typeck.c
trunk/gcc/testsuite/ChangeLog

[Bug rtl-optimization/79584] ICE in base_to_reg, at lra-constraints.c:2918

2017-02-22 Thread pthaugen at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79584

--- Comment #6 from Pat Haugen  ---
(In reply to Alan Modra from comment #5)
> I'd test powerpc64-linux bi-arch but the machine I normally use for BE
> testing had a disk die, and instead of trying to set everything up again at
> midnight, I'm going to bed and hoping Pat can handle bootstrap and
> regression test..

Thanks for the patch Alan, bi-arch testing on BE went fine.

[Bug c++/79657] ICE on invalid c++ code in finish_underlying_type cp/semantics.c:3849

2017-02-22 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79657

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Marek Polacek  ---
Fixed for GCC 7.

[Bug c++/79653] [5/6/7 Regression] ICE on invalid c++ code in cp_check_const_attributes in cp/decl2.c:1423

2017-02-22 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79653

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Marek Polacek  ---
Fixed for GCC 7.

[Bug c++/79657] ICE on invalid c++ code in finish_underlying_type cp/semantics.c:3849

2017-02-22 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79657

--- Comment #4 from Marek Polacek  ---
Author: mpolacek
Date: Wed Feb 22 19:33:13 2017
New Revision: 245658

URL: https://gcc.gnu.org/viewcvs?rev=245658=gcc=rev
Log:
PR c++/79657
* semantics.c (finish_underlying_type): Bail out for incomplete enums.

* g++.dg/ext/underlying_type12.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/ext/underlying_type12.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/semantics.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/79653] [5/6/7 Regression] ICE on invalid c++ code in cp_check_const_attributes in cp/decl2.c:1423

2017-02-22 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79653

--- Comment #7 from Marek Polacek  ---
Author: mpolacek
Date: Wed Feb 22 19:31:49 2017
New Revision: 245657

URL: https://gcc.gnu.org/viewcvs?rev=245657=gcc=rev
Log:
PR c++/79653
* parser.c (cp_parser_std_attribute_spec): Don't build the attribute
if the alignas expression is erroneous.
* pt.c (tsubst_attribute): If tsubst_pack_expansion fails, return
error_mark_node.

* g++.dg/cpp0x/alignas10.C: New test.
* g++.dg/cpp0x/alignas9.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/alignas10.C
trunk/gcc/testsuite/g++.dg/cpp0x/alignas9.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/parser.c
trunk/gcc/cp/pt.c
trunk/gcc/testsuite/ChangeLog

[Bug tree-optimization/79389] [7 Regression] 30% performance regression in SciMark2 MonteCarlo

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79389

--- Comment #13 from Jakub Jelinek  ---
Note that my patch doesn't bootstrap, so I'll need to debug it.

[Bug target/79185] [5/6/7 Regression] register allocation in the addition of two 128 bit ints

2017-02-22 Thread vmakarov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79185

--- Comment #6 from Vladimir Makarov  ---
(In reply to Jeffrey A. Law from comment #5)
> Is the CLOBBER even necessary anymore?  Wasn't its only purpose to tell
> dataflow that r88 was dead because our old flow analysis couldn't?
> 

I guess the CLOBBER was used in the very old live analysis which existed before
DF-infrastructure introduction.

> Doesn't the DF infrastructure get this right?  If it does, then we might be
> able to drop the CLOBBER entirely which might simplify the problem.

No.  DF infrastructure can not recognize it.  One time global.c was rewritten
to use live analysis done by DF and it would have had the same problem.  I
remember Ken Zadeck thought about implementing live analysis on subreg level
but he did not finish the work.

Another problem is that LRA does not use DF-infrastructure as it was too slow
(I tried it first and using it made LRA at least 2 times slower than reload). 
So even if DF implements it we still need to do the same thing in LRA live
analysis.

[Bug tree-optimization/68644] [6/7 Regression] FAIL: gcc.dg/tree-ssa/ivopts-lt-2.c scan-tree-dump-times ivopts "PHI <p_" 1

2017-02-22 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68644

Bill Schmidt  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #19 from Bill Schmidt  ---
No more known targets with problems, so closing.

[Bug c/79680] New: format attribute cannot be used with template parameters

2017-02-22 Thread bugzi...@poradnik-webmastera.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79680

Bug ID: 79680
   Summary: format attribute cannot be used with template
parameters
   Product: gcc
   Version: 5.4.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bugzi...@poradnik-webmastera.com
  Target Milestone: ---

I had logging function with printf-like declaration, and
__attribute__((format(printf, x, y))). For performance reasons I wanted to add
another one, which accepts constant string only without parameters.
Unfortunately when I created such function, gcc started complaining that call
is ambiguous. I found on stackoverflow that I can change one of extra parameter
into ordinary one with type specified via template. Unfortunately this is also
rejected with error "args to be formatted is not ‘...’". I also tried to use
variadic templates with the same results. Please extent the format attribute so
it also could be applied to ordinary parameters.

Code:

void log(const char* str) {}

template
__attribute((format(printf, 1, 2)))
void log(const char* fmt, T t, ...) {}

template 
__attribute((format(printf, 1, 2)))
void log(const char* fmt, T... args) {}

void test()
{
log("a");
log("%d", 1);
}

[Bug tree-optimization/68644] [6/7 Regression] FAIL: gcc.dg/tree-ssa/ivopts-lt-2.c scan-tree-dump-times ivopts "PHI <p_" 1

2017-02-22 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68644

--- Comment #18 from Bill Schmidt  ---
Author: wschmidt
Date: Wed Feb 22 18:00:21 2017
New Revision: 245656

URL: https://gcc.gnu.org/viewcvs?rev=245656=gcc=rev
Log:
2017-02-22  Bill Schmidt  

PR tree-optimization/68644
* gcc.dg/tree-ssa/ivopts-lt-2.c: Skip for powerpc*-*-*.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/gcc.dg/tree-ssa/ivopts-lt-2.c

[Bug c++/79679] New: [C++17] Missing destruction of temporary within constructor's mem-initializer-list

2017-02-22 Thread sbergman at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79679

Bug ID: 79679
   Summary: [C++17] Missing destruction of temporary within
constructor's mem-initializer-list
   Product: gcc
   Version: 7.0.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: sbergman at redhat dot com
  Target Milestone: ---

At least with a recent GCC trunk build ("gcc (GCC) 7.0.1 20170221
(experimental)"), the below program does not print "dtor" when built with
-std=c++17 (but does when built with -std=c++14, or with an older GCC,
gcc-c++-6.3.1-1.fc25.x86_64).  Appears that in the U ctor, a temporary
shared_ptr is copy-created but not destroyed.


#include 
#include 
struct S { ~S() { std::cout << "dtor\n"; } };
struct T {
std::shared_ptr s_;
T(std::shared_ptr s): s_(s) {}
};
struct U {
T t_;
U(std::shared_ptr const & s): t_(s) {}
};
int main() {
auto s = std::make_shared();
U u(s);
}

[Bug c/79677] Weird handling of -Werror=

2017-02-22 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677

--- Comment #1 from joseph at codesourcery dot com  ---
For the theory of how I think this should behave, see 
 (referring back 
to  and 
 for the concept of 
distance for options overriding each other).  That is, 
-Werror=format-security should act like a -Wformat-security variant, and 
so all these examples should warn/error.

I don't know what the immediate cause of this issue or appropriate fix in 
the context of the present implementation might be.

[Bug c/79678] New: x86 (and other?) SIMD builtins have signedness issues

2017-02-22 Thread jbeulich at novell dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79678

Bug ID: 79678
   Summary: x86 (and other?) SIMD builtins have signedness issues
   Product: gcc
   Version: 6.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jbeulich at novell dot com
  Target Milestone: ---

At least builtins clearly acting on and/or returning packed unsigned data
should have parameter/return types derived from unsigned ones. Beside requiring
needless casts, even trivial things like "__builtin_ia32_pmaxub128() > 0"
otherwise produce wrong code.

Similarly builtins acting on signed 8-bit quantities should not have
parameter/return types derived from plain char.

[Bug target/70465] [5/6 Regression] Poor code for x87 asm

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70465

--- Comment #21 from Jakub Jelinek  ---
Author: jakub
Date: Wed Feb 22 17:17:17 2017
New Revision: 245654

URL: https://gcc.gnu.org/viewcvs?rev=245654=gcc=rev
Log:
PR target/70465
* reg-stack.c (emit_swap_insn): Treat (float_extend:?F (mem:?F))
and (const_double:?F) like (mem:?F) for the purpose of fxch %st(1)
elimination by swapping fld*.

* gcc.target/i386/pr70465-2.c: New test.

Added:
trunk/gcc/testsuite/gcc.target/i386/pr70465-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/reg-stack.c
trunk/gcc/testsuite/ChangeLog

[Bug target/78660] [7 Regression] 7.0 bootstrap fail on mips64el-unknow-linux: configure-stage2-target-libgcc' failed

2017-02-22 Thread mpf at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78660

--- Comment #20 from mpf at gcc dot gnu.org ---
Author: mpf
Date: Wed Feb 22 17:20:14 2017
New Revision: 245655

URL: https://gcc.gnu.org/viewcvs?rev=245655=gcc=rev
Log:
Support WORD_REGISTER_OPERATIONS requirements in simplify_operand_subreg

gcc/
PR target/78660
* lra-constraints.c (simplify_operand_subreg): Handle
WORD_REGISTER_OPERATIONS targets.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/lra-constraints.c

[Bug fortran/79485] [5/6/7 Regression] Bind(c) and module procedure renaming causes wrong procedure to be called

2017-02-22 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79485

Dominique d'Humieres  changed:

   What|Removed |Added

   Priority|P3  |P4
 Status|UNCONFIRMED |NEW
  Known to work||4.8.5
   Keywords||wrong-code
   Last reconfirmed||2017-02-22
 Ever confirmed|0   |1
Summary|Bind(c) and module  |[5/6/7 Regression] Bind(c)
   |procedure renaming causes   |and module procedure
   |wrong procedure to be   |renaming causes wrong
   |called  |procedure to be called
  Known to fail||4.9.0, 4.9.4, 5.3.1, 6.2.0,
   ||7.0

--- Comment #1 from Dominique d'Humieres  ---
> Related to bug77746 and bug66695.

At least it starts to fail in the same revision range. Likely related to the
fixes of pr48858.

[Bug tree-optimization/79389] [7 Regression] 30% performance regression in SciMark2 MonteCarlo

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79389

--- Comment #12 from Jakub Jelinek  ---
At -O3 it is caused by the r238005 change as written earlier, that is really
not a beneficial optimization in this case.  -O3 -fno-split-paths should still
see the benefit of the patch I've attached.  So we need some patch from Richard
too or a way to undo the damage afterwards (still in GIMPLE or on RTL).

[Bug c++/79653] [5/6/7 Regression] ICE on invalid c++ code in cp_check_const_attributes in cp/decl2.c:1423

2017-02-22 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79653

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

--- Comment #6 from Marek Polacek  ---
I have a fix for that.

[Bug target/79185] [5/6/7 Regression] register allocation in the addition of two 128 bit ints

2017-02-22 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79185

--- Comment #5 from Jeffrey A. Law  ---

Is the CLOBBER even necessary anymore?  Wasn't its only purpose to tell
dataflow that r88 was dead because our old flow analysis couldn't?

Doesn't the DF infrastructure get this right?  If it does, then we might be
able to drop the CLOBBER entirely which might simplify the problem.

[Bug c++/79653] [5/6/7 Regression] ICE on invalid c++ code in cp_check_const_attributes in cp/decl2.c:1423

2017-02-22 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79653

--- Comment #5 from Marek Polacek  ---
I came up with another testcase that triggers a similar ICE:

template 
struct A { alignas(int...) char c; };

A a;

q.cc:2:23: error: expansion pattern ‘#‘tree_list’ not supported by
dump_expr#’ contains no argument packs
 struct A { alignas(int...) char c; };
   ^~~
q.cc:2:33: internal compiler error: tree check: expected tree_list, have
error_mark in is_late_template_attribute, at cp/decl2.c:1119
 struct A { alignas(int...) char c; };
 ^
0x14b8fcc tree_check_failed(tree_node const*, char const*, int, char const*,
...)
/home/marek/src/gcc/gcc/tree.c:9815
0x7911d6 tree_check(tree_node*, char const*, int, char const*, tree_code)
/home/marek/src/gcc/gcc/tree.h:3064
0x8e008a is_late_template_attribute
/home/marek/src/gcc/gcc/cp/decl2.c:1119
0x8e02c0 splice_template_attributes
/home/marek/src/gcc/gcc/cp/decl2.c:1179
0x8e040e save_template_attributes
/home/marek/src/gcc/gcc/cp/decl2.c:1205
0x8e13f4 cplus_decl_attributes(tree_node**, tree_node*, int)
/home/marek/src/gcc/gcc/cp/decl2.c:1420
0x8df76d grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*,
bool, tree_node*, tree_node*)
/home/marek/src/gcc/gcc/cp/decl2.c:951
0x9353d7 cp_parser_member_declaration
/home/marek/src/gcc/gcc/cp/parser.c:23414
0x9346d3 cp_parser_member_specification_opt
/home/marek/src/gcc/gcc/cp/parser.c:22963
0x932255 cp_parser_class_specifier_1
/home/marek/src/gcc/gcc/cp/parser.c:22116
0x933010 cp_parser_class_specifier
/home/marek/src/gcc/gcc/cp/parser.c:22368
0x926d42 cp_parser_type_specifier
/home/marek/src/gcc/gcc/cp/parser.c:16441
0x921b93 cp_parser_decl_specifier_seq
/home/marek/src/gcc/gcc/cp/parser.c:13352
0x93b331 cp_parser_single_declaration
/home/marek/src/gcc/gcc/cp/parser.c:26646
0x93a5f5 cp_parser_template_declaration_after_parameters
/home/marek/src/gcc/gcc/cp/parser.c:26337
0x93b1c9 cp_parser_explicit_template_declaration
/home/marek/src/gcc/gcc/cp/parser.c:26573
0x93b223 cp_parser_template_declaration_after_export
/home/marek/src/gcc/gcc/cp/parser.c:26591
0x923dbb cp_parser_template_declaration
/home/marek/src/gcc/gcc/cp/parser.c:14693
0x9200b0 cp_parser_declaration
/home/marek/src/gcc/gcc/cp/parser.c:12467
0x91fe19 cp_parser_declaration_seq_opt
/home/marek/src/gcc/gcc/cp/parser.c:12394
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug libfortran/79612] missing space in diagnostic: Incorrect rank of return array in

2017-02-22 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79612

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-02-22
   Assignee|unassigned at gcc dot gnu.org  |dominiq at lps dot 
ens.fr
 Ever confirmed|0   |1

--- Comment #1 from Dominique d'Humieres  ---
> There is a space missing between "intrinsic:" and "is".

Indeed!

[Bug fortran/79601] Possibly wrong use of keyword "intent" in diagnostic

2017-02-22 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79601

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-02-22
   Assignee|unassigned at gcc dot gnu.org  |dominiq at lps dot 
ens.fr
 Ever confirmed|0   |1

--- Comment #1 from Dominique d'Humieres  ---
> Should the "intent %s" be "INTENT %s" instead?

Indeed! The test gfortran.dg/dtio_6.f90 will need some adjustment.

[Bug fortran/79597] Incomplete error message "Expecting %

2017-02-22 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79597

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-02-22
   Assignee|unassigned at gcc dot gnu.org  |dominiq at lps dot 
ens.fr
 Ever confirmed|0   |1

--- Comment #1 from Dominique d'Humieres  ---
> There is a trailing comma. In the corresponding "else" clause,
> there is a complete sentence. One of these is probably wrong.

It looks like a copy typo.

[Bug c++/79664] ICE with #pragma omp parallel in constexpr function

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79664

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-02-22
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Jakub Jelinek  ---
Created attachment 40816
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40816=edit
gcc7-pr79664.patch

Untested fix.

[Bug tree-optimization/79389] [7 Regression] 30% performance regression in SciMark2 MonteCarlo

2017-02-22 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79389

--- Comment #11 from Uroš Bizjak  ---
(In reply to Jakub Jelinek from comment #10)
> Created attachment 40815 [details]
> gcc7-pr79389.patch
> 
> Full untested patch.

I can confirm that MonteCarlo benchmark considerably improves with -O2, but
please note that your patch is ineffective with -Ofast for some reason, and the
testcase still compiles to a jump.

[Bug tree-optimization/68644] [6/7 Regression] FAIL: gcc.dg/tree-ssa/ivopts-lt-2.c scan-tree-dump-times ivopts "PHI <p_" 1

2017-02-22 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68644

--- Comment #17 from Bill Schmidt  ---
The current code generation is quite tight using the existing cost modeling:

.L2:
stwu 10,4(3)
bdnz .L2

Thus we will plan to skip this test for POWER.

[Bug middle-end/79673] GIMPLE verification fails when compiling code with __seg_gs

2017-02-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79673

--- Comment #4 from Richard Biener  ---
Author: rguenth
Date: Wed Feb 22 15:00:39 2017
New Revision: 245649

URL: https://gcc.gnu.org/viewcvs?rev=245649=gcc=rev
Log:
2017-02-22  Richard Biener  

PR tree-optimization/79673
* tree-ssa-pre.c (compute_avail): Use wide_int_to_tree to
convert the [TARGET_]MEM_REF offset INTEGER_CST, scrapping off
irrelevant address-space qualifiers and avoiding a
ADDR_SPACE_CONVERT_EXPR from fold_convert.

* gcc.target/i386/pr79673.c: New testcase.

Added:
trunk/gcc/testsuite/gcc.target/i386/pr79673.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-pre.c

[Bug middle-end/79673] GIMPLE verification fails when compiling code with __seg_gs

2017-02-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79673

Richard Biener  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Richard Biener  ---
Fixed for GCC 7.

[Bug c/79674] Missed optimisation when no sequence point present

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79674

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek  ---
Our IL (GIMPLE as well as RTL) does not allow side-effects in function
arguments, so it is lowered quite early and the FEs that can see it still all
in place are not very likely to judge whether such moving would be beneficial
or not.

[Bug c++/79657] ICE on invalid c++ code in finish_underlying_type cp/semantics.c:3849

2017-02-22 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79657

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

[Bug c/79674] Missed optimisation when no sequence point present

2017-02-22 Thread etienne_lorrain at yahoo dot fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79674

--- Comment #2 from etienne_lorrain at yahoo dot fr ---
Well, I did not really want to link to the store-merging optimisation in
particular, I wanted to point out that order of evaluation inside the function
call are not defined by the standard, so argument evaluation could be changed
to increase optimisation.

Here is an example without using volatile:
-->o--o<-
static inline void parallel (int c_compliant, ...) {}
struct { unsigned char r, g, b, t; } vol_str;
int external_fct(void);

void fct1 (void)
{
  vol_str.r = 1,
  vol_str.g = 2,
  external_fct(),
  vol_str.b = 3,
  vol_str.t = 0;
}

void fct2 (void)
{
  parallel (vol_str.r = 1, vol_str.g = 2, external_fct(), vol_str.b = 3,
vol_str.t = 0);
}

unsigned fct_use(void) { return vol_str.r; } // do not remove, anonymous
struct!
-->o--o<-

fct2() could write a 32 bit value and call external_fct() either before or
after, unlike fct1().

[Bug c/79677] New: Weird handling of -Werror=

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677

Bug ID: 79677
   Summary: Weird handling of -Werror=
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

On the following testcase:

int
main()
{
  char message[10] = "";
  __builtin_printf(message);
  return 0;
}

we warn (or error) e.g. with:
-Wformat -Wformat-security
-Wformat -Werror=format-security
-Wall -Wformat-security
-Wall -Werror=format-security
-Wformat -Wformat-security -Wformat
-Wall -Wformat-security -Wformat
-Wformat -Wformat-security -Wall
-Wall -Wformat-security -Wall
-Wformat -Wformat-security -Werror=format-security -Wformat
-Wall -Wformat-security -Werror=format-security -Wformat
-Wformat -Wformat-security -Werror=format-security -Wall
-Wall -Wformat-security -Werror=format-security -Wall
but not with:
-Wformat -Werror=format-security -Wformat
-Wall -Werror=format-security -Wformat
-Wformat -Werror=format-security -Wall
-Wall -Werror=format-security -Wall

-Wall implies -Wformat (level 1) and -Wformat only for level 2 implies
-Wformat-security, so something in the -Wformat or -Wall handling disables
warn_format_security, but strangely only when the -Werror option is used.

[Bug c++/61568] unscoped enums different types differ from __underlying_type

2017-02-22 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61568

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||mpolacek at gcc dot gnu.org
 Resolution|--- |INVALID

--- Comment #3 from Marek Polacek  ---
Looks like there's nothing to do for GCC.

[Bug fortran/79596] translation: argument to gfc_internal_error should not be translated

2017-02-22 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79596

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2017-02-22
 Ever confirmed|0   |1

--- Comment #1 from Dominique d'Humieres  ---
> Internal errors should not be translated. Their only purpose is to give
> information back to the developers, and this information should not be
> modified by any translator.

I agree, but how do achieve that?

[Bug fortran/79676] [submodules] Compilation/linking error when module procedures PRIVATE

2017-02-22 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79676

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-02-22
 Ever confirmed|0   |1

--- Comment #1 from Dominique d'Humieres  ---
Confirmed with gfortran 6.3 and trunk (7.0). Reduced test

module my_mod
  interface
module subroutine submod_test(x)
  real :: x
end subroutine
  end interface

  private ! this line seems to be the one causing the problems
  public routine1

contains

  subroutine routine1(x)
real :: x
call submod_test(x)
  end subroutine

end module

submodule (my_mod) my_submod
use my_mod
contains
module procedure submod_test
  print *, x
end procedure
end submodule

[Bug tree-optimization/79389] [7 Regression] 30% performance regression in SciMark2 MonteCarlo

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79389

--- Comment #10 from Jakub Jelinek  ---
Created attachment 40815
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40815=edit
gcc7-pr79389.patch

Full untested patch.

[Bug c/79674] Missed optimisation when no sequence point present

2017-02-22 Thread prathamesh3492 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79674

prathamesh3492 at gcc dot gnu.org changed:

   What|Removed |Added

 CC||prathamesh3492 at gcc dot 
gnu.org

--- Comment #1 from prathamesh3492 at gcc dot gnu.org ---
Well since vol_str is qualified with volatile, I suppose optimizations were
suppressed. After removing volatile, the store-merging pass converted four byte
writes into a single 32-bit write for both fct1 and fct2 as can be seen from
the dump below:

;; Function fct1 (fct1, funcdef_no=1, decl_uid=1804, cgraph_uid=1,
symbol_order=2)

Coalescing successful!
Merged into 1 stores
New sequence of 1 stmts to replace old one of 4 stmts
Merging successful!
fct1 ()
{
   [100.00%]:
  MEM[(unsigned char *)_str] = 197121;
  return;

}

;; Function fct2 (fct2, funcdef_no=2, decl_uid=1807, cgraph_uid=2,
symbol_order=3)

Coalescing successful!
Merged into 1 stores
New sequence of 1 stmts to replace old one of 4 stmts
Merging successful!
fct2 ()
{
   [100.00%]:
  MEM[(unsigned char *)_str] = 197121;
  return;

}

Thanks,
Prathamesh

[Bug middle-end/79675] Pointless reg1 <- reg2; reg2 <- reg1 moves inside loop

2017-02-22 Thread amker at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79675

--- Comment #2 from amker at gcc dot gnu.org ---
(In reply to ktkachov from comment #1)
> I think ivopts also contributes here.
> Before ivopts the memory access and address are:
>   s1_10 = s1_3 + 1;
>   c1_11 = *s1_3;
> 
> but ivopts transforms them to:
>   s1_10 = s1_3 + 1;
>   c1_11 = MEM[base: s1_10, offset: -1B];
> 
> So the memory address is now dependent on s1_10 rather than s1_3 and
> introduces an offset where there was none before

Thanks for reporting, I will have a look.  Thanks.

[Bug middle-end/79675] Pointless reg1 <- reg2; reg2 <- reg1 moves inside loop

2017-02-22 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79675

ktkachov at gcc dot gnu.org changed:

   What|Removed |Added

 CC||amker at gcc dot gnu.org

--- Comment #1 from ktkachov at gcc dot gnu.org ---
I think ivopts also contributes here.
Before ivopts the memory access and address are:
  s1_10 = s1_3 + 1;
  c1_11 = *s1_3;

but ivopts transforms them to:
  s1_10 = s1_3 + 1;
  c1_11 = MEM[base: s1_10, offset: -1B];

So the memory address is now dependent on s1_10 rather than s1_3 and introduces
an offset where there was none before

[Bug tree-optimization/79389] [7 Regression] 30% performance regression in SciMark2 MonteCarlo

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79389

--- Comment #9 from Jakub Jelinek  ---
With:
--- ifcvt.c.jj2 2017-01-23 18:09:45.0 +0100
+++ ifcvt.c 2017-02-22 14:25:15.758296571 +0100
@@ -777,6 +777,9 @@ struct noce_if_info
   /* The jump condition.  */
   rtx cond;

+  /* Reversed jump condition.  */
+  rtx rev_cond;
+
   /* New insns should be inserted before this one.  */
   rtx_insn *cond_earliest;

@@ -898,7 +901,7 @@ noce_emit_store_flag (struct noce_if_inf
   && (normalize == 0 || STORE_FLAG_VALUE == normalize))
 {
   rtx src = gen_rtx_fmt_ee (code, GET_MODE (x), XEXP (cond, 0),
-   XEXP (cond, 1));
+   XEXP (cond, 1));
   rtx set = gen_rtx_SET (x, src);

   start_sequence ();
@@ -1553,11 +1556,10 @@ noce_try_addcc (struct noce_if_info *if_

   if (GET_CODE (if_info->a) == PLUS
   && rtx_equal_p (XEXP (if_info->a, 0), if_info->b)
-  && (reversed_comparison_code (if_info->cond, if_info->jump)
- != UNKNOWN))
+  && if_info->rev_cond)
 {
-  rtx cond = if_info->cond;
-  enum rtx_code code = reversed_comparison_code (cond, if_info->jump);
+  rtx cond = if_info->rev_cond;
+  enum rtx_code code = GET_CODE (cond);

   /* First try to use addcc pattern.  */
   if (general_operand (XEXP (cond, 0), VOIDmode)
@@ -4064,6 +4066,11 @@ noce_find_if_block (basic_block test_bb,
   if_info.else_bb = else_bb;
   if_info.join_bb = join_bb;
   if_info.cond = cond;
+  rtx_insn *rev_cond_earliest;
+  if_info.rev_cond = noce_get_condition (jump, _cond_earliest,
+!then_else_reversed);
+  gcc_assert (if_info.rev_cond == NULL_RTX
+ || rev_cond_earliest == cond_earliest);
   if_info.cond_earliest = cond_earliest;
   if_info.jump = jump;
   if_info.then_else_reversed = then_else_reversed;

I get:
comisd  %xmm1, %xmm2
sbbl$-1, %ebp
instead of:
leal1(%rbx), %eax
...
comisd  %xmm1, %xmm2
cmovnb  %eax, %ebx
(plus slightly different RA).

[Bug rtl-optimization/79584] ICE in base_to_reg, at lra-constraints.c:2918

2017-02-22 Thread amodra at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79584

--- Comment #5 from Alan Modra  ---
The patch passes ppc64le bootstrap but that isn't really the best target to
test.

I'd test powerpc64-linux bi-arch but the machine I normally use for BE testing
had a disk die, and instead of trying to set everything up again at midnight,
I'm going to bed and hoping Pat can handle bootstrap and regression test..

[Bug fortran/79676] New: [submodules] Compilation/linking error when module procedures PRIVATE

2017-02-22 Thread adam at aphirst dot karoo.co.uk
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79676

Bug ID: 79676
   Summary: [submodules] Compilation/linking error when module
procedures PRIVATE
   Product: gcc
   Version: 6.3.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: adam at aphirst dot karoo.co.uk
  Target Milestone: ---

Demonstration code:
https://gist.github.com/aphirst/aacfe1eb5eda1151364ddbf2feef5ed3

Build log:
http://sprunge.us/iYaP

---

Building of "(my_mod) my_submod" fails when a PRIVATE statement is present in
"my_mod". Removal of the statement permits successful building.

Interestingly, re-insertion of the PRIVATE statement followed by a repeat of
the build command (no cleaning of previous files) also results in a successful
build.

---

Using Arch Linux x64_64, with GCC version 6.3.1 20170109. I spoke to dominiq in
the OFTC IRC channel who was curious as to whether this was similar to PR79434,
and otherwise suggested I open a ticket.

If there's anything important I missed, or anything else you need, don't
hesitate to ask.

[Bug tree-optimization/79389] [7 Regression] 30% performance regression in SciMark2 MonteCarlo

2017-02-22 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79389

--- Comment #8 from Uroš Bizjak  ---
(In reply to Jakub Jelinek from comment #6)
> Well, at least in the -O2 case, it clearly shows that (RTL) if-conversion
> does happen.
> If SETCC + ZEXT + ADD is always a win compared to LEAL x+1 + CMOV*, then we
> should just expand the cmov in that case to that or combine or peephole it
> to that.
> Now, with -m32 -march=i586 -O2 (so that cmov can't be used), I see
> noce_try_addcc (which is exactly that, SETCC + ZEXT + ADD) fails because the
> condition is complex:
> (ne (and:QI (subreg:QI (zero_extract:SI (reg:HI 100)
> (const_int 8 [0x8])
> (const_int 8 [0x8])) 0)
> (const_int 5 [0x5]))
> (const_int 0 [0]))

You can use -march=i686, so fcomi will be emitted instead of fcomp/fnstsw/test.

[Bug tree-optimization/79389] [7 Regression] 30% performance regression in SciMark2 MonteCarlo

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79389

--- Comment #7 from Jakub Jelinek  ---
For -O2 -m64 the reason why noce_try_addcc doesn't trigger is that we have
if_info->cond of
(unlt (reg:DF 100)
(reg:DF 97))
and reverse_comparison_code on it returns UNKNOWN.
Though, that UNLT comes from:
noce_get_condition which calls canonicalize_condition on the original
(ge (reg:CCFP 17 flags)
(const_int 0 [0]))
condition with reverse set to true.
Now, if I call canonicalize_condition on the original ge with reversed set to
false, I get:
(ge (reg:DF 100)
(reg:DF 97))
The FPU compare reversions are just way too many to be understandable, I have
no idea why UNLT can't be reversed, while GE can be reversed to UNLT.

[Bug tree-optimization/79389] [7 Regression] 30% performance regression in SciMark2 MonteCarlo

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79389

--- Comment #6 from Jakub Jelinek  ---
Well, at least in the -O2 case, it clearly shows that (RTL) if-conversion does
happen.
If SETCC + ZEXT + ADD is always a win compared to LEAL x+1 + CMOV*, then we
should just expand the cmov in that case to that or combine or peephole it to
that.
Now, with -m32 -march=i586 -O2 (so that cmov can't be used), I see
noce_try_addcc (which is exactly that, SETCC + ZEXT + ADD) fails because the
condition is complex:
(ne (and:QI (subreg:QI (zero_extract:SI (reg:HI 100)
(const_int 8 [0x8])
(const_int 8 [0x8])) 0)
(const_int 5 [0x5]))
(const_int 0 [0]))
and in that case it attempts to emit:
(insn 53 0 0 (set (reg:SI 102)
(eq:SI (reg:CCNO 17 flags)
(const_int 0 [0]))) -1
 (nil))
but that isn't recognized by the backend.

[Bug middle-end/79649] Memset pattern in named address space crashes compiler or generates wrong code

2017-02-22 Thread amker at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79649

--- Comment #13 from amker at gcc dot gnu.org ---
(In reply to Uroš Bizjak from comment #12)
> The added testcase also ICEs with -O3 -mx32:
> 
> ~/gcc-build/gcc/cc1 -O3 -mx32 -quiet pr79649.c
> pr79649.c: In function ‘f1’:
> pr79649.c:11:1: internal compiler error: in get_use_type, at
> tree-ssa-loop-ivopts.c:3831
>  f1 (unsigned char __seg_gs *s, size_t n)
>  ^~
> 0xff99a1 get_use_type
> ../../git/gcc/gcc/tree-ssa-loop-ivopts.c:3830
> 0xfff0c8 get_computation_at
> ../../git/gcc/gcc/tree-ssa-loop-ivopts.c:3847
> 0x1009aba get_computation_cost_at
> ../../git/gcc/gcc/tree-ssa-loop-ivopts.c:5061
> 0x1009c0f get_computation_cost
> ../../git/gcc/gcc/tree-ssa-loop-ivopts.c:5089
> 0x100a251 determine_group_iv_cost_address
> ../../git/gcc/gcc/tree-ssa-loop-ivopts.c:5133

Hmm, there is existing issue in IVOPT that address space information is not
maintained correctly, but this one is earlier than that.  I will have a look.

[Bug middle-end/79675] New: Pointless reg1 <- reg2; reg2 <- reg1 moves inside loop

2017-02-22 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79675

Bug ID: 79675
   Summary: Pointless reg1 <- reg2; reg2 <- reg1 moves inside loop
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---

I'm looking at the code:
char *
foo (char *s1, char *s2, unsigned int n)
{
  char c1, c2;

  c2 = *(char *)s2++;

  do
{
  do
{
  c1 = *s1++;
  if (c1 == 0)
return 0;
}
  while (c1 != c2);
}
  while (__builtin_strncmp (s1, (char *)s2, n) != 0);

  return --s1;
}

On aarch64 at -O2 this generates some bad code for the inner loop:
...
.L9:
cmp w21, w1
beq .L8
.L4:
mov x20, x19 // (1)
mov x19, x20 // (2)
ldrbw1, [x19], 1 (3)
cbnzw1, .L9
...
Note the moves between x20 and x19, (1) and (2)
Looking at the RTL dumps the two moves were in separate basic blocks but were
moved together at some point.

Instructions (2) and (3) were transformed by autoincdec from:
add x19, x20, #1
ldrb w1, [x19, #-1]

but nothing eliminated (2) because x19 is later used as an argument to strncmp
and in another basic block.

Doesn't the peephole2 pass try to eliminate such back-to-back copies?

[Bug tree-optimization/79666] [5/6 Regression] wrong code (SIGFPE) at -O2 on x86_64-linux-gnu (in both 32-bit and 64-bit modes)

2017-02-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79666

Richard Biener  changed:

   What|Removed |Added

   Priority|P1  |P2
  Known to work||7.0
Summary|[5/6/7 Regression] wrong|[5/6 Regression] wrong code
   |code (SIGFPE) at -O2 on |(SIGFPE) at -O2 on
   |x86_64-linux-gnu (in both   |x86_64-linux-gnu (in both
   |32-bit and 64-bit modes)|32-bit and 64-bit modes)

--- Comment #7 from Richard Biener  ---
Fixed on trunk sofar.

[Bug tree-optimization/79666] [5/6/7 Regression] wrong code (SIGFPE) at -O2 on x86_64-linux-gnu (in both 32-bit and 64-bit modes)

2017-02-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79666

--- Comment #6 from Richard Biener  ---
Author: rguenth
Date: Wed Feb 22 12:11:27 2017
New Revision: 245648

URL: https://gcc.gnu.org/viewcvs?rev=245648=gcc=rev
Log:
2017-02-22  Richard Biener  

PR tree-optimization/79666
* tree-vrp.c (extract_range_from_binary_expr_1): Make sure
to not symbolically negate if that may introduce undefined
overflow.

* gcc.dg/torture/pr79666.c: New testcase.

Added:
trunk/gcc/testsuite/gcc.dg/torture/pr79666.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-vrp.c

[Bug middle-end/79649] Memset pattern in named address space crashes compiler or generates wrong code

2017-02-22 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79649

--- Comment #12 from Uroš Bizjak  ---
The added testcase also ICEs with -O3 -mx32:

~/gcc-build/gcc/cc1 -O3 -mx32 -quiet pr79649.c
pr79649.c: In function ‘f1’:
pr79649.c:11:1: internal compiler error: in get_use_type, at
tree-ssa-loop-ivopts.c:3831
 f1 (unsigned char __seg_gs *s, size_t n)
 ^~
0xff99a1 get_use_type
../../git/gcc/gcc/tree-ssa-loop-ivopts.c:3830
0xfff0c8 get_computation_at
../../git/gcc/gcc/tree-ssa-loop-ivopts.c:3847
0x1009aba get_computation_cost_at
../../git/gcc/gcc/tree-ssa-loop-ivopts.c:5061
0x1009c0f get_computation_cost
../../git/gcc/gcc/tree-ssa-loop-ivopts.c:5089
0x100a251 determine_group_iv_cost_address
../../git/gcc/gcc/tree-ssa-loop-ivopts.c:5133

[Bug middle-end/79673] GIMPLE verification fails when compiling code with __seg_gs

2017-02-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79673

Richard Biener  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-02-22
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Richard Biener  ---
 
unit size 
align 64 symtab 0 alias set -1 canonical type 0x769c1738 precision
64 min  max 
pointer_to_this >

arg 0 
constant 0>
arg 1 
public unsigned DI size  unit size

align 64 symtab 0 alias set -1 canonical type 0x768c20a8
pointer_to_this >
constant arg 0 >>

so I guess we somewhere use fold_convert and expect the literal to be constant
folded (but it isn't, instead ADDR_SPACE_CONVERT is created).  Indeed.  Created
by

Run till exit from #0  0x00adb6e0 in fold_convert_loc (loc=0, 
type=, arg=)
at /space/rguenther/src/svn/gcc-7-branch/gcc/fold-const.c:2234
compute_avail ()
at /space/rguenther/src/svn/gcc-7-branch/gcc/tree-ssa-pre.c:4004
4004  ref1->op0);
Value returned is $8 = (tree_node *) 0x769d0f80
(gdb) l
3999  else
4000{
4001  ref->set = 0;
4002  if (ref1->opcode == MEM_REF)
4003ref1->op0 = fold_convert (ptr_type_node,
4004  ref1->op0);
4005  else
4006ref1->op2 = fold_convert (ptr_type_node,
4007  ref1->op2);

and fold_convert just does

case POINTER_TYPE:
case REFERENCE_TYPE:
  /* Handle conversions between pointers to different address spaces.  */
  if (POINTER_TYPE_P (orig)
  && (TYPE_ADDR_SPACE (TREE_TYPE (type))
  != TYPE_ADDR_SPACE (TREE_TYPE (orig
return fold_build1_loc (loc, ADDR_SPACE_CONVERT_EXPR, type, arg);
  /* fall through */

the issue is the use of ptr_type_node above which should use void * of the
correct address space.  Or rather simply scrap the addr-space from the
offset (it serves no purpose there).

Index: gcc/tree-ssa-pre.c
===
--- gcc/tree-ssa-pre.c  (revision 245646)
+++ gcc/tree-ssa-pre.c  (working copy)
@@ -3996,11 +4000,11 @@ compute_avail (void)
{
  ref->set = 0;
  if (ref1->opcode == MEM_REF)
-   ref1->op0 = fold_convert (ptr_type_node,
- ref1->op0);
+   ref1->op0 = wide_int_to_tree (ptr_type_node,
+ ref1->op0);
  else
-   ref1->op2 = fold_convert (ptr_type_node,
- ref1->op2);
+   ref1->op2 = wide_int_to_tree (ptr_type_node,
+ ref1->op2);
}
  operands.release ();

is a quick fix.

[Bug c++/79361] [5/6/7 Regression] ICE redefining a template function as defaulted or deleted

2017-02-22 Thread paolo.carlini at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79361

Paolo Carlini  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-02-22
 Ever confirmed|0   |1

--- Comment #1 from Paolo Carlini  ---
Mine.

[Bug c/79674] New: Missed optimisation when no sequence point present

2017-02-22 Thread etienne_lorrain at yahoo dot fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79674

Bug ID: 79674
   Summary: Missed optimisation when no sequence point present
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: etienne_lorrain at yahoo dot fr
  Target Milestone: ---

It may be controvertial use, but I would like to report it with low priority...

Having this code (tested on GCC7):
-->o--o<-
static inline void parallel (int c_compliant, ...) {}
volatile struct { unsigned char r, g, b, t; } vol_str;

void fct1 (void)
{
  vol_str.r = 1,
  vol_str.g = 2,
  vol_str.b = 3,
  vol_str.t = 0;
}

void fct2 (void)
{
  parallel (vol_str.r = 1, vol_str.g = 2, vol_str.b = 3, vol_str.t = 0);
}
-->o--o<-

fct1 has to be translated into four independant byte writes because since some
ANSI standard the comma (used like this) has become a sequence point.

but fct2 could be compiled into a single 32 bits write because there are no
sequence point when we use the comma to separate parameters in a function call
(hence the name of the function: parallel)...

[Bug middle-end/79647] bogus warning when building openssl

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79647

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #8 from Jakub Jelinek  ---
Not complaining about unrecognized -Wno-* unless something other has been
reported is a feature.

[Bug middle-end/79673] GIMPLE verification fails when compiling code with __seg_gs

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79673

--- Comment #1 from Jakub Jelinek  ---
This is created by PRE, so question for Richard.
That said, the testcase is undefined behavior, even in alternate address spaces
NULL pointer can't point to any object.

[Bug c++/78943] Generated assembler fails with symbol is already defined

2017-02-22 Thread charles.frasch at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78943

--- Comment #1 from Charles  ---
The problem appears to have been fixed by patch r245373 made for Bug #78908.

Thanks!

[Bug c++/78908] [6/7 Regression] template instantiation with bit-field type

2017-02-22 Thread charles.frasch at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78908

--- Comment #10 from Charles  ---
Verified that reported problem is fixed.

Thanks!

[Bug rtl-optimization/79593] [6/7 Regression] Poor/Worse code generation for FPU on versions after 6

2017-02-22 Thread katsunori.kumatani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79593

--- Comment #16 from Katsunori Kumatani  
---
I see! It was more a side note than anything when I inspected GCC 7's output, I
am not even sure if it affects x87 only (not sure if I should have opened
another bug for it, but I guess it doesn't matter now). Either way thanks for
looking into it.

[Bug c++/79672] ICE with -Wduplicated-branches -fopenmp

2017-02-22 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79672

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

--- Comment #2 from Marek Polacek  ---
Mine I guess.

[Bug middle-end/79673] New: GIMPLE verification fails when compiling code with __seg_gs

2017-02-22 Thread me at manueljacob dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79673

Bug ID: 79673
   Summary: GIMPLE verification fails when compiling code with
__seg_gs
   Product: gcc
   Version: 7.0.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: me at manueljacob dot de
CC: jakub at gcc dot gnu.org, rguenther at suse dot de
  Target Milestone: ---

Created attachment 40814
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40814=edit
Compiler traceback

This happens at least on x86-64 with -O2 and higher.  If I pass code like this,

void used(double x);
void usel(long x);
void test(int c) {
if (c) {
used(*((double __seg_gs *) 0));
} else {
usel(*((long __seg_gs *) 0));
}
}

the compiler ICEs (using some GCC-slang I learned from the comments to my
previous bug report ;)) in verify_gimple (full traceback attached).

It seems like the problematic IR is created in SSA PRE, although my GCC
debugging skills are too limited to verify this (I couldn't manage to print the
IR before and after this particular pass).

[Bug middle-end/79647] bogus warning when building openssl

2017-02-22 Thread bernd.edlinger at hotmail dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79647

--- Comment #7 from Bernd Edlinger  ---
(In reply to Andrew Pinski from comment #1)
> >The second warning is also bogus, the -Wno-parentheses-equality was accepted
> before.
> 
> Well this error message about an unknown warning option only happens if
> there was another error message.

is this a bug or a feature?

[Bug rtl-optimization/79584] ICE in base_to_reg, at lra-constraints.c:2918

2017-02-22 Thread amodra at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79584

Alan Modra  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |amodra at gmail dot com

--- Comment #4 from Alan Modra  ---
Created attachment 40813
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40813=edit
lra fix

Patch currently under test

[Bug c++/78301] noexcept() operator rejects sibling method call without object

2017-02-22 Thread benni.buch at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78301

--- Comment #3 from Benjamin Buch  ---
No, it isn't.

$ g++ -std=c++11 -o a a.cpp 
a.cpp:3:41: error: invalid use of 'this' at top level
  void outer() const noexcept( noexcept( this->inner() ) ) {


tested with:
$ g++ --version
g++ (GCC) 7.0.1 20170221 (experimental)
Copyright (C) 2017 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 tree-optimization/79671] [7 Regression] mapnik miscompilation on armv7hl since r235622

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79671

--- Comment #2 from Jakub Jelinek  ---
E.g. on 122 valgrind says:
==21905== Invalid free() / delete / delete[] / realloc()
==21905==at 0x484B224: operator delete(void*) (vg_replace_malloc.c:576)
==21905==by 0x11BB3:
path_expression_grammar<__gnu_cxx::__normal_iterator, std::allocator >
> >::path_expression_grammar() (in /tmp/rh1422456.122)
==21905==  Address 0xbd8fd048 is on thread 1's stack

Looking at tree dumps from PTRS_COMPARE_UNEQUAL=1 (works) and
PTRS_COMPARE_UNEQUAL=122 (calls free on invalid arg), I see the first change in
*.fre1 in path_expression_grammar::path_expression_grammar()
function,
   MEM[(struct  &)this_10(D) + 56] ={v} {CLOBBER};
   MEM[(struct function_base *)this_10(D) + 56B].vtable = 0B;
   _122 = MEM[(char * *)];
-  if (_M_local_buf != _122)
-goto ;
-  else
-goto ;
-
-  :
   operator delete (_122);
-
-  :
   MEM[(struct  &)] ={v} {CLOBBER};
   D.552047 ={v} {CLOBBER};
   D.552048 ={v} {CLOBBER};
   _29 = _10(D)->attr;
and
@@ -12334,15 +12330,7 @@ path_expression_grammar::path_

 :
   _140 = MEM[(char * *)];
-  if (_M_local_buf != _140)
-goto ;
-  else
-goto ;
-
-  :
   operator delete (_140);
-
-  :
   MEM[(struct  &)] ={v} {CLOBBER};
   D.552047 ={v} {CLOBBER};
   resx 7

(all other changes are just in bb numbers, as some bbs have been removed in the
latter case).
No idea what to figure out from this though, it just removes some operator
delete calls (free), but that shouldn't cause free being called on invalid,
worst case just memory leak.

[Bug c++/78301] noexcept() operator rejects sibling method call without object

2017-02-22 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78301

--- Comment #2 from Jonathan Wakely  ---
N.B. it's easy to workaround the bug by using this->inner()

Possibly related to PR 66256

[Bug tree-optimization/79671] [7 Regression] mapnik miscompilation on armv7hl since r235622

2017-02-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79671

--- Comment #1 from Jakub Jelinek  ---
So, I've patched the r235622 cross-compiler to:
--- tree-ssa-alias.c.xx 2017-02-21 19:17:36.0 +0100
+++ tree-ssa-alias.c2017-02-22 11:37:12.714172891 +0100
@@ -359,26 +359,31 @@ ptrs_compare_unequal (tree ptr1, tree pt
 }

   if (obj1 && obj2)
-/* Other code handles this correctly, no need to duplicate it here.  */;
+/* Other code handles this correctly, no need to duplicate it here.  */
+return false;
   else if (obj1 && TREE_CODE (ptr2) == SSA_NAME)
 {
   struct ptr_info_def *pi = SSA_NAME_PTR_INFO (ptr2);
   if (!pi)
return false;
-  return !pt_solution_includes (>pt, obj1);
+  if (!pt_solution_includes (>pt, obj1))
+   return false;
 }
   else if (TREE_CODE (ptr1) == SSA_NAME && obj2)
 {
   struct ptr_info_def *pi = SSA_NAME_PTR_INFO (ptr1);
   if (!pi)
return false;
-  return !pt_solution_includes (>pt, obj2);
+  if (!pt_solution_includes (>pt, obj2))
+   return false;
 }
+  else
+return false;

-  /* ???  We'd like to handle ptr1 != NULL and ptr1 != ptr2
- but those require pt.null to be conservatively correct.  */
-
-  return false;
+gcc_assert (TREE_CODE (ptr2) == SSA_NAME);
+int x = atoi (getenv ("PTRS_COMPARE_UNEQUAL"));
+debug_generic_stmt (ptr2);
+return SSA_NAME_VERSION (ptr2) == x;
 }

 /* Returns whether reference REF to BASE may refer to global memory.  */

and for the SSA_NAMEs printed with PTRS_COMPARE_UNEQUAL=1 tested assembly
for PTRS_COMPARE_UNEQUAL set to all those versions.
This gave me (1 is randomly chosen SSA_NAME that doesn't appear in the
list, so effectively all ptrs_compare_unequal return false):
===rh1422456.1===
===rh1422456.122===
*** Error in `/tmp/rh1422456.122': free(): invalid size: 0xbede60b8 ***
=== Backtrace: =
/lib/libc.so.6(+0x6b7e0)[0xb6bf47e0]
/lib/libc.so.6(+0x757f4)[0xb6bfe7f4]
/lib/libc.so.6(cfree+0x5c)[0xb6c02778]
/tmp/rh1422456.122[0x11bb4]
=== Memory map: 
0001-00014000 r-xp  00:24 53702  /tmp/rh1422456.122
00023000-00024000 rw-p 3000 00:24 53702  /tmp/rh1422456.122
01c1c000-01c41000 rw-p  00:00 0  [heap]
b6b87000-b6b89000 rw-p  00:00 0 
b6b89000-b6cd4000 r-xp  fd:00 2888289/usr/lib/libc-2.24.so
b6cd4000-b6ce3000 ---p 0014b000 fd:00 2888289/usr/lib/libc-2.24.so
b6ce3000-b6ce5000 r--p 0014a000 fd:00 2888289/usr/lib/libc-2.24.so
b6ce5000-b6ce6000 rw-p 0014c000 fd:00 2888289/usr/lib/libc-2.24.so
b6ce6000-b6ce9000 rw-p  00:00 0 
b6ce9000-b6d05000 r-xp  fd:00 2906708   
/usr/lib/libgcc_s-7-20170219.so.1
b6d05000-b6d14000 ---p 0001c000 fd:00 2906708   
/usr/lib/libgcc_s-7-20170219.so.1
b6d14000-b6d15000 r--p 0001b000 fd:00 2906708   
/usr/lib/libgcc_s-7-20170219.so.1
b6d15000-b6d16000 rw-p 0001c000 fd:00 2906708   
/usr/lib/libgcc_s-7-20170219.so.1
b6d16000-b6d87000 r-xp  fd:00 2888295/usr/lib/libm-2.24.so
b6d87000-b6d96000 ---p 00071000 fd:00 2888295/usr/lib/libm-2.24.so
b6d96000-b6d97000 r--p 0007 fd:00 2888295/usr/lib/libm-2.24.so
b6d97000-b6d98000 rw-p 00071000 fd:00 2888295/usr/lib/libm-2.24.so
b6d98000-b6ed1000 r-xp  fd:00 2888698/usr/lib/libstdc++.so.6.0.23
b6ed1000-b6ee1000 ---p 00139000 fd:00 2888698/usr/lib/libstdc++.so.6.0.23
b6ee1000-b6ee6000 r--p 00139000 fd:00 2888698/usr/lib/libstdc++.so.6.0.23
b6ee6000-b6ee8000 rw-p 0013e000 fd:00 2888698/usr/lib/libstdc++.so.6.0.23
b6ee8000-b6eea000 rw-p  00:00 0 
b6eea000-b6f0d000 r-xp  fd:00 2888281/usr/lib/ld-2.24.so
b6f19000-b6f1c000 rw-p  00:00 0 
b6f1c000-b6f1d000 r--p 00022000 fd:00 2888281/usr/lib/ld-2.24.so
b6f1d000-b6f1e000 rw-p 00023000 fd:00 2888281/usr/lib/ld-2.24.so
bed0-bede7000 rw-p  00:00 0  [stack]
bee71000-bee72000 r-xp  00:00 0  [sigpage]
-1000 r-xp  00:00 0  [vectors]
Aborted (core dumped)
===rh1422456.129===
*** Error in `/tmp/rh1422456.129': free(): invalid size: 0xbe8100d0 ***
=== Backtrace: =
/lib/libc.so.6(+0x6b7e0)[0xb6c7e7e0]
/lib/libc.so.6(+0x757f4)[0xb6c887f4]
/lib/libc.so.6(cfree+0x5c)[0xb6c8c778]
/tmp/rh1422456.129[0x11c08]
=== Memory map: 
0001-00014000 r-xp  00:24 42913  /tmp/rh1422456.129
00023000-00024000 rw-p 3000 00:24 42913  /tmp/rh1422456.129
0084e000-00873000 rw-p  00:00 0  [heap]
b6c11000-b6c13000 rw-p  00:00 0 
b6c13000-b6d5e000 r-xp  fd:00 2888289/usr/lib/libc-2.24.so
b6d5e000-b6d6d000 ---p 0014b000 fd:00 2888289/usr/lib/libc-2.24.so
b6d6d000-b6d6f000 r--p 0014a000 fd:00 2888289/usr/lib/libc-2.24.so
b6d6f000-b6d7 rw-p 0014c000 fd:00 2888289/usr/lib/libc-2.24.so
b6d7-b6d73000 rw-p  00:00 0 
b6d73000-b6d8f000 r-xp  fd:00 2906708   
/usr/lib/libgcc_s-7-20170219.so.1
b6d8f000-b6d9e000 ---p 

[Bug c++/79670] [c++1z] cannot call member function without object in noexcept declarator of a member function

2017-02-22 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79670

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #1 from Jonathan Wakely  ---
This is just a dup of PR 78301 and not specific to c++1z.

*** This bug has been marked as a duplicate of bug 78301 ***

[Bug c++/78301] noexcept() operator rejects sibling method call without object

2017-02-22 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78301

Jonathan Wakely  changed:

   What|Removed |Added

 CC||benni.buch at gmail dot com

--- Comment #1 from Jonathan Wakely  ---
*** Bug 79670 has been marked as a duplicate of this bug. ***

[Bug c++/78301] noexcept() operator rejects sibling method call without object

2017-02-22 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78301

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-02-22
 Ever confirmed|0   |1

[Bug c++/79672] ICE with -Wduplicated-branches -fopenmp

2017-02-22 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79672

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-02-22
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Confirmed.

[Bug c++/79672] New: ICE with -Wduplicated-branches -fopenmp

2017-02-22 Thread reichelt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79672

Bug ID: 79672
   Summary: ICE with -Wduplicated-branches -fopenmp
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code, openmp
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The followiong code snippet triggers an ICE on trunk when
compiled with "-Wduplicated-branches -fopenmp":


template void foo()
{
  if (N > 0)
  {
#pragma omp parallel for
for (int i = 0; i < 10; ++i) ;
  }
}

void bar()
{
  foo<0>();
}


bug.cc: In instantiation of 'void foo() [with int N = 0]':
bug.cc:12:10:   required from here
bug.cc:8:1: internal compiler error: in add_expr, at tree.c:7925
 }
 ^
0xfe1677 inchash::add_expr(tree_node const*, inchash::hash&, unsigned int)
../../gcc/gcc/tree.c:7925
0xfe1af1 inchash::add_expr(tree_node const*, inchash::hash&, unsigned int)
../../gcc/gcc/tree.c:8010
0xfe1af1 inchash::add_expr(tree_node const*, inchash::hash&, unsigned int)
../../gcc/gcc/tree.c:8010
0xfe1af1 inchash::add_expr(tree_node const*, inchash::hash&, unsigned int)
../../gcc/gcc/tree.c:8010
0xfe1955 inchash::add_expr(tree_node const*, inchash::hash&, unsigned int)
../../gcc/gcc/tree.c:8010
0xfe1af1 inchash::add_expr(tree_node const*, inchash::hash&, unsigned int)
../../gcc/gcc/tree.c:8010
0x8a90a6 do_warn_duplicated_branches
../../gcc/gcc/c-family/c-warn.c:2263
0x8a90a6 do_warn_duplicated_branches_r(tree_node**, int*, void*)
../../gcc/gcc/c-family/c-warn.c:2290
0xff8a23 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set >*))
../../gcc/gcc/tree.c:11796
0xff85a0 walk_tree_without_duplicates_1(tree_node**, tree_node*
(*)(tree_node**, int*, void*), void*, tree_node* (*)(tree_node**, int*,
tree_node* (*)(tree_node**, int*, void*), void*, hash_set >*))
../../gcc/gcc/tree.c:12139
0x86cb42 c_genericize(tree_node*)
../../gcc/gcc/c-family/c-gimplify.c:129
0x7f3b11 cp_genericize(tree_node*)
../../gcc/gcc/cp/cp-gimplify.c:1649
0x60ddb2 finish_function(int)
../../gcc/gcc/cp/decl.c:15703
0x67ac1b instantiate_decl(tree_node*, bool, bool)
../../gcc/gcc/cp/pt.c:22858
0x680f8b instantiate_pending_templates(int)
../../gcc/gcc/cp/pt.c:22955
0x6c4918 c_parse_final_cleanups()
../../gcc/gcc/cp/decl2.c:4526
Please submit a full bug report, [etc.]

[Bug tree-optimization/79389] [7 Regression] 30% performance regression in SciMark2 MonteCarlo

2017-02-22 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79389

--- Comment #5 from rguenther at suse dot de  ---
On Wed, 22 Feb 2017, ubizjak at gmail dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79389
> 
> Uroš Bizjak  changed:
> 
>What|Removed |Added
> 
>  CC||jakub at gcc dot gnu.org
> 
> --- Comment #4 from Uroš Bizjak  ---
> The testcase for missing if-conversion:
> 
> --cut here--
> extern double Random_nextDouble (void);
> 
> int foo (int Num_samples)
> {
>   int count;
>   int under_curve = 0;
> 
>   for (count=0; count {
>   double x= Random_nextDouble ();
>   double y= Random_nextDouble ();
>   if ( x*x + y*y <= 1.0)
> under_curve ++;
> }
> 
>   return under_curve;
> }
> --cut here--
> 
> gcc -O2:
> 
> xorl%ebx, %ebx
> ...
> .L5:
> callRandom_nextDouble
> movsd   %xmm0, 8(%rsp)
> callRandom_nextDouble
> movsd   8(%rsp), %xmm1
> ++> leal1(%rbx), %eax
> mulsd   %xmm0, %xmm0
> mulsd   %xmm1, %xmm1
> movsd   .LC0(%rip), %xmm2
> addsd   %xmm0, %xmm1
> ucomisd %xmm1, %xmm2
> --> cmovnb  %eax, %ebx
> addl$1, %ebp
> cmpl%ebp, %r12d
> jne .L5
> 
> gcc -O3 is even more "innovative":
> 
> xorl%r12d, %r12d
> ...
> .L2:
> callRandom_nextDouble
> movsd   %xmm0, 8(%rsp)
> callRandom_nextDouble
> movsd   8(%rsp), %xmm1
> mulsd   %xmm0, %xmm0
> mulsd   %xmm1, %xmm1
> movsd   .LC0(%rip), %xmm2
> addsd   %xmm0, %xmm1
> ucomisd %xmm1, %xmm2
> --> jnb .L13
> addl$1, %ebx
> cmpl%ebx, %ebp
> jne .L2
> 
> .L13:
> addl$1, %ebx
> ++> addl$1, %r12d
> cmpl%ebp, %ebx
> jne .L2
> 
> IF-conversion to SETcc + ZEXT + ADD would avoid cmove/jump in this short loop.
> 
> (I'm not sure if tree or RTL ifconvert pass should catch this situation.)

There is only RTL ifconvert left.

[Bug tree-optimization/79389] [7 Regression] 30% performance regression in SciMark2 MonteCarlo

2017-02-22 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79389

Uroš Bizjak  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #4 from Uroš Bizjak  ---
The testcase for missing if-conversion:

--cut here--
extern double Random_nextDouble (void);

int foo (int Num_samples)
{
  int count;
  int under_curve = 0;

  for (count=0; count leal1(%rbx), %eax
mulsd   %xmm0, %xmm0
mulsd   %xmm1, %xmm1
movsd   .LC0(%rip), %xmm2
addsd   %xmm0, %xmm1
ucomisd %xmm1, %xmm2
--> cmovnb  %eax, %ebx
addl$1, %ebp
cmpl%ebp, %r12d
jne .L5

gcc -O3 is even more "innovative":

xorl%r12d, %r12d
...
.L2:
callRandom_nextDouble
movsd   %xmm0, 8(%rsp)
callRandom_nextDouble
movsd   8(%rsp), %xmm1
mulsd   %xmm0, %xmm0
mulsd   %xmm1, %xmm1
movsd   .LC0(%rip), %xmm2
addsd   %xmm0, %xmm1
ucomisd %xmm1, %xmm2
--> jnb .L13
addl$1, %ebx
cmpl%ebx, %ebp
jne .L2

.L13:
addl$1, %ebx
++> addl$1, %r12d
cmpl%ebp, %ebx
jne .L2

IF-conversion to SETcc + ZEXT + ADD would avoid cmove/jump in this short loop.

(I'm not sure if tree or RTL ifconvert pass should catch this situation.)

  1   2   >