[Bug target/81842] -fcf-protection -mcet is incompatible with makecontext family functions

2017-12-14 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81842

--- Comment #12 from H.J. Lu  ---
Maybe we should just simply poison  to issue an error
if SHSTK is enabled.

[Bug target/81842] -fcf-protection -mcet is incompatible with makecontext family functions

2017-12-14 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81842

H.J. Lu  changed:

   What|Removed |Added

  Attachment #42889|0   |1
is obsolete||

--- Comment #11 from H.J. Lu  ---
Created attachment 42893
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42893&action=edit
A better patch

A target hook may be added to output_constant in varasm.c
to check for initializer with ucontext functions.  Location
information is available.

[Bug tree-optimization/83435] New: [8 Regression] ICE in set_value_range, at tree-vrp.c:211

2017-12-14 Thread asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83435

Bug ID: 83435
   Summary: [8 Regression] ICE in set_value_range, at
tree-vrp.c:211
   Product: gcc
   Version: 7.2.1
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: asolokha at gmx dot com
  Target Milestone: ---

gcc-8.0.0-alpha20171210 snapshot (r255534) ICEs when compiling the following
snippet w/ -O1 (-Os, -O2, -O3, -Ofast) -ftree-parallelize-loops=2
-floop-parallelize-all:

int yj, ax;

void
gf (signed char mp)
{
  int *dh = &yj;

  for (;;)
{
  signed char sb;

  for (sb = 0; sb < 1; sb -= 8)
{
}

  mp &= mp <= sb;
  if (mp == 0)
dh = &ax;
  mp = 0;
  *dh = 0;
}
}

% gcc-8.0.0-alpha20171210 -O1 -ftree-parallelize-loops=2 -floop-parallelize-all
-c jv3h3lvo.c
during GIMPLE pass: dom
jv3h3lvo.c: In function 'gf':
jv3h3lvo.c:4:1: internal compiler error: in set_value_range, at tree-vrp.c:211
 gf (signed char mp)
 ^~
0x7645b3 set_value_range(value_range*, value_range_type, tree_node*,
tree_node*, bitmap_head*)
   
/var/tmp/portage/sys-devel/gcc-8.0.0_alpha20171210/work/gcc-8-20171210/gcc/tree-vrp.c:211
0xf7944d vr_values::extract_range_for_var_from_comparison_expr(tree_node*,
tree_code, tree_node*, tree_node*, value_range*)
   
/var/tmp/portage/sys-devel/gcc-8.0.0_alpha20171210/work/gcc-8-20171210/gcc/vr-values.c:634
0x13eb9a0 evrp_range_analyzer::try_find_new_range(tree_node*, tree_node*,
tree_code, tree_node*)
   
/var/tmp/portage/sys-devel/gcc-8.0.0_alpha20171210/work/gcc-8-20171210/gcc/gimple-ssa-evrp-analyze.c:87
0x13ec7d6
evrp_range_analyzer::record_ranges_from_incoming_edge(basic_block_def*)
   
/var/tmp/portage/sys-devel/gcc-8.0.0_alpha20171210/work/gcc-8-20171210/gcc/gimple-ssa-evrp-analyze.c:196
0x13ecd1a evrp_range_analyzer::enter(basic_block_def*)
   
/var/tmp/portage/sys-devel/gcc-8.0.0_alpha20171210/work/gcc-8-20171210/gcc/gimple-ssa-evrp-analyze.c:73
0xe17a06 dom_opt_dom_walker::before_dom_children(basic_block_def*)
   
/var/tmp/portage/sys-devel/gcc-8.0.0_alpha20171210/work/gcc-8-20171210/gcc/tree-ssa-dom.c:1411
0x13d2147 dom_walker::walk(basic_block_def*)
   
/var/tmp/portage/sys-devel/gcc-8.0.0_alpha20171210/work/gcc-8-20171210/gcc/domwalk.c:308
0xe1801f execute
   
/var/tmp/portage/sys-devel/gcc-8.0.0_alpha20171210/work/gcc-8-20171210/gcc/tree-ssa-dom.c:704

[Bug target/80210] ICE in in extract_insn, at recog.c:2311 on ppc64 for with __builtin_pow

2017-12-14 Thread bergner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80210

--- Comment #21 from Peter Bergner  ---
Author: bergner
Date: Fri Dec 15 03:41:16 2017
New Revision: 255671

URL: https://gcc.gnu.org/viewcvs?rev=255671&root=gcc&view=rev
Log:
gcc/
Backport from mainline
2017-10-02  Peter Bergner  

PR target/80210
* config/rs6000/rs6000.c (rs6000_option_override_internal): Rewrite
function to not use the have_cpu variable.  Do not set cpu_index,
rs6000_cpu_index or rs6000_tune_index if we end up using TARGET_DEFAULT
or the default cpu.
(rs6000_valid_attribute_p): Remove duplicate initializations of
old_optimize and func_optimize.
(rs6000_pragma_target_parse): Call rs6000_activate_target_options ().
(rs6000_activate_target_options): Make global.
* config/rs6000/rs6000-protos.h (rs6000_activate_target_options): Add
prototype.

gcc/testsuite/
Backport from mainline
2017-10-02  Peter Bergner  

PR target/80210
* gcc.target/powerpc/pr80210-2.c: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/pr80210-2.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/config/rs6000/rs6000-protos.h
branches/gcc-6-branch/gcc/config/rs6000/rs6000.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug gcov-profile/83434] New: [GCOV] A label after a non-executed if statement is wrongly marked as not executed in gcov

2017-12-14 Thread yangyibiao at nju dot edu.cn
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83434

Bug ID: 83434
   Summary: [GCOV] A label after a non-executed if statement is
wrongly marked as not executed in gcov
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: gcov-profile
  Assignee: unassigned at gcc dot gnu.org
  Reporter: yangyibiao at nju dot edu.cn
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.2.0-8ubuntu3'
--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=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 7.2.0 (Ubuntu 7.2.0-8ubuntu3) 

$ cat small.c
int main()
{
int v = 1;
if (v > 0) 
goto lbl;
if (v < 0) ;
lbl:
v++;
}

$ gcc small.c -fprofile-arcs -ftest-coverage; ./a.out; gcov small.c; cat
small.c.gcov
File 'small.c'
Lines executed:83.33% of 6
Creating 'small.c.gcov'

-:0:Source:small.c
-:0:Graph:small.gcno
-:0:Data:small.gcda
-:0:Runs:1
-:0:Programs:1
1:1:int main()
-:2:{
1:3:int v = 1;
1:4:if (v > 0) 
1:5:goto lbl;
-:6:if (v < 0) ;
#:7:lbl:
1:8:v++;
-:9:}

//---
// As we can find that Line #7 is wrongly marked as not executed.
// While removing Line #6, the result is correct as follows: 

$ cat small-revise.c 
int main()
{
int v = 1;
if (v > 0) 
goto lbl;
// if (v < 0) ;
lbl:
v++;
}

$ gcc small-revise.c -fprofile-arcs -ftest-coverage; ./a.out; gcov
small-revise.c; cat small-revise.c.gcov
File 'small-revise.c'
Lines executed:100.00% of 6
Creating 'small-revise.c.gcov'

-:0:Source:small-revise.c
-:0:Graph:small-revise.gcno
-:0:Data:small-revise.gcda
-:0:Runs:1
-:0:Programs:1
1:1:int main()
-:2:{
1:3:int v = 1;
1:4:if (v > 0) 
1:5:goto lbl;
-:6:// if (v < 0) ;
1:7:lbl:
1:8:v++;
-:9:}

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread aoliva at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

--- Comment #77 from Alexandre Oliva  ---
Created attachment 42891
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42891&action=edit
fix libiberty/unix-pex bootstrap compare (stage3 configure)

... and if you find that bootstrap-debug compare fails in libiberty/unix-pex,
that's because the configure test for vfork fails: we start a new block for the
vfork call, even if all we had in the initial block was a debug marker.  Worse:
in this case, nothing connects the two blocks, so the vfork call and everything
else in the configure test gets optimized out.  If you are lucky,
-fcompare-debug will make that a compile failure, so the configure test result
will be different, and you'll get different code between the different stages. 
Otherwise, you might get a silent pass, and bootstrap will succeed.
Isn't that reason enough to bootstrap gcc with BUILD_CONFIG='bootstrap-debug
bootstrap-debug-lean bootstrap-debug-lib' at least once in a while? :-)

This patch reinstates the changes I'd made to fix this error some 13 months
ago, i.e., it re-reverts some of the changes that the previous patch reverted. 
They were not *just* to accept markers before labels.

[Bug lto/83201] [7/8 Regression] SPEC CPU2017 505.mcf_f produces incorrect output when built with -flto and FDO

2017-12-14 Thread pthaugen at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83201

