[Bug c++/87121] wrong 128-bit integer multiplication with mixed bit size

2018-08-27 Thread mpreda at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87121

--- Comment #2 from Mihai Preda  ---
OK my bad.

I don't understand exactly why the  or the std:: pow() version is
preferred, but this seems to be what's happening, and explains the behavior.

Feel free to close this.

[Bug fortran/86328] [8/9 Regression] Runtime segfault reading an allocatable class(*) object in allocate statements

2018-08-27 Thread mscfd at gmx dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86328

--- Comment #12 from martin  ---
The workaround mentioned by Paul in comment #9 is working only partially. For
character sequences (and possibly other data types), valgrind still complains.
Surprisingly, using a single character works as well. On the other with three
or more characters, valgrind sees one more invalid read than with two
characters. The workaround for me was to switch to a string derived-type, which
encapsulates the character variable. Then I only see memory leaks, but no
invalid reads, or other serious stuff.

Here is the variation which still shows the problems with a character constant:

program classstar_alloc3

   type :: t
  class(*), allocatable :: val
   end type

   type :: list
  type(t), dimension(:), pointer :: ll
   end type

   integer :: i
   type(list) :: a

   allocate(a%ll(1:2))
   do i = 1,2
  allocate(a%ll(i)%val, source='01')
   end do

   call rrr(a)

contains

   subroutine rrr(a)
  type(list), intent(in) :: a
  class(*), allocatable :: c

  ! allocate(c, source=a%ll(2)%val)
  c = a%ll(2)%val
   end subroutine

end program classstar_alloc3

[Bug c++/87121] wrong 128-bit integer multiplication with mixed bit size

2018-08-27 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87121

Andrew Pinski  changed:

   What|Removed |Added

  Component|target  |c++

--- Comment #1 from Andrew Pinski  ---
This sounds like std::pow is being used instead of the ::pow you have created.
I suspect this is not a bug.  std::pow is the floating point version.

[Bug c++/87121] New: wrong 128-bit integer multiplication with mixed bit size

2018-08-27 Thread mpreda at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87121

Bug ID: 87121
   Summary: wrong 128-bit integer multiplication with mixed bit
size
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: mpreda at gmail dot com
  Target Milestone: ---

Created attachment 44613
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44613=edit
repro source

Ubuntu 18.04.1
Linux x2 4.15.0-32-generic #35-Ubuntu SMP Fri Aug 10 17:58:07 UTC 2018 x86_64
x86_64 x86_64 GNU/Linux

On g++7 and g++8:

g++ (Ubuntu 7.3.0-16ubuntu3) 7.3.0

g++-8 (Ubuntu 8-20180414-1ubuntu2) 8.0.1 20180414 (experimental) [trunk
revision 259383]

In some special context which seems to include as relevant:
- an include of 
- using namespace std;

the integer multiplication 128-bit times 64-bit produces incorrect result.
See attached small repro case.

Expected output (see attached source): all 1.
Observed output:
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

[Bug tree-optimization/87110] [9 Regresssion] tree check fail in to_wide, at tree.h:5523

2018-08-27 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87110

Jeffrey A. Law  changed:

   What|Removed |Added

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

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

[Bug tree-optimization/87110] [9 Regresssion] tree check fail in to_wide, at tree.h:5523

2018-08-27 Thread law at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87110

--- Comment #4 from Jeffrey A. Law  ---
Author: law
Date: Tue Aug 28 04:02:11 2018
New Revision: 263906

URL: https://gcc.gnu.org/viewcvs?rev=263906=gcc=rev
Log:
PR tree-optimization/87110
* tree-ssa-dse.c (compute_trims): Handle non-constant
TYPE_SIZE_UNIT.

PR tree-optimization/87110
* gcc.c-torture/compile/pr87110.c: New test.

Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr87110.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-dse.c

[Bug tree-optimization/87110] [9 Regresssion] tree check fail in to_wide, at tree.h:5523

2018-08-27 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87110

--- Comment #3 from Jeffrey A. Law  ---
It's different, but related.

[Bug tree-optimization/87110] [9 Regresssion] tree check fail in to_wide, at tree.h:5523

2018-08-27 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87110

Jeffrey A. Law  changed:

   What|Removed |Added

 CC||law at redhat dot com

--- Comment #2 from Jeffrey A. Law  ---
Ah, I think this is something I already fixed today after seeing a kernel build
fail.  I'll verify, potentially adding this test to the regression suite.

[Bug c++/87109] Wrong overload picked with ref-qualifiers

2018-08-27 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87109

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-08-28
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Marek Polacek  ---
I've been looking into this.

[Bug tree-optimization/86914] [8 Regression] -O2 generates wrong code with strlen() of pointers within one-element arrays of structures

2018-08-27 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86914

Martin Sebor  changed:

   What|Removed |Added

Summary|[8/9 Regression] -O2|[8 Regression] -O2
   |generates wrong code with   |generates wrong code with
   |strlen() of pointers within |strlen() of pointers within
   |one-element arrays of   |one-element arrays of
   |structures  |structures
  Known to fail|9.0 |

--- Comment #6 from Martin Sebor  ---
Patch committed to trunk in r263905.

[Bug tree-optimization/86914] [8/9 Regression] -O2 generates wrong code with strlen() of pointers within one-element arrays of structures

2018-08-27 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86914

--- Comment #5 from Martin Sebor  ---
Author: msebor
Date: Tue Aug 28 00:25:50 2018
New Revision: 263905

URL: https://gcc.gnu.org/viewcvs?rev=263905=gcc=rev
Log:
PR tree-optimization/86914 - wrong code with strlen() of poor-man's flexible
array member plus offset

gcc/ChangeLog:

PR tree-optimization/86914
* tree-ssa-strlen.c (maybe_set_strlen_range): Avoid MEM_REF.

gcc/testsuite/ChangeLog:

PR tree-optimization/86914
* gcc.dg/strlenopt-57.c: New test.


Added:
trunk/gcc/testsuite/gcc.dg/strlenopt-57.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-strlen.c

[Bug tree-optimization/87112] [9 Regression] ICE in fold_binary_loc, at fold-const.c:9334

2018-08-27 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87112

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #5 from Martin Sebor  ---
Patch committed in r263900.

[Bug tree-optimization/87112] [9 Regression] ICE in fold_binary_loc, at fold-const.c:9334

2018-08-27 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87112

--- Comment #4 from Martin Sebor  ---
Author: msebor
Date: Tue Aug 28 00:10:46 2018
New Revision: 263900

URL: https://gcc.gnu.org/viewcvs?rev=263900=gcc=rev
Log:
PR tree-optimization/87112 - ICE in fold_binary_loc on strnlen of mixed integer
types

gcc/ChangeLog:

PR tree-optimization/87112
* builtins.c (expand_builtin_strnlen): Convert c_strlen result to
the type of the bound argument.

gcc/testsuite/ChangeLog:

PR tree-optimization/87112
* gcc.dg/pr87112.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/pr87112.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/63392] poor error recovery with missing typename

2018-08-27 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63392

--- Comment #3 from David Malcolm  ---
Author: dmalcolm
Date: Mon Aug 27 23:33:02 2018
New Revision: 263899

URL: https://gcc.gnu.org/viewcvs?rev=263899=gcc=rev
Log:
C++: fix-it hint for missing "typename" (PR c++/63392)

This patch adds a fix-it hint to missing "typename" errors in the C++
frontend, suggesting the insertion of "typename ".

This addresses part of PR c++/63392; however it does not improve the
error-recovery for such cases.

gcc/cp/ChangeLog:
PR c++/63392
* parser.c (cp_parser_diagnose_invalid_type_name): Add fix-it
hint.

gcc/testsuite/ChangeLog:
PR c++/63392
* g++.dg/diagnostic/missing-typename.C: New test.


Added:
trunk/gcc/testsuite/g++.dg/diagnostic/missing-typename.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/parser.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/87120] New: gcc incorrectly accepts uniform-initializing bool values from double

2018-08-27 Thread vz-gcc at zeitlins dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87120

Bug ID: 87120
   Summary: gcc incorrectly accepts uniform-initializing bool
values from double
   Product: gcc
   Version: 8.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: vz-gcc at zeitlins dot org
  Target Milestone: ---

gcc 8.2.0 incorrectly (AFAICS) compiles the following program:

% cat -n init.cpp
 1  double foo() { return 17.0; }
 2  
 3  int main()
 4  {
 5  bool b{foo()};
 6  return b;
 7  }
% g++ -std=c++17 -Wall init.cpp
% g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 8.2.0-4'
--with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr
--with-gcc-major-version-only --program-suffix=-8
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie
--with-system-zlib --with-target-system-zlib --enable-objc-gc=auto
--enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 8.2.0 (Debian 8.2.0-4)

Compare this with clang:

% clang++-7 -std=c++17 -Wall init.cpp && ./a.out
init.cpp:5:12: error: type 'double' cannot be narrowed to 'bool' in initializer
list [-Wc++11-narrowing]
bool b{foo()};
   ^
init.cpp:5:12: note: insert an explicit cast to silence this issue
bool b{foo()};
   ^
   static_cast( )
1 error generated.

or MSVS 2017.7:

% cl /W4 init.cpp
init.cpp
init.cpp(5): error C2397: conversion from 'double' to 'bool' requires a
narrowing conversion

[Bug libstdc++/87116] Incorrect result of std::filesystem::path::lexically_normal() for more than 3 dot-dot elements

2018-08-27 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87116

--- Comment #1 from Jonathan Wakely  ---
The problem is in this step of the normalisation algorithm:

  - As long as any appear, remove a non-dot-dot filename immediately followed
by a directory-separator and a dot-dot filename, along with any immediately
following directory-separator.

The second time I do that, I leave a trailing slash in the native format
string, but not in the vector of path components. The third time then removes
two components not one.

Shouldn't be too hard to fix.

[Bug libstdc++/87116] Incorrect result of std::filesystem::path::lexically_normal() for more than 3 dot-dot elements

2018-08-27 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87116

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2018-08-27
   Assignee|unassigned at gcc dot gnu.org  |redi at gcc dot gnu.org
   Target Milestone|--- |8.3
 Ever confirmed|0   |1

[Bug tree-optimization/87112] [9 Regression] ICE in fold_binary_loc, at fold-const.c:9334

2018-08-27 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87112