--- Comment #5 from Pat Haugen  ---
Current FSF 6 branch works fine, so I have some bisect points. Will comment
further as I find out.

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread aoliva at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

--- Comment #76 from Alexandre Oliva  ---
Created attachment 42890
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42890&action=edit
move markers after labels while building the cfg

This is a follow up to comment 61, that adjusts the IR to reject debug markers
before labels or outside BBs, and reverts the changes that had been introduced
to that end (at least those I could identify by going over the consolidated
SFN+LVU+IEPM patchset :-)

As written to gcc-patches, I will give this some thorough testing, and I'd
appreciate feedback on any compile, bootstrap or -fcompare-debug regressions
you detect with it.

[Bug middle-end/83423] default_static_chain is sorry for non-nested functions

2017-12-14 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83423

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2017-12-15
 Ever confirmed|0   |1

--- Comment #1 from Andrew Pinski  ---
> However, we also call this hook when compiling normal, non-nested
> functions, so the sorry is effective for both nested and non-nested functions.

expand_builtin_setjmp_receiver
df_get_entry_block_def_set

I think those two functions should be fixed instead of fixing the default hook.

df_get_entry_block_def_set is newish and should be fixed. 
expand_builtin_setjmp_receiver is old but not normally used in general.

[Bug c/83433] Should -Wstrict-overflow=2 produce a diagnostic for abs(INT_MIN)

2017-12-14 Thread yaghmour.shafik at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83433

--- Comment #3 from Shafik Yaghmour  ---
I still think it is awkwardly worded but your second point is valid about it
only warning on comparisons. 

Please, feel free to close.

[Bug c/83433] Should -Wstrict-overflow=2 produce a diagnostic for abs(INT_MIN)

2017-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83433

--- Comment #2 from Jonathan Wakely  ---
Specifically, it says

 "warn about other cases where a comparison is simplified to a constant"
   

Calling abs(INT_MIN) is not a comparison.

[Bug c/83433] Should -Wstrict-overflow=2 produce a diagnostic for abs(INT_MIN)

2017-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83433

--- Comment #1 from Jonathan Wakely  ---
The docs don't indicate that to me. The option warns about checking if the
result of abs(x) is non-negative, which is true except for the undefined case
of abs(INT_MIN), it doesn't warn about the call to abs(INT_MIN) itself.

Also note that your wandbox example doesn't enable -fstrict-overflow, so the
warning option is ignored. "This option is only active when -fstrict-overflow
is active." (But there's still no warning with -fstrict-overflow).

[Bug c/83433] New: Should -Wstrict-overflow=2 produce a diagnostic for abs(INT_MIN)

2017-12-14 Thread yaghmour.shafik at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83433

Bug ID: 83433
   Summary: Should -Wstrict-overflow=2 produce a diagnostic for
abs(INT_MIN)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: yaghmour.shafik at gmail dot com
  Target Milestone: ---

Given the following code:

#include 
#include 
#include 

int main() {  
  printf( "%d\n", abs(INT_MIN) ) ;
}

and compiling with -Wstrict-overflow=2 should it generate a diagnostic?

Live example: https://wandbox.org/permlink/IzlAIizAPKPCi3Y4


The warning options documentation:
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html says:

"Also warn about other cases where a comparison is simplified to a constant.
For example: abs (x) >= 0. This can only be simplified when signed integer
overflow is undefined, because abs (INT_MIN) overflows to INT_MIN, which is
less than zero. -Wstrict-overflow (with no level) is the same as
-Wstrict-overflow=2."

Which seems to indicate(although awkwardly worded) this case should be caught.

[Bug target/81842] -fcf-protection -mcet is incompatible with makecontext family functions

2017-12-14 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81842

H.J. Lu  changed:

   What|Removed |Added

  Attachment #42836|0   |1
is obsolete||

--- Comment #10 from H.J. Lu  ---
Created attachment 42889
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42889&action=edit
An updated patch

This patch removes incorrect error locations.

[Bug tree-optimization/81635] [8 Regression] nvptx SLP test cases regressions

2017-12-14 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81635

--- Comment #11 from rsandifo at gcc dot gnu.org  
---
(In reply to Jakub Jelinek from comment #10)
> So, for #c3 testcase on x86_64-linux, I can confirm:
> -bash-4.3$ rm -f pr81635.c.*; /opt/notnfs/gcc-bisect/obj/gcc/cc1.249895
> -quiet -ftree-slp-vectorize -O2 pr81635.c -fdump-tree-slp-details
> -fdump-tree-vect-details; grep ectorized pr81635.c.*
> pr81635.c:10:3: note: Basic block will be vectorized using SLP
> pr81635.c:10:3: note: basic block part vectorized
> pr81635.c:10:3: note: basic block vectorized
> pr81635.c:18:1: note: not vectorized: not enough data-refs in basic block.
> -bash-4.3$ rm -f pr81635.c.*; /opt/notnfs/gcc-bisect/obj/gcc/cc1.249896
> -quiet -ftree-slp-vectorize -O2 pr81635.c -fdump-tree-slp-details
> -fdump-tree-vect-details; grep ectorized pr81635.c.*
> pr81635.c:10:3: note: not vectorized: no grouped stores in basic block.
> pr81635.c:18:1: note: not vectorized: not enough data-refs in basic block.
> -bash-4.3$ rm -f pr81635.c.*; /opt/notnfs/gcc-bisect/obj/gcc/cc1.255629
> -quiet -ftree-slp-vectorize -O2 pr81635.c -fdump-tree-slp-details
> -fdump-tree-vect-details; grep ectorized pr81635.c.*
> pr81635.c:10:3: note: not vectorized: no grouped stores in basic block.
> pr81635.c:18:1: note: not vectorized: not enough data-refs in basic block.
> 
> So r249896 regressed it.  Richard, what happened to "Testing a fix"?

I posted a patch here https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00992.html
with the latest patch being
https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01276.html .

But the chnage to predcom introduced code quality regressions in a few tests,
so I need to look at it a bit more.  I'm going to go back to it once the SVE
stuff quitens down.

[Bug testsuite/83432] [8 regression] moved test case 26_numerics/complex/inserters_extractors/char/dr2714.cc:75 fails starting with 255630

2017-12-14 Thread seurer at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83432

seurer at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #2 from seurer at gcc dot gnu.org ---
In the latest round of testing it passed

[Bug c++/83431] -Wformat-truncation may incorrectly report truncation

2017-12-14 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83431

Martin Sebor  changed:

   What|Removed |Added

   Keywords||missed-optimization

--- Comment #2 from Martin Sebor  ---
This is GCC 9 material.

[Bug c++/83431] -Wformat-truncation may incorrectly report truncation

2017-12-14 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83431

Martin Sebor  changed:

   What|Removed |Added

   Keywords||diagnostic
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-12-14
 CC||msebor at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Martin Sebor  ---
That's right.  String lengths are computed by and available only within the
strlen pass, while sprintf/snprintf calls are processed by the sprintf pass. 
The two passes should probably be integrated somehow to benefit from each
other's analysis.  The example below shows where the integration would benefit
in the strlen pass.

$ cat d.c && gcc -O2 -S -Wall -fdump-tree-optimized=/dev/stdout d.c
void f (char *d)
{
  __builtin_sprintf (d, "%s", "123");

  if (__builtin_strlen (d) != 3)   // folded
__builtin_abort ();// eliminated
}

void g (char *d)
{
  int n = __builtin_sprintf (d, "%i", 123);

  if (n != 3)  // folded
__builtin_abort ();// eliminated
}

void h (char *d)
{
  __builtin_sprintf (d, "%i", 123);

  if (__builtin_strlen (d) != 3)   // not folded
__builtin_abort ();// not eliminated
}


;; Function f (f, funcdef_no=0, decl_uid=1892, cgraph_uid=0, symbol_order=0)

f (char * d)
{
   [local count: 1073741825]:
  __builtin_memcpy (d_3(D), "123", 4); [tail call]
  return;

}



;; Function g (g, funcdef_no=1, decl_uid=1895, cgraph_uid=1, symbol_order=1)

g (char * d)
{
   [local count: 1073741825]:
  __builtin_sprintf (d_2(D), "%i", 123); [tail call]
  return;

}



;; Function h (h, funcdef_no=2, decl_uid=1899, cgraph_uid=2, symbol_order=2)

h (char * d)
{
  long unsigned int _1;

   [local count: 1073741825]:
  __builtin_sprintf (d_3(D), "%i", 123);
  _1 = __builtin_strlen (d_3(D));
  if (_1 != 3)
goto ; [0.00%]
  else
goto ; [99.96%]

   [count: 0]:
  __builtin_abort ();

   [local count: 1073312327]:
  return;

}

[Bug libstdc++/83279] std::experimental::filesystem::copy_file can't copy larger files than 2.0GiB

2017-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83279

Jonathan Wakely  changed:

   What|Removed |Added

   Target Milestone|--- |6.5

--- Comment #11 from Jonathan Wakely  ---
Fixed on trunk so far.

[Bug libstdc++/83279] std::experimental::filesystem::copy_file can't copy larger files than 2.0GiB

2017-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83279

--- Comment #10 from Jonathan Wakely  ---
Author: redi
Date: Thu Dec 14 21:49:03 2017
New Revision: 255666

URL: https://gcc.gnu.org/viewcvs?rev=255666&root=gcc&view=rev
Log:
PR libstdc++/83279 handle sendfile not copying entire file

PR libstdc++/83279
* src/filesystem/std-ops.cc (do_copy_file): Handle sendfile not
copying entire file.

Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/src/filesystem/std-ops.cc

[Bug c++/83430] buffer overflow diagnostics for snprintf is broken

2017-12-14 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83430

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #2 from Martin Sebor  ---
Let me take care of at least the first of the two problems.

[Bug c++/83430] buffer overflow diagnostics for snprintf is broken

2017-12-14 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83430

Martin Sebor  changed:

   What|Removed |Added

   Keywords||diagnostic
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-12-14
 CC||msebor at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Martin Sebor  ---
Confirmed.  Exceeding the size of the destination should be diagnosed.  This is
an easy change to make.

The second problem could and arguably should be detected by
-Wsizeof-pointer-memaccess as it is for functions like strncpy().  It looks
like the warning has all the smarts to do it except for a small limitation in
the sizeof_pointer_memaccess_warning() function.  To detect this problem the
function would need to iterate over snprintf arguments starting with the first
one after the format string, and check each for equality to sizeof_arg[idx]. 
This also looks easy but should probably be made as a separate change from the
above (and tracked by a separate bug).

[Bug fortran/83344] Use of uninitialized memory with ASSOCIATE and strings

2017-12-14 Thread jb at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83344

--- Comment #9 from Janne Blomqvist  ---
With the patch in #2 (which in this case is equivalent to your patch in #8) I
get on my charlen->size_t branch:

❯ gfortran -O0 -Wall -c a22.f90
a22.f90:20:0:

   associate(w4 => trim(s))

Warning: ‘.w4’ is used uninitialized in this function [-Wuninitialized]
a22.f90:20:0:

   associate(w4 => trim(s))

Error: size of variable ‘w4’ is too large


The warning is entirely correct, if one looks at the 003t.original dump one can
see that .w4 is never assigned to:

foo ()
{
  character(kind=1) s[1:4];

  {
integer(kind=8) .w4;
character(kind=1) w4[1:.w4];

{
  character(kind=1) * pstr.0;
  integer(kind=8) len.1;
  sizetype D.3727;
  sizetype D.3728;

  _gfortran_string_trim (&len.1, (void * *) &pstr.0, 4, &s);
  D.3727 = (sizetype) len.1;
  D.3728 = (sizetype) .w4;
  if (D.3728 != 0)
{
  __builtin_memmove ((void *) &w4, (void *) pstr.0, (unsigned long)
MIN_EXPR , NON_LVALUE_EXPR >);
  if (NON_LVALUE_EXPR  < NON_LVALUE_EXPR )
{
  __builtin_memset ((void *) &w4 + NON_LVALUE_EXPR , 32,
(unsigned long) (NON_LVALUE_EXPR  - NON_LVALUE_EXPR ));
}
}
  if (len.1 > 0)
{
  __builtin_free ((void *) pstr.0);
}
}
L.1:;
  }
}

What the "w4 is too large" error message means I'm not sure. It might be that
the uninitialized kind=8 .w4 value is large enough to trigger some kind of
"this must be non-sensical" error in the middle-end.

[Bug libstdc++/83279] std::experimental::filesystem::copy_file can't copy larger files than 2.0GiB

2017-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83279

--- Comment #9 from Jonathan Wakely  ---
"sendfile() will transfer at most 0x7000 (2,147,479,552) bytes, returning
the number of bytes actually transferred.  (This is true on both 32-bit and
64-bit systems.)"

Oops.

[Bug middle-end/78809] Inline strcmp with small constant strings

2017-12-14 Thread qing.zhao at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78809

--- Comment #22 from Qing Zhao  ---
https://gcc.gnu.org/ml/gcc-patches/2017-12/msg00962.html
2nd patch

[Bug libstdc++/68519] condition_variable::wait_for does not work properly with float duration

2017-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68519

Jonathan Wakely  changed:

   What|Removed |Added

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

--- Comment #9 from Jonathan Wakely  ---
Fixed for GCC 8.

[Bug libstdc++/68519] condition_variable::wait_for does not work properly with float duration

2017-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68519

--- Comment #8 from Jonathan Wakely  ---
Author: redi
Date: Thu Dec 14 20:41:52 2017
New Revision: 255665

URL: https://gcc.gnu.org/viewcvs?rev=255665&root=gcc&view=rev
Log:
PR libstdc++/68519 use native duration to avoid rounding errors

PR libstdc++/68519
* include/std/condition_variable (condition_variable::wait_for):
Convert duration to native clock's duration before addition.
* testsuite/30_threads/condition_variable/members/68519.cc: New test.

Added:
trunk/libstdc++-v3/testsuite/30_threads/condition_variable/members/68519.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/std/condition_variable

[Bug libstdc++/83279] std::experimental::filesystem::copy_file can't copy larger files than 2.0GiB

2017-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83279

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-12-14
   Assignee|unassigned at gcc dot gnu.org  |redi at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #8 from Jonathan Wakely  ---
I can reproduce this. It stops copying at 2G and reports an error.

[Bug testsuite/83432] [8 regression] moved test case 26_numerics/complex/inserters_extractors/char/dr2714.cc:75 fails starting with 255630

2017-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83432

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2017-12-14
 Ever confirmed|0   |1

--- Comment #1 from Jonathan Wakely  ---
It's not failing on gcc112 in the compile farm. Did you do a clean build, so
that libstdc++ is rebuilt and not using a stale version of complex_io.o ?

[Bug testsuite/83432] New: [8 regression] moved test case 26_numerics/complex/inserters_extractors/char/dr2714.cc:75 fails starting with 255630

2017-12-14 Thread seurer at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83432

Bug ID: 83432
   Summary: [8 regression] moved test case
26_numerics/complex/inserters_extractors/char/dr2714.c
c:75 fails starting with 255630
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: testsuite
  Assignee: unassigned at gcc dot gnu.org
  Reporter: seurer at gcc dot gnu.org
  Target Milestone: ---

or maybe after it was changed in r255632

/home/seurer/gcc/gcc-trunk/libstdc++-v3/testsuite/26_numerics/complex/inserters_extractors/char/dr2714.cc:75:
void test02(): Assertion 'in.get() == 'd'' failed.
FAIL: 26_numerics/complex/inserters_extractors/char/dr2714.cc execution test


r255632 | redi | 2017-12-14 05:47:42 -0600 (Thu, 14 Dec 2017) | 4 lines

Test whitespace handling in std::complex extraction

* testsuite/26_numerics/complex/inserters_extractors/char/dr2714.cc:
Add tests using noskipws.

r255630 | redi | 2017-12-14 05:28:41 -0600 (Thu, 14 Dec 2017) | 6 lines

Improve std::complex test and move to sub-directory

* testsuite/26_numerics/complex/dr2714.cc: Move to ...
* testsuite/26_numerics/complex/inserters_extractors/char/dr2714.cc:
... Here. Remove duplicate header and dg-options. Check first invalid
character gets putback. Remove wchar_t test.

[Bug middle-end/79538] missing -Wformat-overflow with %s and non-member array arguments

2017-12-14 Thread qing.zhao at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79538

Qing Zhao  changed:

   What|Removed |Added

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

--- Comment #5 from Qing Zhao  ---
this bug has been fixed in upstream. and is decided not back port to Gcc 7.
so close it as resolved

[Bug middle-end/59521] __builtin_expect not effective in switch

2017-12-14 Thread bugzi...@poradnik-webmastera.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59521

Daniel Fruzynski  changed:

   What|Removed |Added

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

--- Comment #15 from Daniel Fruzynski  ---
+1 for this, I wanted to request this today too. I see that some patch is
ready, how is review going?

[Bug tree-optimization/80520] [7/8 Regression] Performance regression from missing if-conversion

2017-12-14 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80520

Jeffrey A. Law  changed:

   What|Removed |Added

 CC||law at redhat dot com

--- Comment #8 from Jeffrey A. Law  ---
I'd look more at split-paths rather than DOM in this case.

Prior to split-paths we have:

  [ ... ]
  _20 = y_33 & 1;
  if (_20 != 0)
goto ; [50.00%]
  else
goto ; [50.00%]

   [local count: 531502203]:
  _18 = _25 ^ 2567483615;

   [local count: 1063004407]:
  # prephitmp_49 = PHI <_25(3), _18(4)>
  _2 = (void *) ivtmp.8_30;
  [ ... ]

Split-paths comes along and decides it'd like split BB5 resulting in:

  _20 = y_33 & 1;
  if (_20 != 0)
goto ; [50.00%]
  else
goto ; [50.00%]

   [local count: 531502203]:
  _18 = _25 ^ 2567483615;

   [local count: 531502203]:
  # prephitmp_43 = PHI <_18(4)>
  _47 = (void *) ivtmp.8_30;
  MEM[base: _47, offset: 0B] = prephitmp_43;
  ivtmp.8_42 = ivtmp.8_30 + 8;
  if (ivtmp.8_42 != _6)
goto ; [98.99%]
  else
goto ; [1.01%]

   [local count: 531502204]:
  # prephitmp_49 = PHI <_25(3)>
  _2 = (void *) ivtmp.8_30;
  MEM[base: _2, offset: 0B] = prephitmp_49;
  ivtmp.8_29 = ivtmp.8_30 + 8;
  if (ivtmp.8_29 != _6)
goto ; [98.99%]
  else
goto ; [1.01%]

I don't see any simplifications that happen as a result of that transformation
and we're not really even going to be able to simplify the branching structure.
 So ISTM that split-paths is where we ought to concentrate.  It's been
problematic in this space before -- it's got a number of hacks already to try
and discourage path splitting in cases where doing so it going to inhibit
if-conversion.

[Bug tree-optimization/83410] [8 regression] libgomp.graphite/force-parallel-4.c etc. FAIL

2017-12-14 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83410

--- Comment #5 from Jeffrey A. Law  ---
So to record my current thoughts.

There's two competing needs here.  We sometimes want to thread as the
simplifications can enable vectorization.  Other times we do not want to thread
because threading inhibits graphite and likely other optimizations.

I don't see anything in terms of the shape of the CFG before or after that we
can use to decide whether or not to thread.

The one thing that stood out was the contents of the block with the exit test. 
In the cases where we want to thread the block was just a counter increment and
branch (perhaps with PHIs).  In cases where we do not want to thread it is more
substantial.

[Bug middle-end/61118] [6/7/8 Regression] Indirect call generated for pthread_cleanup_push with constant cleanup function

2017-12-14 Thread ygribov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61118

Yury Gribov  changed:

   What|Removed |Added

 CC||ygribov at gcc dot gnu.org

--- Comment #17 from Yury Gribov  ---
(In reply to Joseph S. Myers from comment #16)
> I think the -Wclobbered warning probably needs to be reimplemented on
> GIMPLE

FYI I tried implementing this in GIMPLE earlier this year but it was
complicated by the fact that GCC created a single abnormal dispatcher block for
all setjmps in a function which made tracking data dependencies impossible.

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

--- Comment #75 from joseph at codesourcery dot com  ---
As of GCC trunk r255655 I no longer see the GCC ICE building glibc for 
m68k (instead there's a non-ICE glibc build problem as noted in 
).

[Bug c++/83431] New: -Wformat-truncation may incorrectly report truncation

2017-12-14 Thread bugzi...@poradnik-webmastera.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83431

Bug ID: 83431
   Summary: -Wformat-truncation may incorrectly report truncation
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bugzi...@poradnik-webmastera.com
  Target Milestone: ---

This looks like another missing optimization - -Wformat-truncation does not
take into account that there is "if" which checks that truncation will not
happen.

[code]
#include 
#include 

struct S
{
char str[20];
char out[10];
};

void test(S* s)
{
if (strlen(s->str) < sizeof(s->out) - 2)
snprintf(s->out, sizeof(s->out), "[%s]", s->str);
}
[/code]

[out]
$ g++ -c -o test.o test.cc -O2 -Wall
test.cc: In function ‘void test(S*)’:
test.cc:10:6: warning: ‘%s’ directive output may be truncated writing up to 19
bytes into a region of size 9 [-Wformat-truncation=]
 void test(S* s)
  ^~~~
test.cc:13:17: note: ‘snprintf’ output between 3 and 22 bytes into a
destination of size 10
 snprintf(s->out, sizeof(s->out), "[%s]", s->str);
 ^~~~
[/out]

g++ --version
g++ (GCC) 8.0.0 20171210 (experimental)

[Bug middle-end/61118] [6/7/8 Regression] Indirect call generated for pthread_cleanup_push with constant cleanup function

2017-12-14 Thread jsm28 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61118

--- Comment #16 from Joseph S. Myers  ---
I think the -Wclobbered warning probably needs to be reimplemented on GIMPLE,
in a way that actually looks at whether it's possible for a variable to be set
after the returns-twice call and before the variable goes out of scope, but
without depending on the variable being assigned to a pseudo and basing things
on the properties of that pseudo.

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

--- Comment #74 from ktkachov at gcc dot gnu.org ---
(In reply to Alexandre Oliva from comment #70)
> ktkatchov, I'll submit the patch as soon as it completes testing, which
> should be Real Soon Now (TM) :-)  If you got the cycles to give it a spin,
> by all means let us know how it goes!  Thanks,

Thanks. That patch passes bootstrap and shows no regressions on
arm-none-linux-gnueabihf.

Additionally, the gdb build now succeeds with the resultant compiler where
before it failed with the unaligned opcodes error

[Bug target/83402] PPC64 implementation of ./rs6000/emmintrin.h gives out of range for _mm_slli_epi32

2017-12-14 Thread pc at us dot ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83402

--- Comment #2 from Paul Clarke  ---
I'd like to take a stab at fixing this.

[Bug c++/83430] New: buffer overflow diagnostics for snprintf is broken

2017-12-14 Thread bugzi...@poradnik-webmastera.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83430

Bug ID: 83430
   Summary: buffer overflow diagnostics for snprintf is broken
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bugzi...@poradnik-webmastera.com
  Target Milestone: ---

[code]
#include 

struct S
{
char str[20];
char out[15];
};

void test(S* s)
{
snprintf(s->out, sizeof(s->str), "[%s]", s->str);
}
[/code]

[out]
$ g++ -c -o test.o test.cc -O2 -Wall
test.cc: In function ‘void test(S*)’:
test.cc:9:6: warning: ‘]’ directive output may be truncated writing 1 byte into
a region of size between 0 and 19 [-Wformat-truncation=]
 void test(S* s)
  ^~~~
test.cc:11:13: note: ‘snprintf’ output between 3 and 22 bytes into a
destination of size 20
 snprintf(s->out, sizeof(s->str), "[%s]", s->str);
 ^~~~
[/out]

There are two problems there:
- snprintf does not detect that actual size of out is 15 bytes, not 20;
- code passes size of one of input arguments which will be part of output
string instead of output buffer size.

Output for compilation with -D_FORTIFY_SOURCE=2 has the same problems.

g++ --version
g++ (GCC) 8.0.0 20171210 (experimental)

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

--- Comment #73 from Andreas Schwab  ---
I was using --without-build-config.

[Bug target/80210] ICE in in extract_insn, at recog.c:2311 on ppc64 for with __builtin_pow

2017-12-14 Thread bergner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80210

--- Comment #20 from Peter Bergner  ---
Author: bergner
Date: Thu Dec 14 17:43:32 2017
New Revision: 255655

URL: https://gcc.gnu.org/viewcvs?rev=255655&root=gcc&view=rev
Log:
gcc/
Backport from mainline
2017-10-02  Peter Bergner  

PR target/80210
* config/rs6000/rs6000.c (rs6000_option_override_internal): Rewrite
function to not use the have_cpu variable.  Do not set cpu_index,
rs6000_cpu_index or rs6000_tune_index if we end up using TARGET_DEFAULT
or the default cpu.
(rs6000_valid_attribute_p): Remove duplicate initializations of
old_optimize and func_optimize.
(rs6000_pragma_target_parse): Call rs6000_activate_target_options ().
(rs6000_activate_target_options): Make global.
* config/rs6000/rs6000-protos.h (rs6000_activate_target_options): Add
prototype.

gcc/testsuite/
Backport from mainline
2017-10-02  Peter Bergner  

PR target/80210
* gcc.target/powerpc/pr80210-2.c: New test.

Added:
branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/pr80210-2.c
Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/config/rs6000/rs6000-protos.h
branches/gcc-7-branch/gcc/config/rs6000/rs6000.c
branches/gcc-7-branch/gcc/testsuite/ChangeLog

[Bug middle-end/79538] missing -Wformat-overflow with %s and non-member array arguments

2017-12-14 Thread qing.zhao at oracle dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79538

--- Comment #4 from Qing Zhao  ---
fixed in

https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=255654

[Bug libstdc++/56257] std::vector allows access to the elements of _Vector_base

2017-12-14 Thread ville.voutilainen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56257

Ville Voutilainen  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||ville.voutilainen at gmail dot 
com
 Resolution|--- |WONTFIX

--- Comment #4 from Ville Voutilainen  ---
We are not going to jump through hoops to prevent users from getting into
portability trouble by writing code that the standard explicitly forbids. For
advanced users who wish to do this, they may continue to do so at their own
peril.

[Bug libstdc++/83427] [7/8 Regression] [C++17] weak result types and adaptable functions don't support noexcept functions

2017-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83427

Jonathan Wakely  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
  Known to work||6.4.0
 Resolution|--- |FIXED
  Known to fail||7.2.0, 8.0

--- Comment #4 from Jonathan Wakely  ---
Fixed for 7.3

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

--- Comment #72 from Jakub Jelinek  ---
(In reply to Andreas Schwab from comment #71)
> Bootstrap on ia64 with #c61 ended up with comparison failures.
> 
> gcc/cp/name-lookup.o differs
> gcc/cp/parser.o differs
> gcc/bb-reorder.o differs
> gcc/build/genrecog.o differs
> gcc/gcov.o differs
> gcc/wide-int.o differs
> gcc/c/c-decl.o differs
> gcc/c/c-parser.o differs
> gcc/tree-loop-distribution.o differs
> 
> The differences are only in the .debug_loc sections.

That is weird, .debug_loc sections shouldn't be emitted at all when -g0.

[Bug libstdc++/83427] [7/8 Regression] [C++17] weak result types and adaptable functions don't support noexcept functions

2017-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83427

--- Comment #3 from Jonathan Wakely  ---
Author: redi
Date: Thu Dec 14 17:29:22 2017
New Revision: 255652

URL: https://gcc.gnu.org/viewcvs?rev=255652&root=gcc&view=rev
Log:
PR libstdc++/83427 detect weak result type from noexcept functions

PR libstdc++/83427
* include/bits/refwrap.h (_Weak_result_type_impl)
(_Reference_wrapper_base): Deduce noexcept for function types.
* testsuite/20_util/bind/83427.cc: New test.
* testsuite/20_util/reference_wrapper/83427.cc: New test.

Added:
branches/gcc-7-branch/libstdc++-v3/testsuite/20_util/bind/83427.cc
   
branches/gcc-7-branch/libstdc++-v3/testsuite/20_util/reference_wrapper/83427.cc
Modified:
branches/gcc-7-branch/libstdc++-v3/ChangeLog
branches/gcc-7-branch/libstdc++-v3/include/bits/refwrap.h

[Bug tree-optimization/83312] [8 regression] bogus -Warray-bounds warning

2017-12-14 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83312

David Malcolm  changed:

   What|Removed |Added

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

--- Comment #10 from David Malcolm  ---
Should be fixed by r255649.

[Bug tree-optimization/56456] [meta-bug] bogus/missing -Warray-bounds

2017-12-14 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
Bug 56456 depends on bug 83312, which changed state.

Bug 83312 Summary: [8 regression] bogus -Warray-bounds warning
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83312

   What|Removed |Added

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

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread sch...@linux-m68k.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

--- Comment #71 from Andreas Schwab  ---
Bootstrap on ia64 with #c61 ended up with comparison failures.

gcc/cp/name-lookup.o differs
gcc/cp/parser.o differs
gcc/bb-reorder.o differs
gcc/build/genrecog.o differs
gcc/gcov.o differs
gcc/wide-int.o differs
gcc/c/c-decl.o differs
gcc/c/c-parser.o differs
gcc/tree-loop-distribution.o differs

The differences are only in the .debug_loc sections.

[Bug libstdc++/83427] [7/8 Regression] [C++17] weak result types and adaptable functions don't support noexcept functions

2017-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83427

--- Comment #2 from Jonathan Wakely  ---
Author: redi
Date: Thu Dec 14 17:18:22 2017
New Revision: 255651

URL: https://gcc.gnu.org/viewcvs?rev=255651&root=gcc&view=rev
Log:
PR libstdc++/83427 detect weak result type from noexcept functions

PR libstdc++/83427
* include/bits/refwrap.h (_Maybe_unary_or_binary_function): Move here
from .
(_Mem_fn_traits_base, _Mem_fn_traits): Move here, from .
(_Weak_result_type_impl, _Reference_wrapper_base): Deduce noexcept
for function types. Remove partial specializations for member
functions.
(_Weak_result_type_impl): Remove unused partial specializations for
non-referenceable function types and for references to functions.
(_Weak_result_type_memfun, _Reference_wrapper_base_memfun): New
helpers to handle member functions via _Mem_fn_traits.
(_Weak_result_type, reference_wrapper): Derive from new helpers.
* include/bits/std_function.h (_Maybe_unary_or_binary_function): Move
to .
* include/std/functional (_Pack, _AllConvertible, _NotSame): Remove.
(_Mem_fn_traits_base, _Mem_fn_traits): Move to .
* testsuite/20_util/bind/83427.cc: New test.
* testsuite/20_util/bind/refqual.cc: Add noexcept to functions and
check for weak result types.
* testsuite/20_util/reference_wrapper/83427.cc: New test.

Added:
trunk/libstdc++-v3/testsuite/20_util/bind/83427.cc
  - copied, changed from r255632,
trunk/libstdc++-v3/testsuite/20_util/bind/refqual.cc
trunk/libstdc++-v3/testsuite/20_util/reference_wrapper/83427.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/refwrap.h
trunk/libstdc++-v3/include/bits/std_function.h
trunk/libstdc++-v3/include/std/functional
trunk/libstdc++-v3/testsuite/20_util/bind/refqual.cc

[Bug tree-optimization/83312] [8 regression] bogus -Warray-bounds warning

2017-12-14 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83312

--- Comment #9 from David Malcolm  ---
Author: dmalcolm
Date: Thu Dec 14 17:15:39 2017
New Revision: 255649

URL: https://gcc.gnu.org/viewcvs?rev=255649&root=gcc&view=rev
Log:
vrp_prop: Use dom_walker for -Warray-bounds (PR tree-optimization/83312)

gcc/ChangeLog:
PR tree-optimization/83312
* domwalk.h (dom_walker::dom_walker): Fix typo in comment.
* tree-cfg.c (find_taken_edge): Update to handle NULL_TREE for
"val" param, and to cope with arbitrary basic blocks.
(find_taken_edge_cond_expr): Add "cond_stmt" param and use it to
handle NULL_TREE for "val", dropping "bb" param.
(find_taken_edge_switch_expr): Make "switch_stmt" param const and
drop "bb" param.  Handle NULL_TREE for "val".
(find_case_label_for_value): Make "switch_stmt" param const.
* tree-vrp.c (class check_array_bounds_dom_walker): New subclass
of dom_walker.
(vrp_prop::check_all_array_refs): Reimplement as...
(check_array_bounds_dom_walker::before_dom_children): ...this new
vfunc.  Replace linear search through BB block list, excluding
those with non-executable in-edges via dominator walk.

gcc/testsuite/ChangeLog:
PR tree-optimization/83312
* gcc.dg/pr83312.c: New test case.


Added:
trunk/gcc/testsuite/gcc.dg/pr83312.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/domwalk.h
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-cfg.c
trunk/gcc/tree-vrp.c

[Bug tree-optimization/83269] [8 Regression] Wrong constant folding

2017-12-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83269

Jakub Jelinek  changed:

   What|Removed |Added

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

--- Comment #6 from Jakub Jelinek  ---
Created attachment 42888
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42888&action=edit
gcc8-pr83269.patch

Untested fix.  As I said, the other option is to just give up in that case,
still dunno what is better.

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread aoliva at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

--- Comment #70 from Alexandre Oliva  ---
ktkatchov, I'll submit the patch as soon as it completes testing, which should
be Real Soon Now (TM) :-)  If you got the cycles to give it a spin, by all
means let us know how it goes!  Thanks,

[Bug debug/83422] [8 Regression] ICE: in final_scan_insn, at final.c:2429 after "variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without"

2017-12-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83422

--- Comment #7 from Jakub Jelinek  ---
Comment on attachment 42887
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42887
candidate patch

Preapproved for trunk.

[Bug tree-optimization/83269] [8 Regression] Wrong constant folding

2017-12-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83269

--- Comment #5 from Jakub Jelinek  ---
With -sanitize=signed-integer-overflow, we get in *.original:
  volatile unsigned char a = 1;
  long long int b = 2147483648;
  int c = (int) a * -2147483647 - (int) -b;
instead of what we get without it:
  volatile unsigned char a = 1;
  long long int b = 2147483648;
  int c = (int) b + (int) a * -2147483647;
and the testcase works in the former case, while fails with the latter.

I see fold_binary_loc called with MINUS_EXPR on
op0: (int) -(unsigned int) b
op1: (int) a * -2147483647
and it returns
(int) a * 2147483647 - (int) b
which looks wrong if (int) b is INT_MIN.
I believe it is the:
  /* (-A) - B -> (-B) - A  where B is easily negated and we can swap.  */
  if (TREE_CODE (arg0) == NEGATE_EXPR
  && negate_expr_p (op1))
return fold_build2_loc (loc, MINUS_EXPR, type,
negate_expr (op1),
fold_convert_loc (loc, type,
  TREE_OPERAND (arg0, 0)));
case in fold-const.c, supposedly we should either punt it
TYPE_OVERFLOW_UNDEFINED (type) && !TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (arg0)),
or do it in that case in unsigned type instead?