Martin Sebor  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #3 from Martin Sebor  ---
Patch: https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01709.html

[Bug tree-optimization/87112] [9 Regression] ICE in fold_binary_loc, at fold-const.c:9334

2018-08-27 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87112

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #2 from Martin Sebor  ---
expand_builtin_strnlen() creates a MIN_EXPR with operands of mixed types which
then trips the assertion newly added to fold_binary_loc() to detect these
mismatches.

[Bug tree-optimization/86010] [7/8/9 Regression] redundant memset with smaller size not eliminated

2018-08-27 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86010

--- Comment #8 from Martin Sebor  ---
I believe the fix is behind the regression reported in pr87011.

[Bug c/87119] New: ice in set_value_range, at tree-vrp.c:289

2018-08-27 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87119

Bug ID: 87119
   Summary: ice in set_value_range, at tree-vrp.c:289
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

The following C code:

enum { a = 1 } b;
unsigned long c;
d, e, f, g, h, i, j, k;
l() {
  while (h)
while (i)
  if (j)
return;
  if (g && f && e && m() == a)
k = d && c && strncmp(, "", c - 1);
}

when compiled by recent gcc trunk and compiler flag -O2, does this:

/home/dcb/gcc/results.263799.asan/bin/gcc
/home/dcb/gcc/results.263849/bin/gcc
during RTL pass: expand
bug461.c: In function ‘l’:
bug461.c:10:19: internal compiler error: in set_value_range, at tree-vrp.c:289
10 | k = d && c && strncmp(, "", c - 1);
   |   ^~
0x116adfe set_value_range(value_range*, value_range_type, tree_node*,
tree_node*
, bitmap_head*)
../../trunk/gcc/tree-vrp.c:289
0x1175cff extract_range_from_binary_expr_1(value_range*, tree_code, tree_node*, 
value_range*, value_range*)
../../trunk/gcc/tree-vrp.c:1568
0x1177924 determine_value_range_1
../../trunk/gcc/tree-vrp.c:6765
0x1177aff determine_value_range(tree_node*,
generic_wide_int*,
 generic_wide_int*)
../../trunk/gcc/tree-vrp.c:6800

The problem seems to exist from 263799 to 263849.

[Bug middle-end/80283] [6/7/8/9 Regression] bad SIMD register allocation

2018-08-27 Thread already5chosen at yahoo dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80283

--- Comment #25 from Michael_S  ---
Just a reminder 16 months later:
x86-64 case - both 8.2 and trunk are as bad as they were.
ARM-Neon case - 8.2 appears to be worse (by 5%) than either 6.x or 7.x. I
didn't check trunk.

[Bug c/87118] New: ICE in expand_expr_addr_expr_1, at expr.c:7862

2018-08-27 Thread gsocsameeran at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87118

Bug ID: 87118
   Summary: ICE in expand_expr_addr_expr_1, at expr.c:7862
   Product: gcc
   Version: 7.2.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gsocsameeran at gmail dot com
  Target Milestone: ---
  Host: i686-linux-gnu
Target: i686-linux-gnu
 Build: i686-pc-linux-gnu

Created attachment 44612
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44612=edit
.ii file attached

gcc version
---
swamimauli@swamimauli:~/upload/csmith/runtime/del$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/7/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
7.2.0-8ubuntu3.2' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr
--with-gcc-major-version-only --program-suffix=-7
--program-prefix=i686-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie
--with-system-zlib --with-target-system-zlib --enable-objc-gc=auto
--enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu
--target=i686-linux-gnu
Thread model: posix
gcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu3.2) 
swamimauli@swamimauli:~/upload/csmith/runtime/del$ 


  compiling command
---
Below is command line:
OPTIONS :-fgnu-tm for transactional memory extension

swamimauli@swamimauli:~/upload/csmith/runtime/del$ gcc -fgnu-tm testcase.c
testcase.c: In function ‘func_9’:
testcase.c:471:139: warning: comparison of distinct pointer types lacks a cast
 nc_14(func_18(p_11), ((safe_div_func_uint8_t_u_u(((g_406.f5 &= (l_538[0][1] >
((safe_sub_func_uint64_t_u_u(p_11, ((g_541 == ((*l_546) = g_545)) , (p_11 ,
(-3L) != (safe_div_func_uint8_t_u_u(((*l_558) =
((safe_add_func_int32_t_s_s((safe_lshift_func_uint8_t_u_u(safe_mul_func_uint8_t_u_u(((safe_lshift_func_uint8_t_u_sg_100.f4
|| 65531UL) , (-8L)) & p_11), 3)) < 0xC625L), l_557)) , 0xEF867843L) , l_557)
!= p_11), 6)), g_133[0][1].f5)) == 0x3EADAD52L)), l_538[0][1]) ==
g_212[0][4]), (**g_391))) , (void*)0), g_3);
   
  ^~
testcase.c: In function ‘func_14’:
testcase.c:618:468: warning: comparison of distinct pointer types lacks a cast
 func_int16_t_s_s(6L, (1UL & l_703[7]))), g_531.f5)) <= 0x5EL), l_644)),
(*l_662) | 0x9C1A534825D755BFLL) , (*g_541)) != l_704[2][0][1]) ==
l_629)));
   
  ^~
testcase.c:685:260: warning: comparison of distinct pointer types lacks a cast
 nt32_t_u_u(p_17, (-6L), ((g_751 != ((l_752 != (**p_15)) != (l_753 =
l_652[3]))) < (safe_div_func_uint16_t_u_u((l_756 != l_757), 0x0ABFL) !=
p_17));
   
  ^~
testcase.c: In function ‘func_33’:
testcase.c:859:139: internal compiler error: in expand_expr_addr_expr_1, at
expr.c:7862
 (*l_126) = 4294967295UL) == (*l_128) = _102) != l_130) ,
((g_133[0][1] , l_134) != (p_36 != (void*)0))) > g_100.f3)) & ((void*)0 ==
l_135)) || 0xAC466B2A51B1567ELL) > g_56.f0);
   
 ~^~~
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
swamimauli@swamimauli:~/upload/csmith/runtime/del$ 


   reduced file
-

REDUCED TESTCACE :
#include "csmith.h"
struct {
  unsigned : 7;
  unsigned a : 3
} b[][1];
c() {
  __transaction_relaxed { safe_rshift_func_int16_t_s_u(0, b[0][1].a); }
}


 backtrack report
--
This is the full backtrace of the ICE:
bug.c: In function ‘func_33’:
bug.c:857:139: internal compiler error: in exact_div, at poly-int.h:2139
0x89a47f poly_int<1u, poly_result::is_poly>::type, poly_coeff_pair_traits::is_poly>::type>::result_kind>::type>
exact_div<1u, 

[Bug c++/86993] [6/7/8/9 Regression] assignment of read-only variable error reported at wrong location

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86993

--- Comment #3 from Jakub Jelinek  ---
Author: jakub
Date: Mon Aug 27 18:36:23 2018
New Revision: 263891

URL: https://gcc.gnu.org/viewcvs?rev=263891=gcc=rev
Log:
PR c++/86993
* cp-tree.h (cxx_readonly_error): Add location_t argument.
* typeck2.c (cxx_readonly_error): Add LOC argument, pass it to
ERROR_FOR_ASSIGNMENT macro and readonly_error.  Add LOC argument
to ERROR_FOR_ASSIGNMENT macro, use error_at instead of error and
pass LOC to it.  Formatting fixes.
* typeck.c (cp_build_unary_op): Pass location to cxx_readonly_error.
(cp_build_modify_expr): Pass loc to cxx_readonly_error.
* semantics.c (finish_asm_stmt): Pass input_location to
cxx_readonly_error.

* g++.dg/diagnostic/pr86993.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/diagnostic/pr86993.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/semantics.c
trunk/gcc/cp/typeck.c
trunk/gcc/cp/typeck2.c
trunk/gcc/testsuite/ChangeLog

[Bug tree-optimization/87117] [9 Regression] ICE in eliminate_dom_walker::eliminate_cleanup(bool) at gcc/gcc/tree-ssa-sccvn.c:5431 since r263875

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87117

Martin Liška  changed:

   What|Removed |Added

   Priority|P3  |P1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-08-27
   Target Milestone|--- |9.0
 Ever confirmed|0   |1

--- Comment #1 from Martin Liška  ---
And one another:

$ ./xgcc -B.
/home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/torture/pr71168.c -O2
-fno-inline -fno-tree-dce
during GIMPLE pass: pre
/home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/torture/pr71168.c: In
function ‘fn2’:
/home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/torture/pr71168.c:15:6:
internal compiler error: in tree_to_shwi, at tree.c:6839
15 | void fn2()
   |  ^~~
0x6e2a95 tree_to_shwi(tree_node const*)
/home/marxin/Programming/gcc/gcc/tree.c:6839
0xe6b5c1 fully_constant_vn_reference_p(vn_reference_s*)
/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:1420
0xe7285a vn_reference_lookup_pieces(tree_node*, int, tree_node*,
vec, vn_reference_s**, vn_lookup_kind)
/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:2559
0xe4e4f2 phi_translate_1
/home/marxin/Programming/gcc/gcc/tree-ssa-pre.c:1553
0xe4d86e phi_translate
/home/marxin/Programming/gcc/gcc/tree-ssa-pre.c:1684
0xe4d996 phi_translate_set
/home/marxin/Programming/gcc/gcc/tree-ssa-pre.c:1722
0xe50156 compute_antic_aux
/home/marxin/Programming/gcc/gcc/tree-ssa-pre.c:2062
0xe50156 compute_antic
/home/marxin/Programming/gcc/gcc/tree-ssa-pre.c:2408
0xe50156 execute
/home/marxin/Programming/gcc/gcc/tree-ssa-pre.c:4213
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug c/53769] [C11]: Macros __STDC_NO_THREADS__ / __STDC_NO_ATOMIC__ missing.

2018-08-27 Thread fw at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53769