[Bug debug/83422] [8 Regression] ICE: in final_scan_insn, at final.c:2429 after "variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without"

2017-12-14 Thread aoliva at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83422

--- Comment #6 from Alexandre Oliva  ---
Created attachment 42887
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42887&action=edit
candidate patch

Here's what I'm testing.

[Bug tree-optimization/83269] [8 Regression] Wrong constant folding

2017-12-14 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83269

--- Comment #4 from Eric Botcazou  ---
How can a patch written in 2014 be responsible for a bug in GCC 4.4 exactly?

[Bug tree-optimization/83412] GCC line directive suppresses warnings

2017-12-14 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83412

--- Comment #4 from Martin Sebor  ---
I see.  I (obviously) didn't know that.  It seems like something worth
documenting.

[Bug tree-optimization/83269] [8 Regression] Wrong constant folding

2017-12-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83269

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek  ---
With -O2 this started to FAIL in between r124153 and r124228 and FAILs up to
current trunk.
With -O1, it reappeared with r247495.

Slightly adjusted:

int
main ()
{
#if __SIZEOF_INT__ == 4 && __SIZEOF_LONG_LONG__ > 4 && __CHAR_BIT__ == 8
  volatile unsigned char a = 1;
  long long b = 0x8000L;
  int c = -((int)(-b) - (-0x7fff * a));
  if (c != 1)
__builtin_abort ();
#endif
  return 0;
}