--- Comment #9 from Florian Weimer  ---
(In reply to Vincent Lefèvre from comment #8)
> (In reply to Florian Weimer from comment #7)
> > Furthermore, if I don't misread the standard, the expectation is that if an
> > implementation does not support threads, it still recognizes _Thread_local
> > and mostly ignores it,
> 
> I suppose that the goal is to be able to compile multithread-aware programs
> on platforms that do not support threads. Since there is only one thread,
> thread storage duration is equivalent to static storage duration.

Exactly.

> > so that it is available even if __STDC_NO_THREADS__
> > is not defined.  (Which is of course rather dodgy if you need to conform to
> > an existing ABI for thread-local variables, so I think the committee made a
> > mistake here.)
> 
> The ABI is out of the scope of the standard, so that I don't see any issue
> here. The conformance to the existing ABI is something above the standard.

But we still have the issue for compilers targeting an ABI which has threads
and full thread-local support but which themselves do not support it.  They
really should not treat _Thread_local as static storage duration because that
would either produce object files which fail to link, or silently corrupt
programs (which may even work most of the time).

[Bug tree-optimization/87117] New: [9 Regression] ICE in eliminate_dom_walker::eliminate_cleanup(bool) at gcc/gcc/tree-ssa-sccvn.c:5431 since r263875

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87117

Bug ID: 87117
   Summary: [9 Regression] ICE in
eliminate_dom_walker::eliminate_cleanup(bool) at
gcc/gcc/tree-ssa-sccvn.c:5431 since r263875
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: marxin at gcc dot gnu.org
CC: rguenth at gcc dot gnu.org
  Target Milestone: ---

Following ICEs:

$ ./xgcc -B.
/home/marxin/Programming/gcc/gcc/testsuite/gfortran.dg/maxval_char_2.f90
-fsanitize=undefined -Ofast
during GIMPLE pass: cunrolli
/home/marxin/Programming/gcc/gcc/testsuite/gfortran.dg/maxval_char_2.f90:2:0:

2 | program main
  | 
internal compiler error: Segmentation fault
0xd4866f crash_signal
/home/marxin/Programming/gcc/gcc/toplev.c:325
0x769d810f ???
   
/usr/src/debug/glibc-2.27-6.1.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0xee53f0 eliminate_dom_walker::eliminate_cleanup(bool)
/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:5431
0xef575e do_rpo_vn
/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:6532
0xef58f7 do_rpo_vn(function*, edge_def*, bitmap_head*)
/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:6551
0xe7ac48 tree_unroll_loops_completely
/home/marxin/Programming/gcc/gcc/tree-ssa-loop-ivcanon.c:1479
0xe7ae38 execute
/home/marxin/Programming/gcc/gcc/tree-ssa-loop-ivcanon.c:1655

or a bit different back-trace:

$ ./xgcc -B. /home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/lvalue-5.c -O1
/home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/lvalue-5.c: In function ‘f’:
/home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/lvalue-5.c:9:3: warning:
assignment of read-only location ‘"foo"[0]’
9 |   "foo"[0] = 0; /* { dg-warning "assignment of read-only location" } */
  |   ^
/home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/lvalue-5.c:10:3: warning:
increment of read-only location ‘"foo"[0]’
10 |   "foo"[0]++; /* { dg-warning "increment of read-only location" } */
   |   ^
/home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/lvalue-5.c:11:3: warning:
decrement of read-only location ‘"foo"[0]’
11 |   "foo"[0]--; /* { dg-warning "decrement of read-only location" } */
   |   ^
/home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/lvalue-5.c:12:3: warning:
increment of read-only location ‘"foo"[0]’
12 |   ++"foo"[0]; /* { dg-warning "increment of read-only location" } */
   |   ^~
/home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/lvalue-5.c:13:3: warning:
decrement of read-only location ‘"foo"[0]’
13 |   --"foo"[0]; /* { dg-warning "decrement of read-only location" } */
   |   ^~
during GIMPLE pass: fre
/home/marxin/Programming/gcc/gcc/testsuite/gcc.dg/lvalue-5.c:14:1: internal
compiler error: in vn_reference_insert, at tree-ssa-sccvn.c:2698
14 | }
   | ^
0x6c2e4a vn_reference_insert
/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:2698
0xe78f60 visit_reference_op_store
/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:4066
0xe78f60 visit_stmt
/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:4314
0xe7abcc process_bb
/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:5984
0xe7bb02 do_rpo_vn
/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:6405
0xe7ca8c execute
/home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:6597

[Bug tree-optimization/87112] [9 Regression] ICE in fold_binary_loc, at fold-const.c:9334

2018-08-27 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87112

Andreas Schwab  changed:

   What|Removed |Added

 CC||seurer at gcc dot gnu.org

--- Comment #1 from Andreas Schwab  ---
*** Bug 87114 has been marked as a duplicate of this bug. ***

[Bug tree-optimization/87114] [9 regression] ICE in gcc.c-torture/execute/builtins/strnlen.c starting with r263855

2018-08-27 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87114

Andreas Schwab  changed:

   What|Removed |Added

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

--- Comment #1 from Andreas Schwab  ---
dup

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

[Bug c++/87015] [8/9 Regression] miscompilation of template heavy Boost Spirit code

2018-08-27 Thread daniel.f.starke at freenet dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87015

--- Comment #5 from Daniel Starke  ---
I tried the version 8 branch snapshot from 2018-08-24 but the issue still
remains.

[Bug tree-optimization/57492] Optimize 2.0**i to ldexp(1.0,i)

2018-08-27 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57492

--- Comment #5 from joseph at codesourcery dot com  ---
The example from comment#2 should require -funsafe-math-optimizations 
(it's not correct if the pow call overflowed / underflowed but the ldexp 
call doesn't).

[Bug libstdc++/87116] New: Incorrect result of std::filesystem::path::lexically_normal() for more than 3 dot-dot elements

2018-08-27 Thread benjamin.kollenda at rub dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87116

Bug ID: 87116
   Summary: Incorrect result of
std::filesystem::path::lexically_normal() for more
than 3 dot-dot elements
   Product: gcc
   Version: 8.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: benjamin.kollenda at rub dot de
  Target Milestone: ---

Created attachment 44611
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44611=edit
Example code with test inputs and expected outputs

Using std::filesystem::path::lexically_normal() with gcc 8.2.0 produces
incorrect results for paths with three or more dot-dot elements.
Example input:
comp0/comp1/comp2/comp3/../../../comp4/comp5/comp6/comp7
Expected output:
comp0/comp4/comp5/comp6/comp7
Actual output:
comp4/comp5/comp6/comp7

Using just 2 dot-dot elements works as expected:
Input:
comp0/comp1/comp2/comp3/../../comp4/comp5/comp6/comp7
Output:
comp0/comp1/comp4/comp5/comp6/comp7

This seems to be related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82777
but not fixed already. The testcase given in that bugreport works correctly on
my system.

GCC version is 8.2.0 on Arch Linux 64bit.
Commandline: g++ -std=c++17 filesystem.cpp -lstdc++fs -Wall -Wextra -o
filesystem

I attached a file containing test inputs and expected outputs.

[Bug c/39438] Can't compile a wrapper around strftime with -Werror=format-nonliteral

2018-08-27 Thread groungccg at amelkin dot msk.ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39438

Alexander Amelkin  changed:

   What|Removed |Added

 CC||groungccg at amelkin dot msk.ru

--- Comment #11 from Alexander Amelkin  ---
I'm still seeing this with "gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0
20160609".
Is there any chance that this NINE YEAR OLD bug is going to be fixed?

[Bug tree-optimization/86865] [9 Regression] Wrong code w/ -O2 -floop-parallelize-all -fstack-reuse=none -fwrapv -fno-tree-ch -fno-tree-dce -fno-tree-dominator-opts -fno-tree-loop-ivcanon

2018-08-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86865

--- Comment #3 from Richard Biener  ---
We code-generate

   [local count: 107374]:
  xy = 0;

   [local count: 107374]:
  # graphite_IV.7_4 = PHI <0(2), graphite_IV.7_2(17)>
  _21 = (int) graphite_IV.7_4;
  _22 = ~_21;
  sa = {};

...

   [count: 0]:
  xy = _22;
  graphite_IV.7_2 = graphite_IV.7_4 + 1;
  if (graphite_IV.7_4 < 1)
goto ; [100.00%]
  else
goto ; [0.00%]

   [count: 0]:
  goto ; [100.00%]

   [count: 0]:
  tb = 1;
  return;

The issue is in the way we generate do-while style loops where we execute stmts
in the original latch too many times in this case.

The store to xy is originally in the latch of the not header copied loop
but not afterwards.

-fgraphite-identity is enough, no need to "parallelize".

[Bug rtl-optimization/85805] [7/8/9 Regression] Wrong code for 64 bit comparisons on avr-gcc

2018-08-27 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85805

--- Comment #10 from Segher Boessenkool  ---
It is fixed for 9 yes, and I am still pondering it for 8.  I guess that's
not going to happen.

[Bug target/87115] New: FAIL: gcc.dg/split-5.c execution test

2018-08-27 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87115

Bug ID: 87115
   Summary: FAIL: gcc.dg/split-5.c execution test
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hjl.tools at gmail dot com
CC: wei3.xiao at intel dot com
Blocks: 81652
  Target Milestone: ---
Target: x86-64

gcc.dg/split-5.c fails to run on CET machine:

[hjl@gnu-cet-1 gcc]$
/export/build/gnu/tools-build/gcc-cet-sdv-x32/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/tools-build/gcc-cet-sdv-x32/build-x86_64-linux/gcc/
/export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/split-5.c
-fcf-protection -fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
-fdiagnostics-color=never -pthread -fsplit-stack  -Wl,-R,../.. -g
[hjl@gnu-cet-1 gcc]$ gdb a.out 
GNU gdb (GDB) Fedora 8.1.1-3.fc28
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
BFD: warning:
/export/build/gnu/tools-build/gcc-cet-sdv-x32/build-x86_64-linux/gcc/testsuite/gcc/a.out:
unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
Reading symbols from a.out...done.
(gdb) r
Starting program:
/export/build/gnu/tools-build/gcc-cet-sdv-x32/build-x86_64-linux/gcc/testsuite/gcc/a.out
 
BFD: warning: /lib64/ld-linux-x86-64.so.2: unsupported GNU_PROPERTY_TYPE (5)
type: 0xc0010001
BFD: warning: system-supplied DSO at 0x7ffef77d: unsupported
GNU_PROPERTY_TYPE (5) type: 0xc0010001
Missing separate debuginfos, use: dnf debuginfo-install
glibc-2.27-31.1.fc28.x86_64
BFD: warning: ../../libgcc_s.so.1: unsupported GNU_PROPERTY_TYPE (5) type:
0xc0010001
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffef75af700 (LWP 1473)]

Thread 2 "a.out" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffef75af700 (LWP 1473)]
0x00401499 in swap (fu=0x405120 , fs=0x405500 , 
tu=0x405560 , ts=0x405940 )
at /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/split-5.c:40
40__splitstack_getcontext (fs);
(gdb) bt
#0  0x00401499 in swap (fu=0x405120 , fs=0x405500 , 
tu=0x405560 , ts=0x405940 )
at /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/split-5.c:40
#1  0x004015a4 in down (i=985, msg=0x403004 "go1", me=0x405120 , 
mes=0x405500 , other=0x405560 , others=0x405940 )
at /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/split-5.c:64
#2  0x00402bd0 in __morestack ()
at /export/gnu/import/git/sources/gcc/libgcc/config/i386/morestack.S:546
#3  0x004015de in down (i=986, msg=0x403004 "go1", me=0x405120 , 
mes=0x405500 , other=0x405560 , others=0x405940 )
at /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/split-5.c:65
#4  0x00402bd0 in __morestack ()
at /export/gnu/import/git/sources/gcc/libgcc/config/i386/morestack.S:546
#5  0x004015de in down (i=987, msg=0x403004 "go1", me=0x405120 , 
mes=0x405500 , other=0x405560 , others=0x405940 )
at /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/split-5.c:65
#6  0x00402bd0 in __morestack ()
at /export/gnu/import/git/sources/gcc/libgcc/config/i386/morestack.S:546
#7  0x004015de in down (i=988, msg=0x403004 "go1", me=0x405120 , 
mes=0x405500 , other=0x405560 , others=0x405940 )
at /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/split-5.c:65
#8  0x00402bd0 in __morestack ()
at /export/gnu/import/git/sources/gcc/libgcc/config/i386/morestack.S:546
---Type  to continue, or q  to quit---
#9  0x004015de in down (i=989, msg=0x403004 "go1", me=0x405120 , 
mes=0x405500 , other=0x405560 , others=0x405940 )
at /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/split-5.c:65
#10 0x00402bd0 in __morestack ()
at /export/gnu/import/git/sources/gcc/libgcc/config/i386/morestack.S:546
#11 0x004015de in down (i=990, msg=0x403004 "go1", me=0x405120 , 
mes=0x405500 , other=0x405560 , others=0x405940 )
at /export/gnu/import/git/sources/gcc/gcc/testsuite/gcc.dg/split-5.c:65
#12 0x00402bd0 in __morestack ()
at /export/gnu/import/git/sources/gcc/libgcc/config/i386/morestack.S:546
#13 