[Bug tree-optimization/83253] -ftree-slsr causes performance regression

2017-12-14 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83253

--- Comment #12 from Bill Schmidt  ---
By contrast, on powerpc64le, we see:

 - mult_by_coeff_cost (3, E_SImode, true) returns a cost of 8
 - mult_by_coeff_cost (4, E_SImode, true) returns a cost of 4

These are the sort of costs one would expect, and as a result we don't make the
poor replacement.  So each of the bad targets needs to look into their cost
models to see what is going wrong.

[Bug tree-optimization/83253] -ftree-slsr causes performance regression

2017-12-14 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83253

--- Comment #11 from Bill Schmidt  ---
OK, for the i386 case, this simply comes down to the following.

 - mult_by_coeff_cost (3, E_SImode, true) returns a cost of 4
 - mult_by_coeff_cost (4, E_SImode, true) returns a cost of 8

Garbage in, garbage out.  These costs are obviously bad.

Either there is something wrong with target costs that is misleading the
expmed.c code into producing these silly values, or the choose_mult_variant
code has something wrong with it.

[Bug c++/83429] New: Incorrect line number reported by -Wformat-truncation

2017-12-14 Thread bugzi...@poradnik-webmastera.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83429

Bug ID: 83429
   Summary: Incorrect line number reported by -Wformat-truncation
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bugzi...@poradnik-webmastera.com
  Target Milestone: ---

[code]
#include 

struct S
{
char str1[10];
char str2[10];
char out[15];
};

void test(S* s) // line 10
{
snprintf(s->out, sizeof(s->out), "%s.%s", s->str1, s->str2); // line 12
}
[/code]

When above code is compiles using "g++ -c -o test.o test.cc -O2 -Wall", it
produces following output:

[out]
test.cc: In function ‘void test(S*)’:
test.cc:10:6: warning: ‘%s’ directive output may be truncated writing up to 9
bytes into a region of size between 5 and 14 [-Wformat-truncation=]
 void test(S* s) // line 10
  ^~~~
test.cc:12:13: note: ‘snprintf’ output between 2 and 20 bytes into a
destination of size 15
 snprintf(s->out, sizeof(s->out), "%s.%s", s->str1, s->str2); // line 12
 ^~~
[/out]

As you can see, line number in "warning:" line is incorrect - it points to line
with function name. Fortunately correct number is in line with "note:". However
when code is compiled with -D_FORTIFY_SOURCE=1 added, you loose this important
piece of information:

[out]
test.cc: In function ‘void test(S*)’:
test.cc:10:6: warning: ‘%s’ directive output may be truncated writing up to 9
bytes into a region of size between 5 and 14 [-Wformat-truncation=]
 void test(S* s) // line 10
  ^~~~
In file included from /usr/include/stdio.h:937,
 from test.cc:1:
/usr/include/bits/stdio2.h:64:35: note: ‘__builtin_snprintf’ output between 2
and 20 bytes into a destination of size 15
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
  ~^~~
__bos (__s), __fmt, __va_arg_pack ());
~
[/out]

g++ --version
g++ (GCC) 8.0.0 20171210 (experimental)

[Bug libstdc++/68519] condition_variable::wait_for does not work properly with float duration

2017-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68519

--- Comment #7 from Jonathan Wakely  ---
The problem is that duration doesn't have sufficient precision to
represent now+1s as a float (the value is the same as now)

#include 
constexpr std::chrono::seconds now(1513266095);
constexpr auto then = now + std::chrono::duration(1);
static_assert( now < then, "" );

The timed waiting functions would have to check for such rounding errors.

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

ktkachov at gcc dot gnu.org changed:

   What|Removed |Added

 CC||ktkachov at gcc dot gnu.org

--- Comment #69 from ktkachov at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #68)
> Can you try the #c63 patch?  Perhaps the arm backend is yet another thing
> that doesn't really like debug insns outside of basic blocks...

Indeed, that fixes the error on arm. Do you plan to submit that? If so, I can
help with arm testing

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

--- Comment #68 from Jakub Jelinek  ---
Can you try the #c63 patch?  Perhaps the arm backend is yet another thing that
doesn't really like debug insns outside of basic blocks...

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

--- Comment #67 from ktkachov at gcc dot gnu.org ---
Thanks for working on this!

As of r255632 I'm still getting:
Error: unaligned opcodes detected in executable segment
on arm targets when building gdb. A reduced testcase is:
--

template  void xfree(T);
enum target_waitkind {
  TARGET_WAITKIND_SIGNALLED,
  TARGET_WAITKIND_LOADED,
  TARGET_WAITKIND_EXECD,
  TARGET_WAITKIND_SYSCALL_RETURN,
  TARGET_WAITKIND_SPURIOUS
};
class target_terminal {
public:
  static void m_fn1();
} a;
target_waitkind b;
void startup_inferior() {
  switch (b) {
  case TARGET_WAITKIND_SPURIOUS:
  case TARGET_WAITKIND_LOADED:
  case TARGET_WAITKIND_SIGNALLED:
  TARGET_WAITKIND_EXITED:
target_terminal::m_fn1();
  case TARGET_WAITKIND_EXECD:
xfree(a);
  }
}



The error can be reproduced with:
arm-none-eabi-g++ -O2 -g -c

[Bug rtl-optimization/83422] [8 Regression] ICE: in final_scan_insn, at final.c:2429 after "variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without"

2017-12-14 Thread aoliva at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83422

Alexandre Oliva  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-12-14
   Assignee|unassigned at gcc dot gnu.org  |aoliva at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #5 from Alexandre Oliva  ---
Mine

[Bug lto/81406] [6/7 Regression] ICE in check_die, at dwarf2out.c:6185

2017-12-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81406

Jakub Jelinek  changed:

   What|Removed |Added

Summary|[6/7/8 Regression] ICE in   |[6/7 Regression] ICE in
   |check_die, at   |check_die, at
   |dwarf2out.c:6185|dwarf2out.c:6185

--- Comment #7 from Jakub Jelinek  ---
Fixed on the trunk.

[Bug lto/81406] [6/7/8 Regression] ICE in check_die, at dwarf2out.c:6185

2017-12-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81406

--- Comment #6 from Jakub Jelinek  ---
Author: jakub
Date: Thu Dec 14 15:26:00 2017
New Revision: 255643

URL: https://gcc.gnu.org/viewcvs?rev=255643&root=gcc&view=rev
Log:
PR lto/81406
* gcc.dg/lto/pr81406_0.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/lto/pr81406_0.c
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug lto/81406] [6/7/8 Regression] ICE in check_die, at dwarf2out.c:6185

2017-12-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81406

--- Comment #5 from Jakub Jelinek  ---
Created attachment 42886
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42886&action=edit
gcc8-pr81406.patch