[Bug middle-end/86554] [7/8/9 Regression] Incorrect code generation with signed/unsigned comparison

2018-08-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86554

--- Comment #7 from Richard Biener  ---
So on trunk the remaining offender now is code hoisting.  We still do
value-numbering the same but correctly do _not_ use the values definition to
simplify
the comparison:

Value numbering stmt = ret_13 = PHI 
Setting value number of ret_13 to ret_12 (changed)
Making available beyond BB5 ret_13 for value ret_12
Value numbering stmt = printf ("ret is %d\n", ret_13);
Setting value number of .MEM_6 to .MEM_6 (changed)
Value numbering stmt = if (ret_13 <= 0)
Recording on edge 5->6 ret_13 le_expr 0 == true
Recording on edge 5->6 ret_13 gt_expr 0 == false
marking outgoing edge 5 -> 6 executable
marking outgoing edge 5 -> 7 executable

for code-hoisting both computations are antic-in in their respective
definition blocks and thus the value is hoisted choosing the computation
based on the expressions available in that block (the non-conversion
one since the unconverted unsigned expression isn't ANTIC_IN).

Note that a possible mitigation is to dumb down VN, not making this kind
of conversions value-number to the same value (but possibly only conversions
from signed to unsigned).  OTOH the value-numbering itself isn't the issue
but rather how we compute ANTIC.  That is, this looks like an inherent issue
of GVN-PRE.

We can, of course fix up inserts to use unsigned arithmetic but that has
impact on code quality in the majority of cases where no such false
equivalency is detected.

Need to think about this some more.

[Bug tree-optimization/87114] New: [9 regression] ICE in gcc.c-torture/execute/builtins/strnlen.c starting with r263855

2018-08-27 Thread seurer at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87114

Bug ID: 87114
   Summary: [9 regression] ICE in
gcc.c-torture/execute/builtins/strnlen.c starting with
r263855
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: seurer at gcc dot gnu.org
  Target Milestone: ---

make -k check-gcc
RUNTESTFLAGS=builtins.exp=gcc.c-torture/execute/builtins/strnlen.c


# of expected passes10
# of unexpected failures3
FAIL: gcc.c-torture/execute/builtins/strnlen.c compilation,  -O1  (internal
compiler error)
FAIL: gcc.c-torture/execute/builtins/strnlen.c compilation,  -Os  (internal
compiler error)
FAIL: gcc.c-torture/execute/builtins/strnlen.c compilation,  -Og -g  (internal
compiler error)

Looks like this is happening on multiple architectures.


spawn -ignore SIGHUP /home/seurer/gcc/build/gcc-test/gcc/xgcc
-B/home/seurer/gcc/build/gcc-test/gcc/
/home/seurer/gcc/gcc-test/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c
/home/seurer/gcc/gcc-test/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen-lib.c
/home/seurer/gcc/gcc-test/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c
-fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
-fdiagnostics-color=never -w -Og -g -fno-tree-loop-distribute-patterns
-fno-tracer -lm -o /home/seurer/gcc/build/gcc-test/gcc/testsuite/gcc/strnlen.x5
during RTL pass: expand
/home/seurer/gcc/gcc-test/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c:
In function 'test_strnlen_str_range':
/home/seurer/gcc/gcc-test/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c:51:6:
internal compiler error: in fold_binary_loc, at fold-const.c:9334
/home/seurer/gcc/gcc-test/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c:14:5:
note: in definition of macro 'A'
0x105cd74f fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
/home/seurer/gcc/gcc-test/gcc/fold-const.c:9333
0x105d443f fold_build2_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
/home/seurer/gcc/gcc-test/gcc/fold-const.c:12360
0x103a75c3 expand_builtin_strnlen
/home/seurer/gcc/gcc-test/gcc/builtins.c:3023
0x103b49b7 expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
/home/seurer/gcc/gcc-test/gcc/builtins.c:7331
0x1057e49f expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
/home/seurer/gcc/gcc-test/gcc/expr.c:10943
0x1058f05f store_expr(tree_node*, rtx_def*, int, bool, bool)
/home/seurer/gcc/gcc-test/gcc/expr.c:5636
0x10591653 expand_assignment(tree_node*, tree_node*, bool)
/home/seurer/gcc/gcc-test/gcc/expr.c:5420
0x103e4313 expand_call_stmt
/home/seurer/gcc/gcc-test/gcc/cfgexpand.c:2685
0x103e4313 expand_gimple_stmt_1
/home/seurer/gcc/gcc-test/gcc/cfgexpand.c:3575
0x103e4313 expand_gimple_stmt
/home/seurer/gcc/gcc-test/gcc/cfgexpand.c:3734
0x103eb527 expand_gimple_basic_block
/home/seurer/gcc/gcc-test/gcc/cfgexpand.c:5770
0x103ee647 execute
/home/seurer/gcc/gcc-test/gcc/cfgexpand.c:6373

[Bug tree-optimization/85758] questionable bitwise folding (missing single use check?)

2018-08-27 Thread amonakov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85758

Alexander Monakov  changed:

   What|Removed |Added

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

--- Comment #4 from Alexander Monakov  ---
Fixed.

[Bug tree-optimization/86927] [8 Regression] Gcc miscompiles at -O3 on valid code

2018-08-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86927

Richard Biener  changed:

   What|Removed |Added

  Known to work||9.0
Summary|[8/9 Regression] Gcc|[8 Regression] Gcc
   |miscompiles at -O3 on valid |miscompiles at -O3 on valid
   |code|code
  Known to fail|9.0 |

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

[Bug tree-optimization/86927] [8/9 Regression] Gcc miscompiles at -O3 on valid code

2018-08-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86927

--- Comment #6 from Richard Biener  ---
Author: rguenth
Date: Mon Aug 27 14:17:03 2018
New Revision: 263888

URL: https://gcc.gnu.org/viewcvs?rev=263888=gcc=rev
Log:
2018-08-27  Richard Biener  

PR tree-optimization/86927
* tree-vect-loop.c (vect_create_epilog_for_reduction): Properly
use const cond reduction code.

* gcc.dg/vect/pr86927.c: New testcase.

Added:
trunk/gcc/testsuite/gcc.dg/vect/pr86927.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-vect-loop.c

[Bug target/81685] [7/8 Regression] FAIL: g++.dg/debug/dwarf2/inline-ns-2.C -std=gnu++* (internal compiler error) on darwin

2018-08-27 Thread iains at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81685

Iain Sandoe  changed:

   What|Removed |Added

Summary|[7/8/9 Regression] FAIL:|[7/8 Regression] FAIL:
   |g++.dg/debug/dwarf2/inline- |g++.dg/debug/dwarf2/inline-
   |ns-2.C  -std=gnu++* |ns-2.C  -std=gnu++*
   |(internal compiler error)   |(internal compiler error)
   |on darwin   |on darwin

--- Comment #8 from Iain Sandoe  ---
(In reply to Jakub Jelinek from comment #7)
> So fixed for 9+ so far?

fixed on trunk.

[Bug tree-optimization/86991] [8/9 Regression] ICE in vectorizable_reduction, at tree-vect-loop.c:6919

2018-08-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86991

--- Comment #3 from Richard Biener  ---
Hmm.  To me it looks like the assert that triggers:

  if (orig_stmt_info)
gcc_assert (tmp == orig_stmt_info
|| REDUC_GROUP_FIRST_ELEMENT (tmp) == orig_stmt_info);
  else
/* We changed STMT to be the first stmt in reduction chain, hence we
   check that in this case the first element in the chain is STMT.  */
gcc_assert (tmp == stmt_info
|| REDUC_GROUP_FIRST_ELEMENT (tmp) == stmt_info);


doesn't work this way for SLP reductions with a reduction path since
tmp (STMT_VINFO_REDUC_DEF) is obviously different from stmt_info
(the first non-PHI).  But what the vectorizer tries to do makes sense.

Maybe test coverage was too low to uncover this up until now.  It looks like
the testcase relies on some unfortunate invariant code in the IL.

Did you have a testcase that computed sth more meaningful?

[Bug other/84889] Ideas on revamping how we format diagnostics

2018-08-27 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84889

--- Comment #13 from David Malcolm  ---
See also the various changes I've made in response to PR 87091.

[Bug tree-optimization/85758] questionable bitwise folding (missing single use check?)

2018-08-27 Thread amonakov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85758

--- Comment #3 from Alexander Monakov  ---
Author: amonakov
Date: Mon Aug 27 14:08:50 2018
New Revision: 263887

URL: https://gcc.gnu.org/viewcvs?rev=263887=gcc=rev
Log:
match.pd: add single-use check for (x & y) ^ y -> ~x & y (PR 85758)

PR tree-optimization/85758
* match.pd ((X & Y) ^ Y): Add :s qualifier to inner expression.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/match.pd

[Bug c++/87091] Malformed fix-it hint for missing header

2018-08-27 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87091

--- Comment #6 from David Malcolm  ---
I've been using this PR to track various tweaks to how we print that fix-it
hint.  As well as the bug fix referred to in comment #1, we've gone from:


In file included from
../x86_64-pc-linux-gnu/libstdc++-v3/include/debug/vector:34,
 from /tmp/t.cc:2:
../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:27: error: ‘vector’ in
namespace ‘std’ does not name a template type
87 |   using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
   |   ^~
../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:22: note: ‘std::vector’
is defined in header ‘’; did you forget to ‘#include ’?
../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:74:1:
++ |+#include 
74 | #endif
../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:22:
87 |   using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
   |  ^~~


to:


In file included from
../x86_64-pc-linux-gnu/libstdc++-v3/include/debug/vector:34,
 from /tmp/t.cc:2:
../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:27: error: ‘vector’ in
namespace ‘std’ does not name a template type
87 |   using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
   |   ^~
../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:74:1: note: ‘std::vector’ is
defined in header ‘’; did you forget to ‘#include ’?
73 | # include 
++ |+#include 
74 | #endif


I think that's all for now.

[Bug c++/87091] Malformed fix-it hint for missing header

2018-08-27 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87091

--- Comment #5 from David Malcolm  ---
Author: dmalcolm
Date: Mon Aug 27 14:02:05 2018
New Revision: 263885

URL: https://gcc.gnu.org/viewcvs?rev=263885=gcc=rev
Log:
Less verbose fix-it hints for missing header files (PR 87091)

This patch tweaks maybe_add_include_fixit so that if we're emitting a note
about adding the header file, the note's primary location will be replaced
by that of the fix-it hint, to avoid repeating a location we've already
emitted (or one close to it).

For example, this simplifies:

  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:27: error: msg 1
  87 |   using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
 |   ^~
  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:22: note: msg 2
   73 | # include 
  +++ |+#include 
   74 | #endif
  
   87 |   using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
  |  ^~~

to:

  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:27: error: msg 1
  87 |   using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
 |   ^~
  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:74:1: note: msg 2
   73 | # include 
  +++ |+#include 
   74 | #endif

eliminating the repetition of line 87 in the note.

Doing so requires converting show_caret_p to a tri-state, to avoid
meaninglessly printing a caret for the first column in the next line
(and colorizing it):

  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:74:1: note: msg 2
   73 | # include 
  +++ |+#include 
   74 | #endif
  | ^

gcc/c-family/ChangeLog:
PR 87091
* c-common.c (c_cpp_error): Update for conversion of show_caret_p
to a tri-state.
(maybe_suggest_missing_token_insertion): Likewise.
(maybe_add_include_fixit): Add param "override_location".  If set,
and source-printing is enabled, then override the rich_location's
primary location with that of the insertion point for the fix-it
hint, marking it with SHOW_LINES_WITHOUT_RANGE.
* c-common.h (extern void maybe_add_include_fixit): Add bool
param.
* c-format.c (selftest::test_type_mismatch_range_labels): Update
for conversion of show_caret_p to a tri-state.
* c-warn.c (warn_for_restrict): Likewise.
* known-headers.cc
(suggest_missing_header::~suggest_missing_header): Update call to
maybe_add_include_fixit to suggest overriding the location, as it
is for a note.

gcc/c/ChangeLog:
PR 87091
* c-decl.c (implicitly_declare): Update call to
maybe_add_include_fixit to suggest overriding the location, as it
is for a note.
* c-objc-common.c (c_tree_printer): Update for conversion of
show_caret_p to a tri-state.

gcc/cp/ChangeLog:
PR 87091
* decl.c (grokdeclarator): Update for conversion of show_caret_p
to a tri-state.
* error.c (cp_printer): Likewise.
* name-lookup.c (maybe_suggest_missing_std_header): Update call to
maybe_add_include_fixit to suggest overriding the location, as it
is for a note.
* parser.c (cp_parser_string_literal): Update for conversion of
show_caret_p to a tri-state.
(cp_parser_elaborated_type_specifier): Likewise.
(set_and_check_decl_spec_loc): Likewise.
* pt.c (listify): Update call to maybe_add_include_fixit to not
override the location, as it is for an error.
* rtti.c (typeid_ok_p): Likewise.

gcc/ChangeLog:
PR 87091
* diagnostic-show-locus.c (class layout_range): Update for
conversion of show_caret_p to a tri-state.
(layout_range::layout_range): Likewise.
(make_range): Likewise.
(layout::maybe_add_location_range): Likewise.
(layout::should_print_annotation_line_p): Don't show annotation
lines for ranges that are SHOW_LINES_WITHOUT_RANGE.
(layout::get_state_at_point): Update for conversion of
show_caret_p to a tri-state.  Bail out early for
SHOW_LINES_WITHOUT_RANGE, so that such ranges don't affect
underlining or source colorization.
(gcc_rich_location::add_location_if_nearby): Update for conversion
of show_caret_p to a tri-state.
(selftest::test_one_liner_multiple_carets_and_ranges): Likewise.
(selftest::test_one_liner_fixit_replace_equal_secondary_range):
Likewise.
(selftest::test_one_liner_labels): Likewise.
* gcc-rich-location.c (gcc_rich_location::add_expr): Update for
conversion of show_caret_p to a tri-state.
* pretty-print.c (text_info::set_location): Likewise.
* pretty-print.h (text_info::set_location): Likewise.
* substring-locations.c (format_warning_n_va): Likewise.
* tree-diagnostic.c (default_tree_printer): Likewise.
* tree-pretty-print.c 

[Bug sanitizer/86962] [8 Regression] ICE in sanitize_rewrite_addressable_params, at sanopt.c:1173 with nested functions

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86962

Martin Liška  changed:

   What|Removed |Added

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

--- Comment #5 from Martin Liška  ---
(In reply to Eric Botcazou from comment #4)
> My change is not on the 8 branch though.

Ah, sorry, then we're done.

[Bug rtl-optimization/87096] "Optimised" snprintf is not POSIX conformant

2018-08-27 Thread bugdal at aerifal dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87096

--- Comment #4 from Rich Felker  ---
I'm aware, but that makes it an invalid transformation. To be valid, the
transformation must only be performed in cases where it's provably not
exceptional.

The same principle applies to all the pathological results where
p=malloc(SIZE_MAX);if(!p)...;free(p) is getting optimized out (breaking code
that relies on "if malloc succeeds, pointer arithmetic in the allocated object
is valid"). This kind of error is a high-level optimization strategy mistake in
gcc that needs to be addressed and fixed.

[Bug c++/87091] Malformed fix-it hint for missing header

2018-08-27 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87091

--- Comment #4 from David Malcolm  ---
Author: dmalcolm
Date: Mon Aug 27 13:46:32 2018
New Revision: 263884

URL: https://gcc.gnu.org/viewcvs?rev=263884=gcc=rev
Log:
diagnostics: show an extra line of context in line-insertion fix-it hints (PR
87091)

This patch tweaks how we print line-insertion fix-it hints, so that
the line before the insertion point is also printed, to give the user
more context on the proposed change.

For example, it changes:

  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:22: note: message
  +++ |+#include 
   74 | #endif
  
   87 |   using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
  |  ^~~

to:

  ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:22: note: message
   73 | # include 
  +++ |+#include 
   74 | #endif
  
   87 |   using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
  |  ^~~

gcc/ChangeLog:
PR 87091
* diagnostic-show-locus.c (get_line_span_for_fixit_hint): Show the
line above for line-insertion fix-it hints.
(selftest::test_fixit_insert_containing_newline): Update the
expected results, and add a test with line-numbering enabled.

gcc/testsuite/ChangeLog:
PR 87091
* g++.dg/pr85523.C: Extend expected output to show line
before line-insertion fix-it hint.
* gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c
(test_fixit_insert_newline): Add previous line to expected output.
* gcc.dg/plugin/diagnostic-test-show-locus-bw.c: Likewise.
* gcc.dg/plugin/diagnostic-test-show-locus-color.c: Likewise.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/diagnostic-show-locus.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/pr85523.C
   
trunk/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c
trunk/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-bw.c
trunk/gcc/testsuite/gcc.dg/plugin/diagnostic-test-show-locus-color.c

[Bug sanitizer/86962] [8 Regression] ICE in sanitize_rewrite_addressable_params, at sanopt.c:1173 with nested functions

2018-08-27 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86962

--- Comment #4 from Eric Botcazou  ---
My change is not on the 8 branch though.

[Bug bootstrap/81033] [8/9 Regression] there are cases where ld64 is not able to determine correct atom boundaries from the output GCC currently produces

2018-08-27 Thread iains at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81033

--- Comment #47 from Iain Sandoe  ---
(In reply to Jakub Jelinek from comment #46)
> Is this fixed for 9+ so far?

Yes, fixed on trunk .. leaving it open pending backports.

[Bug lto/85583] [9 Regression] lto1: internal compiler error: in lto_balanced_map, at lto/lto-partition.c:833

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85583

Martin Liška  changed:

   What|Removed |Added

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

--- Comment #9 from Martin Liška  ---
Yes, I would notice that as I'm building quite some packages with LTO not on
daily basis.

[Bug middle-end/85817] [9 Regression] ICE in expand_call at gcc/calls.c:4291

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85817

Martin Liška  changed:

   What|Removed |Added

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

--- Comment #6 from Martin Liška  ---
Fixed.

[Bug bootstrap/81033] [8/9 Regression] there are cases where ld64 is not able to determine correct atom boundaries from the output GCC currently produces

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81033

--- Comment #46 from Jakub Jelinek  ---
Is this fixed for 9+ so far?

[Bug target/81685] [7/8/9 Regression] FAIL: g++.dg/debug/dwarf2/inline-ns-2.C -std=gnu++* (internal compiler error) on darwin

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81685

--- Comment #7 from Jakub Jelinek  ---
So fixed for 9+ so far?

[Bug target/85512] [8/9 Regression] gcc generating non-existing sshr with immh == 0

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85512

Jakub Jelinek  changed:

   What|Removed |Added

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

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

[Bug c++/87113] ICE in adjust_temp_type at cp/constexpr.c:1205

2018-08-27 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87113

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-08-27
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

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

[Bug lto/85583] [9 Regression] lto1: internal compiler error: in lto_balanced_map, at lto/lto-partition.c:833

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85583

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #8 from Jakub Jelinek  ---
So fixed?

[Bug tree-optimization/85699] [9 regression] gcc.dg/nextafter-2.c fail

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85699

Jakub Jelinek  changed:

   What|Removed |Added

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

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

[Bug rtl-optimization/85805] [7/8/9 Regression] Wrong code for 64 bit comparisons on avr-gcc

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85805

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #9 from Jakub Jelinek  ---
Fixed for 9+ then?

[Bug middle-end/85817] [9 Regression] ICE in expand_call at gcc/calls.c:4291

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85817

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek  ---
So fixed?

[Bug tree-optimization/86010] [7/8/9 Regression] redundant memset with smaller size not eliminated

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86010

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #7 from Jakub Jelinek  ---
So fixed for 9+?

[Bug sanitizer/86962] [8 Regression] ICE in sanitize_rewrite_addressable_params, at sanopt.c:1173 with nested functions

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86962

Martin Liška  changed:

   What|Removed |Added

  Known to work|8.2.0   |9.0
Summary|[9 Regression] ICE in   |[8 Regression] ICE in
   |sanitize_rewrite_addressabl |sanitize_rewrite_addressabl
   |e_params, at sanopt.c:1173  |e_params, at sanopt.c:1173
   |with nested functions   |with nested functions
  Known to fail|9.0 |8.2.0

--- Comment #3 from Martin Liška  ---
Fixed on trunk, I'm planning to backport that to GCC 8 branch.

[Bug middle-end/86121] [9 Regression] missing -Wstringop-overflow on strcpy followed by strcat

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86121

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek  ---
So fixed?

[Bug sanitizer/86962] [9 Regression] ICE in sanitize_rewrite_addressable_params, at sanopt.c:1173 with nested functions

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86962

--- Comment #2 from Martin Liška  ---
Author: marxin
Date: Mon Aug 27 13:21:28 2018
New Revision: 263882

URL: https://gcc.gnu.org/viewcvs?rev=263882=gcc=rev
Log:
Sanopt: ignore params with DECL_HAS_VALUE_EXPR_P (PR sanitizer/86962).

2018-08-27  Martin Liska  

PR sanitizer/86962
* sanopt.c (sanitize_rewrite_addressable_params): Ignore
params with DECL_HAS_VALUE_EXPR_P.
2018-08-27  Martin Liska  

PR sanitizer/86962
* gcc.dg/asan/pr86962.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/asan/pr86962.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/sanopt.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/86706] [8 Regression] ICE in build_base_path, at cp/class.c:294

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86706

Jakub Jelinek  changed:

   What|Removed |Added

Summary|[8/9 Regression] ICE in |[8 Regression] ICE in
   |build_base_path, at |build_base_path, at
   |cp/class.c:294  |cp/class.c:294

--- Comment #6 from Jakub Jelinek  ---
Fixed on the trunk so far.

[Bug rtl-optimization/87065] [7 Regression] combine causes ICE in trunc_int_for_mode

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87065

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||jakub at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
Summary|[7/8/9 Regression] combine  |[7 Regression] combine
   |causes ICE in   |causes ICE in
   |trunc_int_for_mode  |trunc_int_for_mode

--- Comment #11 from Jakub Jelinek  ---
Fixed for 8.3+ so far.

[Bug tree-optimization/85859] [6/7/8/9 Regression] wrong code with -fno-isolate-erroneous-paths-dereference

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85859

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek  ---
So fixed on the trunk?  Any plans to backport?

[Bug libstdc++/87071] libstdc++ crashes during GPU driver initialization with suspected attempt to execute unsupported instruction by Athlon64 X2 TK-57

2018-08-27 Thread virtuousfox at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87071

--- Comment #9 from Sergey Kondakov  ---
(In reply to Alexander Monakov from comment #8)
> You should have mentioned you were using a custom-compiled Mesa, not the
> distribution package (both here and in the original report to Mesa project).
> 
> For some reason the disasm in the provided log is unusable (shows assembly
> of the outermost frame), but downloading your package shows that failing
> instruction is
> 
>928ea:   c5 fa 6f 05 0e 09 c3 00 vmovdqu 0xc3090e(%rip),%xmm0
> # cc3200 
> 
> i.e. an AVX instruction, not supported on the CPU. Given that you were using
> Clang to compile the package, this is not a GCC issue.

You actually managed to get some info from separate package ? Amazing.

I should have but half of my system is customized in some way, by me or by
others via OBS's community repositories, at this point + it's rolling release
distro. And my attention was completely drawn from Mesa. But here's the
interesting part: a guy from openSUSE just figured out that offending code was
launched by in-Mesa "SWR", Intel's AVX-based software renderer, which, for some
reason, tried to do something even though it should not load unless explicitly
requested or if direct rendering has failed. And it doesn't, if Mesa is built
with gcc & linked with ld, even with it enabled !

One thing doesn't build with gcc, other fails with clang… there is no peace
with Mesa. Anyway, thanks for your advices, I was getting desperate with that
weird issue.

[Bug target/87085] with -march=i386, gcc should not generate code including endbr instruction

2018-08-27 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87085

H.J. Lu  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |INVALID

--- Comment #7 from H.J. Lu  ---
(In reply to chengming from comment #4)
> Created attachment 44602 [details]
> ELF file
> 
> compiled with command
> gcc -v -save-temps -m32 -march=i386 -fcf-protection=none -o onlyReturn
> onlyReturn.c > output.txt 2>&1

Fedora 28 run-time only supports i686 or above.  You can't use any libraries
on Fedora 28.

[Bug middle-end/87099] [8/9 Regression] internal compiler error: segmentation fault

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87099

Jakub Jelinek  changed:

   What|Removed |Added

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

--- Comment #3 from Jakub Jelinek  ---
Created attachment 44610
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44610=edit
gcc9-pr87099.patch

Untested fix.

[Bug tree-optimization/87112] [9 Regression] ICE in fold_binary_loc, at fold-const.c:9334

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87112

Martin Liška  changed:

   What|Removed |Added

   Priority|P3  |P1

[Bug c++/87113] ICE in adjust_temp_type at cp/constexpr.c:1205

2018-08-27 Thread svenja.mehringer at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87113

--- Comment #1 from smehringer  ---
Created attachment 44609
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44609=edit
workaround of error

Inserting a member variable into the struct prevents ICE.

[Bug c++/87113] New: ICE in adjust_temp_type at cp/constexpr.c:1205

2018-08-27 Thread svenja.mehringer at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87113

Bug ID: 87113
   Summary: ICE in adjust_temp_type at cp/constexpr.c:1205
   Product: gcc
   Version: 7.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: svenja.mehringer at gmail dot com
  Target Milestone: ---

Created attachment 44608
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44608=edit
intermediate file that produces error

See attached intermediate file (build with -std=c++17 -fconcepts).
This produces the following error:
test.cpp: In Funktion »int main()«:
test.cpp:8:87:   in constexpr-Ersetzung von
»seqan3::qualified,
seqan3::phred42>((seqan3::gap::GAP, seqan3::gap()))«
test.cpp:8:87: interner Compiler-Fehler: in adjust_temp_type, bei
cp/constexpr.c:1205
0x6d0c5c adjust_temp_type
../.././gcc/cp/constexpr.c:1205
0x6d344d cxx_bind_parameters_in_call
../.././gcc/cp/constexpr.c:1279
0x6d344d cxx_eval_call_expression
../.././gcc/cp/constexpr.c:1535
0x6d48c6 cxx_eval_constant_expression
../.././gcc/cp/constexpr.c:4010
0x6d44f3 cxx_eval_constant_expression
../.././gcc/cp/constexpr.c:4127
0x6d44f3 cxx_eval_constant_expression
../.././gcc/cp/constexpr.c:4127
0x6d499b cxx_eval_constant_expression
../.././gcc/cp/constexpr.c:4477
0x6d4eb8 cxx_eval_statement_list
../.././gcc/cp/constexpr.c:3743
0x6d4eb8 cxx_eval_constant_expression
../.././gcc/cp/constexpr.c:4471
0x6d3da6 cxx_eval_call_expression
../.././gcc/cp/constexpr.c:1642
0x6d48c6 cxx_eval_constant_expression
../.././gcc/cp/constexpr.c:4010
0x6d8614 cxx_eval_outermost_constant_expr
../.././gcc/cp/constexpr.c:4640
0x6da2fe maybe_constant_value(tree_node*, tree_node*)
../.././gcc/cp/constexpr.c:4855
0x6c64ea cp_fully_fold(tree_node*)
../.././gcc/cp/cp-gimplify.c:1976
0x5f9c4a store_init_value(tree_node*, tree_node*, vec**, int)
../.././gcc/cp/typeck2.c:841
0x5b7f6d check_initializer
../.././gcc/cp/decl.c:6365
0x5bb7ca cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
../.././gcc/cp/decl.c:7037
0x64a607 cp_parser_init_declarator
../.././gcc/cp/parser.c:19380
0x64ae4d cp_parser_simple_declaration
../.././gcc/cp/parser.c:12777
0x64ba55 cp_parser_block_declaration
../.././gcc/cp/parser.c:12602
Bitte senden Sie einen vollständigen Fehlerbericht auf Englisch ein;
inclusive vorverarbeitetem Quellcode, wenn es dienlich ist.
Please include the complete backtrace with any bug report.
Weitere Hinweise finden Sie unter »«.


Tested on 
 % uname -a 
Linux epsilon 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u3 (2018-08-19) x86_64
GNU/Linux
 % g++-7.1.0 --version
g++ (GCC) 7.1.0
Copyright (C) 2017 Free Software Foundation, Inc.
Dies ist freie Software; die Kopierbedingungen stehen in den Quellen. Es
gibt KEINE Garantie; auch nicht für MARKTGÄNGIGKEIT oder FÜR SPEZIELLE ZWECKE.

Verified on snapshots of g++8 and g++9

[Bug middle-end/26163] [meta-bug] missed optimization in SPEC (2k17, 2k and 2k6 and 95)

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26163
Bug 26163 depends on bug 86702, which changed state.

Bug 86702 Summary: [9 Regression] SPEC CPU2006 400.perlbench, CPU2017 
500.perlbench_r ~3% performance drop after r262247
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86702

   What|Removed |Added

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

[Bug tree-optimization/86702] [9 Regression] SPEC CPU2006 400.perlbench, CPU2017 500.perlbench_r ~3% performance drop after r262247

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86702

Martin Liška  changed:

   What|Removed |Added

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

--- Comment #6 from Martin Liška  ---
Should be fixed now, please reopen it it still exists.

[Bug tree-optimization/86847] [9 Regression] Switch code size growth

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86847

Martin Liška  changed:

   What|Removed |Added

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

--- Comment #3 from Martin Liška  ---
Fixed.

[Bug libstdc++/78113] std::variant and std::visit's current implementations do not get optimized out (compared to "recursive visitation")

2018-08-27 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78113

--- Comment #2 from Antony Polukhin  ---
Here's another example:

#include 

struct A {};
struct B : A {};
struct C : A {};
struct D : A {};
struct E : A {};
struct X : A {};

struct visitor {
template 
A& operator()(T& v) const noexcept { return v; }
};

A& get_base(std::variant& in) {
return std::visit(visitor{}, in);
}


GCC's current implementation via table of function pointers is badly optimized
by GCC-9 (trunk) and generates a lot of equal functions:
https://godbolt.org/z/g9hJjV

Boost's approach produces a better result on the same compiler:
https://godbolt.org/z/BnemR1

[Bug tree-optimization/86847] [9 Regression] Switch code size growth

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86847

--- Comment #2 from Martin Liška  ---
Author: marxin
Date: Mon Aug 27 12:21:11 2018
New Revision: 263879

URL: https://gcc.gnu.org/viewcvs?rev=263879=gcc=rev
Log:
Improve switch code emission for a balanced tree (PR tree-optimization/86847).

2018-08-27  Martin Liska  

PR tree-optimization/86847
* tree-switch-conversion.c (switch_decision_tree::dump_case_nodes):
Dump also subtree probability.
(switch_decision_tree::do_jump_if_equal): New function.
(switch_decision_tree::emit_case_nodes): Handle special
situations in balanced tree that can be emitted much simpler.
Fix calculation of probabilities that happen in tree expansion.
* tree-switch-conversion.h (struct cluster): Add
is_single_value_p.
(struct simple_cluster): Likewise.
(struct case_tree_node): Add new function has_child.
(do_jump_if_equal): New.
2018-08-27  Martin Liska  

PR tree-optimization/86847
* gcc.dg/tree-ssa/switch-3.c: New test.
* gcc.dg/tree-ssa/vrp105.c: Remove.

Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/switch-3.c
Removed:
trunk/gcc/testsuite/gcc.dg/tree-ssa/vrp105.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-switch-conversion.c
trunk/gcc/tree-switch-conversion.h

[Bug libstdc++/78113] std::variant and std::visit's current implementations do not get optimized out (compared to "recursive visitation")

2018-08-27 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78113

--- Comment #1 from Antony Polukhin  ---
Note that this bug is related to Bug 86912. Fixing Bug 86912 should
automatically resolve this issue (but not vice versa).

[Bug tree-optimization/86702] [9 Regression] SPEC CPU2006 400.perlbench, CPU2017 500.perlbench_r ~3% performance drop after r262247

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86702

--- Comment #5 from Martin Liška  ---
Author: marxin
Date: Mon Aug 27 12:17:54 2018
New Revision: 263877

URL: https://gcc.gnu.org/viewcvs?rev=263877=gcc=rev
Log:
Fix probabilities for jump table (PR tree-optimization/86702).

2018-08-27  Martin Liska  

PR tree-optimization/86702
* tree-switch-conversion.c (jump_table_cluster::emit):
Make probabilities even for values in jump table
according to number of cases handled.
(switch_decision_tree::compute_cases_per_edge): Pass
argument to reset_out_edges_aux function.
(switch_decision_tree::analyze_switch_statement): Likewise.
* tree-switch-conversion.h (switch_decision_tree::reset_out_edges_aux):
Make it static.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/tree-switch-conversion.c
trunk/gcc/tree-switch-conversion.h

[Bug tree-optimization/86927] [8/9 Regression] Gcc miscompiles at -O3 on valid code

2018-08-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86927

--- Comment #5 from Richard Biener  ---
Created attachment 44607
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44607=edit
patch

I am testing the attached.

[Bug tree-optimization/87112] New: [9 Regression] ICE in fold_binary_loc, at fold-const.c:9334

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87112

Bug ID: 87112
   Summary: [9 Regression] ICE in fold_binary_loc, at
fold-const.c:9334
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: marxin at gcc dot gnu.org
CC: law at gcc dot gnu.org
  Target Milestone: ---

Starting from r263855 we ICE on:

$  ./xgcc -B.
/home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c
-O1 -c
/home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c:
In function ‘test_strnlen_str_cst’:
/home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c:25:6:
warning: ‘strnlen’ specified bound 18446744073709551615 exceeds maximum object
size 9223372036854775807 [-Wstringop-overflow=]
25 |   A (strnlen ("", SIZE_MAX) == 0);
   |  ^~
/home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c:14:5:
note: in definition of macro ‘A’
14 |   ((expr) ? (void)0  \
   | ^~~~
/home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c:32:6:
warning: ‘strnlen’ specified bound 18446744073709551615 exceeds maximum object
size 9223372036854775807 [-Wstringop-overflow=]
32 |   A (strnlen ("1", SIZE_MAX) == 1);
   |  ^~~
/home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c:14:5:
note: in definition of macro ‘A’
14 |   ((expr) ? (void)0  \
   | ^~~~
/home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c:33:6:
warning: ‘strnlen’ specified bound 18446744073709551614 exceeds maximum object
size 9223372036854775807 [-Wstringop-overflow=]
33 |   A (strnlen ("1", -2) == 1);
   |  ^
/home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c:14:5:
note: in definition of macro ‘A’
14 |   ((expr) ? (void)0  \
   | ^~~~
/home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c:41:6:
warning: ‘strnlen’ specified bound 18446744073709551615 exceeds maximum object
size 9223372036854775807 [-Wstringop-overflow=]
41 |   A (strnlen ("123", SIZE_MAX) == 3);
   |  ^
/home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c:14:5:
note: in definition of macro ‘A’
14 |   ((expr) ? (void)0  \
   | ^~~~
/home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c:42:6:
warning: ‘strnlen’ specified bound 18446744073709551614 exceeds maximum object
size 9223372036854775807 [-Wstringop-overflow=]
42 |   A (strnlen ("123", -2) == 3);
   |  ^~~
/home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c:14:5:
note: in definition of macro ‘A’
14 |   ((expr) ? (void)0  \
   | ^~~~
during RTL pass: expand
/home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c:
In function ‘test_strnlen_str_range’:
/home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c:51:6:
internal compiler error: in fold_binary_loc, at fold-const.c:9334
51 |   A (strnlen ("", r_0_3) == 0);
   |  ^~~
/home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/strnlen.c:14:5:
note: in definition of macro ‘A’
14 |   ((expr) ? (void)0  \
   | ^~~~
0xbf973c fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
../../gcc/fold-const.c:9333
0xc088f8 fold_build2_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
../../gcc/fold-const.c:12360
0x9cbdb7 expand_builtin_strnlen
../../gcc/builtins.c:3023
0x9d9db1 expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
../../gcc/builtins.c:7331
0xbb9961 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../gcc/expr.c:10943
0xbac1ce expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,
rtx_def**, bool)
../../gcc/expr.c:8209
0xba15c8 store_expr(tree_node*, rtx_def*, int, bool, bool)
../../gcc/expr.c:5636
0xb9fbf8 expand_assignment(tree_node*, tree_node*, bool)
../../gcc/expr.c:5420
0xa1750d expand_call_stmt
../../gcc/cfgexpand.c:2685
0xa1a68f expand_gimple_stmt_1
../../gcc/cfgexpand.c:3575
0xa1ad1d expand_gimple_stmt
../../gcc/cfgexpand.c:3734
0xa2356a expand_gimple_basic_block
../../gcc/cfgexpand.c:5770
0xa24f3c execute
../../gcc/cfgexpand.c:6373

[Bug tree-optimization/87112] [9 Regression] ICE in fold_binary_loc, at fold-const.c:9334

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87112

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-08-27
   Target Milestone|--- |9.0
 Ever confirmed|0   |1

[Bug middle-end/87099] [8/9 Regression] internal compiler error: segmentation fault

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87099

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
Started with r260541.
Simpler testcase:
void bar (char *);

int
foo (int n)
{
  char v[n];
  bar (v);
  return __builtin_strncmp ([1], "aaa", 3);
}

[Bug sanitizer/87095] [8/9 Regression] UndefinedBehaviorSanitizer vptr false positive with virtual inheritance only with -fno-sanitize-recover

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87095

--- Comment #3 from Jakub Jelinek  ---
With my very limited understanding of the inheritance and ABI, I think the
testcase is valid.

The problem is I believe in that if there are nearly empty virtual bases that
the ABI requires to reuse the virtual pointers in that case:
  /* A "nearly-empty" virtual base class can be the primary base
 class, if no non-virtual polymorphic base can be found.  Look for
 a nearly-empty virtual dynamic base that is not already a primary
 base of something in the hierarchy.  If there is no such base,
 just pick the first nearly-empty virtual base.  */
the build_clobber_this () handles this by:
  /* If we have virtual bases, clobber the whole object, but only if we're in
 charge.  If we don't have virtual bases, clobber the as-base type so we
 don't mess with tail padding.  */
  bool vbases = CLASSTYPE_VBASECLASSES (current_class_type);
...
  if (vbases)
exprstmt = build_if_in_charge (exprstmt);

So, to match this it would be just adding
if (CLASSTYPE_VBASECLASSES (current_class_type)) stmt = build_if_in_charge
(stmt);
before finish_decl_cleanup.
Though, if all the virtual bases are non-empty, the sharing of vptr doesn't
occur
in that case and we'd not clear it (e.g. if in the testcase there is int a;
non-static data member in A,
we wouldn't clear B's vptr in not-in-charge B::~B even when A has a different
vptr).

So I wonder if the following is right:

--- gcc/cp/decl.c.jj2018-08-26 22:41:48.574350447 +0200
+++ gcc/cp/decl.c   2018-08-27 12:59:33.068314097 +0200
@@ -15696,6 +15696,14 @@ begin_destructor_body (void)
tree stmt = cp_build_modify_expr (input_location, vtbl_ptr,
  NOP_EXPR, vtbl,
  tf_warning_or_error);
+   /* If the vptr is shared with some virtual nearly empty base,
+  don't clear it if not in charge, the dtor of the virtual
+  nearly empty base will do that later.  */
+   if (CLASSTYPE_VBASECLASSES (current_class_type)
+   && CLASSTYPE_PRIMARY_BINFO (current_class_type)
+   && BINFO_VIRTUAL_P
+ (CLASSTYPE_PRIMARY_BINFO (current_class_type)))
+ stmt = build_if_in_charge (stmt);
finish_decl_cleanup (NULL_TREE, stmt);
  }
else

[Bug tree-optimization/57492] Optimize 2.0**i to ldexp(1.0,i)

2018-08-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57492

Richard Biener  changed:

   What|Removed |Added

   Keywords||easyhack

--- Comment #4 from Richard Biener  ---
Should be relatively easy to fix with new match.pd rules.

[Bug target/87104] missed &, == optimization makes Emacs ~0.4% slower on x86-64

2018-08-27 Thread pipcet at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87104

--- Comment #10 from pipcet at gmail dot com ---
Created attachment 44606
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44606=edit
canonicalize to (A) == C

This canonicalizes to the worse code on x86_64.

[Bug target/87104] missed &, == optimization makes Emacs ~0.4% slower on x86-64

2018-08-27 Thread pipcet at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87104

--- Comment #9 from pipcet at gmail dot com ---
(In reply to Richard Biener from comment #6)
> So on GIMPLE the following are not canonicalized:
> 
>[local count: 1073741825]:
>   _1 = i_4(D) & 7;
>   _8 = (int) i_4(D);
>   if (_1 == 6)
> goto ; [20.97%]
>   else
> goto ; [79.03%]
> 
> vs.
> 
>[local count: 1073741825]:
>   _1 = i_5(D) + 18446744073709551610;
>   _2 = _1 & 7;
>   _9 = (int) i_5(D);
>   if (_2 == 0)
> goto ; [34.00%]
>   else
> goto ; [66.00%]
> 
> where I'd call the former better.  Thus for some unknown constraint
> on @1, @2 and @3
> 
> (simplify
>  (eq (convert? (bit_and (plus @0 INTEGER_CST@3) @2)) @1)
>  (eq (convert (bit_and @0 @2)) { ... }))


I suggest that the constraint be that @2 is of the form
000...000111...111000...000 and @3 is of the form
???...??...???000...000 and @1 is zero.

So your plan is to canonicalize to (X & MASK) == VALUE first, then do something
target-dependent to emit (X - VALUE) & MASK == 0 instead? How would the target
realize that? I tried adding a peephole2 rule but that's apparently too late
and doesn't match the insn sequences in Paul's test.

[Bug tree-optimization/57492] Optimize 2.0**i to ldexp(1.0,i)

2018-08-27 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57492

--- Comment #3 from Antony Polukhin  ---
More examples:

double test_uns(unsigned u) {
return __builtin_pow(2, u);
}

double test_int(int i) {
return __builtin_pow(2, i);
}


Above two functions clang optimizes to exp2 and ldexp calls:

test_uns(unsigned int):   # @test_uns(unsigned int)
mov eax, edi
cvtsi2sdxmm0, rax
jmp exp2# TAILCALL
.LCPI1_0:
.quad   4607182418800017408 # double 1
test_int(int):   # @test_int(int)
movsd   xmm0, qword ptr [rip + .LCPI1_0] # xmm0 = mem[0],zero
jmp ldexp   # TAILCALL


GCC still uses pow for both cases:

test_uns(unsigned int):
  mov edi, edi
  pxor xmm1, xmm1
  movsd xmm0, QWORD PTR .LC0[rip]
  cvtsi2sdq xmm1, rdi
  jmp pow
test_int(int):
  pxor xmm1, xmm1
  movsd xmm0, QWORD PTR .LC0[rip]
  cvtsi2sd xmm1, edi
  jmp pow
.LC0:
  .long 0
  .long 1073741824 


Tested on GCC trunk 9.0.

[Bug rtl-optimization/87065] [7/8/9 Regression] combine causes ICE in trunc_int_for_mode

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87065

--- Comment #10 from Jakub Jelinek  ---
Author: jakub
Date: Mon Aug 27 09:14:38 2018
New Revision: 263873

URL: https://gcc.gnu.org/viewcvs?rev=263873=gcc=rev
Log:
PR rtl-optimization/87065
* combine.c (simplify_if_then_else): Formatting fix.
(if_then_else_cond): Guard MULT optimization with SCALAR_INT_MODE_P
check.
(known_cond): Don't return const_true_rtx for vector modes.  Use
CONST0_RTX instead of const0_rtx.  Formatting fixes.

* gcc.target/i386/pr87065.c: New test.

Added:
branches/gcc-8-branch/gcc/testsuite/gcc.target/i386/pr87065.c
Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/combine.c
branches/gcc-8-branch/gcc/testsuite/ChangeLog

[Bug rtl-optimization/87065] [7/8/9 Regression] combine causes ICE in trunc_int_for_mode

2018-08-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87065

--- Comment #9 from Jakub Jelinek  ---
Author: jakub
Date: Mon Aug 27 08:41:22 2018
New Revision: 263872

URL: https://gcc.gnu.org/viewcvs?rev=263872=gcc=rev
Log:
PR rtl-optimization/87065
* combine.c (simplify_if_then_else): Formatting fix.
(if_then_else_cond): Guard MULT optimization with SCALAR_INT_MODE_P
check.
(known_cond): Don't return const_true_rtx for vector modes.  Use
CONST0_RTX instead of const0_rtx.  Formatting fixes.

* gcc.target/i386/pr87065.c: New test.

Added:
trunk/gcc/testsuite/gcc.target/i386/pr87065.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/combine.c
trunk/gcc/testsuite/ChangeLog

[Bug c/80528] reimplement gnulib's "useless-if-before-free" script as a compiler warning

2018-08-27 Thread jim at meyering dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80528

jim at meyering dot net changed:

   What|Removed |Added

 CC||jim at meyering dot net

--- Comment #4 from jim at meyering dot net ---
Thanks for considering the addition. IME, the vast majority (probably "all I've
seen") of such "useless" if stmts have been attempts to avoid what used to be
UB/segfault on old systems, or simply due to people not realizing that
free(NULL) is now known to be ok on all reasonable portability targets.

[Bug gcov-profile/87069] gcov accumulates results for identical files

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87069

Martin Liška  changed:

   What|Removed |Added

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

--- Comment #2 from Martin Liška  ---
Fixed on trunk, not planning to backport that.

[Bug gcov-profile/87069] gcov accumulates results for identical files

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87069

--- Comment #1 from Martin Liška  ---
Author: marxin
Date: Mon Aug 27 08:01:54 2018
New Revision: 263871

URL: https://gcc.gnu.org/viewcvs?rev=263871=gcc=rev
Log:
Do not read gcda files multiple times (PR gcov-profile/87069).

2018-08-27  Martin Liska  

PR gcov-profile/87069
* gcov.c (process_file): Record files already processed
and warn about a file being processed multiple times.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/gcov.c

[Bug driver/83193] Help for invalid -march= options from cc1 omits -march=native on x86-64, arm. aarch64, output also inconsistent

2018-08-27 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83193

--- Comment #16 from Martin Liška  ---
Author: marxin
Date: Mon Aug 27 08:01:14 2018
New Revision: 263870

URL: https://gcc.gnu.org/viewcvs?rev=263870=gcc=rev
Log:
Print default options selection for -march,-mcpu and -mtune for aarch64 (PR
driver/83193).

2018-08-27  Martin Liska  

PR driver/83193
* config/aarch64/aarch64.c (aarch64_override_options_internal):
Set default values for x_aarch64_*_string strings.
* config/aarch64/aarch64.opt: Remove --{march,mcpu,mtune}==
prefix.  For -mabi do not print '=ABI' in help and use
 format for -msve-vector-bits and -moverride
options.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/aarch64/aarch64.c
trunk/gcc/config/aarch64/aarch64.opt

[Bug c++/87107] Template instantiation is 50x slower than with clang++

2018-08-27 Thread ufospoke at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87107

--- Comment #2 from Frédéric  ---
Yes, I've seen that one and saw it was fixed before 8.2.0. I wasn't sure
actually if it was included in 8.2.0 as it was solved few weeks before 8.2.0
was out.

[Bug tree-optimization/87110] [9 Regresssion] tree check fail in to_wide, at tree.h:5523

2018-08-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87110

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P1
  Component|c   |tree-optimization
Version|8.0 |9.0

[Bug c++/87107] Template instantiation is 50x slower than with clang++

2018-08-27 Thread mateusz at loskot dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87107

--- Comment #1 from Mateusz Loskot  ---
There was similar bug reported to GCC 8.1, fixed in 8.2
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86320

However, I'm not seeing any improvement compiling the Frédéric's sample
gcc-is-long-minimum-and-standalone.cpp with GCC 8.2 on Linux.

  1   2   >