Fixed with r251220.  I'll add this testcase to the testsuite (verified it FAILs
with r251218, and succeeds with current trunk) and remove the 8 regression.

[Bug target/81616] Update -mtune=generic for the current Intel and AMD processors

2017-12-14 Thread sebastian.peryt at intel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81616

--- Comment #39 from Sebastian Peryt  ---
I have tested it on SKX with SPEC2006INT and SPEC2017INT and don't see any
regressions.

[Bug tree-optimization/77291] False positive for -Warray-bounds

2017-12-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77291

Richard Biener  changed:

   What|Removed |Added

   Last reconfirmed|2016-08-19 00:00:00 |2017-12-14

--- Comment #2 from Richard Biener  ---
Re-confirmed.

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread aoliva at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

--- Comment #66 from Alexandre Oliva  ---
Jakub, *nod*, that's among the "changes added to support that".

Ulrich, thanks for the report.  r255639 compiles your testcase successfully on
x86_64-linux-gnu-x-spu-elf with -O -g, so I guess the problem was already fixed
by some of the already-installed patches.  If you find otherwise, please let me
know.  Thanks!

Andreas, thanks for the patch!

[Bug tree-optimization/66974] -Warray-bounds false positive with -O3

2017-12-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66974

Richard Biener  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
  Known to work||8.0
 Depends on||83202
 Resolution|--- |FIXED

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


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83202
[Bug 83202] Try joining operations on consecutive array elements during tree
vectorization

[Bug tree-optimization/66974] -Warray-bounds false positive with -O3

2017-12-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66974

--- Comment #8 from Richard Biener  ---
Author: rguenth
Date: Thu Dec 14 15:18:16 2017
New Revision: 255642

URL: https://gcc.gnu.org/viewcvs?rev=255642&root=gcc&view=rev
Log:
2017-12-14  Richard Biener  

PR tree-optimization/66974
* gcc.dg/Warray-bounds-24.c: New testcase.

Added:
trunk/gcc/testsuite/gcc.dg/Warray-bounds-24.c
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug tree-optimization/56210] invalid -Warray-bounds warning

2017-12-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56210

Richard Biener  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW
  Known to work||4.8.5
  Known to fail||4.8.4

--- Comment #7 from Richard Biener  ---
The diagnostic is long fixed but the folding failure / const promotion issue
remains:

f ()
{
  static char key[4] = "abc";
  char * p;
  int _1;
  char _2;

   [local count: 153142428]:

   [local count: 1020054733]:
  # p_12 = PHI <";"(2), p_8(6)>
  _1 = __builtin_strncmp (p_12, &key, 3);

[Bug tree-optimization/81740] [6/7/8 Regression] wrong code at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu

2017-12-14 Thread amker at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81740

--- Comment #4 from amker at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #3)
> Testcase modified for the testsuite:
> 
> int a[8][10] = { [2][5] = 4 }, c;
> 
> int
> main ()
> {
>   short b;
>   int i, d;
>   for (b = 4; b >= 0; b--)
> for (c = 0; c <= 6; c++)
>   a[c + 1][b + 2] = a[c][b + 1];
>   for (i = 0; i < 8; i++)
> for (d = 0; d < 10; d++)
>   if (a[i][d] != (i == 3 && d == 6) * 4)
> __builtin_abort ();
>   return 0;
> }

So without reversal of inner loop, the loop nest is illegal for vectorization. 
The issue is in data dependence checking of vectorizer, I believe the mentioned
revision just exposed this.  Previously the vectorization is skipped because of
unsupported memory operation.
The outer loop vectorization unrolls the outer loop into:

  for (b = 4; b >= 0; b -= 4)
  {
for (c = 0; c <= 6; c++)
  a[c + 1][6] = a[c][5];
for (c = 0; c <= 6; c++)
  a[c + 1][5] = a[c][4];
for (c = 0; c <= 6; c++)
  a[c + 1][4] = a[c][3];
for (c = 0; c <= 6; c++)
  a[c + 1][3] = a[c][2];
  }
Then four inner loops are fused into:
  for (b = 4; b >= 0; b -= 4)
  {
for (c = 0; c <= 6; c++)
{
  a[c + 1][6] = a[c][5];  // S1
  a[c + 1][5] = a[c][4];  // S2
  a[c + 1][4] = a[c][3];
  a[c + 1][3] = a[c][2];
}
  }
The loop fusion needs to meet the dependence requirement.  Basically, GCC's
data dependence analyzer doesn't model deps between references in sibling
loops, but in practice, fusion requirement can be checked by analyzing all data
references after fusion, and there is no backward data dependence.
Apparently, the requirement is violated because we have backward data
dependence between references (a[c][5], a[c+1][5]) in S1/S2.

Note, if we reverse the inner loop, the outer loop would become legal for
vectorization.

As for fix, we need to enforce dep checking in vectorizer for outer loop
vectorization.  Preparing a patch now.

Thanks

[Bug tree-optimization/65258] Wrong array bounds warning

2017-12-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65258

--- Comment #5 from Richard Biener  ---
Author: rguenth
Date: Thu Dec 14 15:08:09 2017
New Revision: 255641

URL: https://gcc.gnu.org/viewcvs?rev=255641&root=gcc&view=rev
Log:
2017-12-14  Richard Biener  

PR tree-optimization/65258
* gcc.dg/Warray-bounds-23.c: New testcase.

Added:
trunk/gcc/testsuite/gcc.dg/Warray-bounds-23.c
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug tree-optimization/65258] Wrong array bounds warning

2017-12-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65258

Richard Biener  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
  Known to work||7.1.0
 Resolution|--- |FIXED

--- Comment #4 from Richard Biener  ---
Fixed in GCC 7+.

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread schwab at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

--- Comment #65 from Andreas Schwab  ---
Author: schwab
Date: Thu Dec 14 15:06:25 2017
New Revision: 255640

URL: https://gcc.gnu.org/viewcvs?rev=255640&root=gcc&view=rev
Log:
PR bootstrap/83396
* reload1.c (emit_input_reload_insns): Skip debug markers.

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

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread uweigand at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

--- Comment #64 from Ulrich Weigand  ---
I'm seeing the same error on spu-elf when building newlib with GCC revision
255614.  In case this isn't fixed by more recent changes already, here's a
reduced test case (build with -O -g):

const char *
test (const char *s)
{
  for (; ; s++)
switch (*s)
  {
  case '-':
  case 0:
return 0;

  case '\t':
  case '\n':
  case '\v':
  case '\f':
  case '\r':
  case ' ':
continue;

  default:
goto break2;
  }
break2:

  for (; *s >= '0' && *s <= '9'; s++)
;

  return s;
}

[Bug sanitizer/83388] reference statement index not found error with -fsanitize=null

2017-12-14 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83388

--- Comment #11 from rguenther at suse dot de  ---
On Thu, 14 Dec 2017, hubicka at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83388
> 
> --- Comment #10 from Jan Hubicka  ---
> Possibly, but for now I would be fine with just removing the references and
> solving it once we have real pass that attach something to them (perhaps next
> stage1)

IMHO adding a noop IFN is more forward-looking and as easy.

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread aoliva at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

--- Comment #63 from Jakub Jelinek  ---
Comment on attachment 42885
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42885
expand labels before markers

If you do this, then we should also revert the var-tracking.c etc. changes to
look for debug insns outside of bbs and deal with them.

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread aoliva at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

--- Comment #62 from Alexandre Oliva  ---
Author: aoliva
Date: Thu Dec 14 15:02:58 2017
New Revision: 255638

URL: https://gcc.gnu.org/viewcvs?rev=255638&root=gcc&view=rev
Log:
[SFN] next/prev_nonnote_insn_bb are no more, even for ports

The patch that added _nondebug to next_ and prev_nonnote_insn_bb
failed to find and adjust uses within config.  Fixed.

for  gcc/ChangeLog

PR bootstrap/83396
* config/arc/arc.c (hwloop_optimize): Skip debug insns.
* config/sh/sh-protos.h (sh_find_set_of_reg): Adjust.
* config/sh/sh.c: Skip debug insns besides notes.
* config/sh/sh.md: Likewise.
* config/sh/sh_treg_combine.cc: Likewise.
* config/sh/sync.md: Likewise.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/arc/arc.c
trunk/gcc/config/sh/sh-protos.h
trunk/gcc/config/sh/sh.c
trunk/gcc/config/sh/sh.md
trunk/gcc/config/sh/sh_treg_combine.cc
trunk/gcc/config/sh/sync.md

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

--- Comment #62 from Alexandre Oliva  ---
Author: aoliva
Date: Thu Dec 14 15:02:58 2017
New Revision: 255638

URL: https://gcc.gnu.org/viewcvs?rev=255638&root=gcc&view=rev
Log:
[SFN] next/prev_nonnote_insn_bb are no more, even for ports

The patch that added _nondebug to next_ and prev_nonnote_insn_bb
failed to find and adjust uses within config.  Fixed.

for  gcc/ChangeLog

PR bootstrap/83396
* config/arc/arc.c (hwloop_optimize): Skip debug insns.
* config/sh/sh-protos.h (sh_find_set_of_reg): Adjust.
* config/sh/sh.c: Skip debug insns besides notes.
* config/sh/sh.md: Likewise.
* config/sh/sh_treg_combine.cc: Likewise.
* config/sh/sync.md: Likewise.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/arc/arc.c
trunk/gcc/config/sh/sh-protos.h
trunk/gcc/config/sh/sh.c
trunk/gcc/config/sh/sh.md
trunk/gcc/config/sh/sh_treg_combine.cc
trunk/gcc/config/sh/sync.md

--- Comment #63 from Jakub Jelinek  ---
Comment on attachment 42885
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42885
expand labels before markers

If you do this, then we should also revert the var-tracking.c etc. changes to
look for debug insns outside of bbs and deal with them.

[Bug sanitizer/83388] reference statement index not found error with -fsanitize=null

2017-12-14 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83388

--- Comment #10 from Jan Hubicka  ---
Possibly, but for now I would be fine with just removing the references and
solving it once we have real pass that attach something to them (perhaps next
stage1)

[Bug tree-optimization/80520] [7/8 Regression] Performance regression from missing if-conversion

2017-12-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80520

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org,
   ||law at gcc dot gnu.org

--- Comment #7 from Jakub Jelinek  ---
This changed (looking at the #c6 testcase) with r242550, and the change was
intentional, tree if conversion except when it enables successful vectorization
is usually harmful, only rarely useful, but this is one of such cases.  You can
get back the previous behavior with -O3 -ftree-loop-if-convert.

The reason why the RTL CE stuff doesn't do anything here is that we end up with
multiple statements in the if block, so instead of:
  if (_20 != 0)
goto ;
  else
goto ;

  :
  _18 = _25 ^ 2567483615;

  :
  # _200 = PHI <_25(4), _18(4)>
  MEM[base: _3, offset: 0B] = _200;
  ivtmp.11_29 = ivtmp.11_30 + 8;
  if (_6 == ivtmp.11_29)
goto ;
  else
goto ;

we get:
  if (_20 != 0)
goto ;
  else
goto ;

  :
  _18 = _25 ^ 2567483615;
  MEM[base: _3, offset: 0B] = _18;
  ivtmp.11_42 = ivtmp.11_30 + 8;
  if (_6 == ivtmp.11_42)
goto ;
  else
goto ;

  :
  MEM[base: _3, offset: 0B] = _25;
  ivtmp.11_29 = ivtmp.11_30 + 8;
  if (_6 == ivtmp.11_29)
goto ;
  else
goto ;

This is created by dom, I wonder what benefit is in this case.  Even if we
don't improve it in ifcvt.c, if we can make the bb 5 with just the xor
fallthrough into bb 6, i.e. the conditional branch just jumps over the (single
insn), then that looks more beneficial to duplicating more stmts.  Jeff?
Though, seems that multiple passes are keen on doing this kind of stuff, so
in order to avoid that I have to use:
-O3 -fno-tree-dominator-opts -fno-tree-vrp -fno-split-paths
With that we get:
andl$1, %edx
je  .L2
xorq%r8, %rax
.L2:
movq%rax, (%rdi)
addq$8, %rdi
cmpq%rdi, %rsi
jne .L3
which is IMHO better, but still not the cmov.

The conditional block contains in that case:
(insn 20 19 21 5 (set (reg:DI 105)
(const_int 2567483615 [0x9908b0df])) 85 {*movdi_internal}
 (nil))
(insn 21 20 22 5 (parallel [
(set (reg:DI 93 [ _25 ])
(xor:DI (reg:DI 93 [ _25 ])
(reg:DI 105)))
(clobber (reg:CC 17 flags))
]) 443 {*xordi_1}
 (expr_list:REG_DEAD (reg:DI 105)
(expr_list:REG_UNUSED (reg:CC 17 flags)
(nil
which is too much for ifcvt.
If I change the #c6 testcase to:
void foo(unsigned long *M)
{
  for (unsigned long k = 0; k < 227; ++k)
{
  unsigned long y =
((M[k] & 0x8000) | (M[k + 1] & 0x7fff));
  M[k] = (M[k + 397] ^ (y >> 1) ^ ((y & 1) ? 567483615 : 0));
}
}
so that the immediate fits into x86_64 signed 32-bit immediate, then we have
just:
(insn 20 19 21 5 (parallel [
(set (reg:DI 93 [ _25 ])
(xor:DI (reg:DI 93 [ _25 ])
(const_int 567483615 [0x21d31cdf])))
(clobber (reg:CC 17 flags))
]) 443 {*xordi_1}
 (expr_list:REG_UNUSED (reg:CC 17 flags)
(nil)))
in the conditional block and ifcvt.c can deal with that and we get:
movq%rax, %rsi
xorq$567483615, %rsi
andl$1, %edx
cmovne  %rsi, %rax
(of course disabling the jump threading and path splitting is still needed for
this).  So, if we can do something about those, perhaps we could extend ifcvt
so that it could deal with a set of a pseudo to a constant needed for the
following instruction too and take it into account in the costs.

[Bug bootstrap/83396] [8 Regression] Bootstrap failures with Statement Frontiers

2017-12-14 Thread aoliva at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83396

--- Comment #61 from Alexandre Oliva  ---
Created attachment 42885
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42885&action=edit
expand labels before markers

This patch fixes both ia64 problems.  Basically, the ebb scheduler gets
thoroughly confused by insns (even debug insns) outside BBs.  There's no good
reason for markers to be placed before RTL labels (or even gimple labels, but I
won't delay the fix further while I work on that), and although I can't say I
really meant to have them there, the little I did is proven to be not enough
and a lot of complication for no good reason, so...  I'll make sure we keep
debug insns (and stmts) within normal BB boundaries, and review the few changes
added to support that so as to revert them, if I can still identify them.

I haven't yet tested that we don't otherwise get debug insns outside BBs, aside
from successful compilation of the two ia64 preprocessed cases, so the cfgrtl.c
chunk may have to go for now to enable bootstraps to complete.  Please let me
know if you bootstrap with it and it passes; and if it fails, please keep the
preprocessed testcases coming my way ;-)  Thanks!

[Bug tree-optimization/67842] Incorrect check in sese.h:bb_in_region

2017-12-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67842

--- Comment #3 from Richard Biener  ---
Author: rguenth
Date: Thu Dec 14 14:53:40 2017
New Revision: 255636

URL: https://gcc.gnu.org/viewcvs?rev=255636&root=gcc&view=rev
Log:
2017-12-14  Richard Biener  

PR tree-optimization/67842
* sese.h (bb_in_region): Remove #if 0'ed code.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/sese.h

[Bug tree-optimization/67842] Incorrect check in sese.h:bb_in_region

2017-12-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67842

Richard Biener  changed:

   What|Removed |Added

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

--- Comment #2 from Richard Biener  ---
"Fixed."

[Bug tree-optimization/83269] [8 Regression] Wrong constant folding

2017-12-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83269

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P1
 CC||ebotcazou at gcc dot gnu.org
   Target Milestone|--- |8.0

--- Comment #2 from Richard Biener  ---
Eric?

[Bug rtl-optimization/82973] [8 regression] ICE in output_constant_pool_2, at varasm.c:3896 on aarch64

2017-12-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82973

Richard Biener  changed:

   What|Removed |Added

  Component|fortran |rtl-optimization
Version|7.0 |8.0
   Target Milestone|--- |8.0

[Bug middle-end/61118] [6/7/8 Regression] Indirect call generated for pthread_cleanup_push with constant cleanup function

2017-12-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61118

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |6.5

[Bug tree-optimization/83253] -ftree-slsr causes performance regression

2017-12-14 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83253

--- Comment #10 from Bill Schmidt  ---
I see that I was looking at the wrong leg here.  This is a CAND_ADD, not a
CAND_MULT, and I'm getting strange cost results on that path.  The proposed
change is still appropriate in my view, but not relevant for this case.

[Bug c++/83020] [7 Regression] ('17) Class template constructor call skipped with no error when substitution fails in default argument

2017-12-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83020

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |7.3

[Bug target/82961] [6/7 Regression] ICE in dwarf2out.c: deferred_asm_name != NULL

2017-12-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82961

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |6.5

[Bug target/82989] [7/8 regression ] Inexplicable use of NEON for 64-bit math

2017-12-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82989

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |7.3

[Bug target/83330] [7/8 Regression] generating unaligned store to stack for SSE register with -mno-push-args

2017-12-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83330

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |7.3

  1   2   3   >