[Bug tree-optimization/90270] [8/9/10 Regression] Do not select best induction variable optimization

2019-04-27 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90270

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-04-28
 Ever confirmed|0   |1

--- Comment #2 from Andrew Pinski  ---
GCC 7.3.0 for aarch64 produces:
.L2:
ldr w0, [x21, x19]
bl  crcu32
mov w1, w0
ldr w0, [x20, x19]
add x19, x19, 4
bl  crcu32
and w1, w0, 65535
cmp x19, 32
bne .L2

Which looks correct while GCC 8.3.0 produces:
.L2:
lsl x19, x20, 2
add x0, sp, 32
add x20, x20, 1
add x0, x0, x19
ldr w0, [x0, -4]
bl  crcu32
add x1, sp, 64
add x19, x1, x19
mov w1, w0
ldr w0, [x19, -4]
bl  crcu32
and w1, w0, 65535
cmp x20, 9
bne .L2

GCC 9.0.1 (from March 10th) produces:
.L2:
lsl x19, x20, 2
add x0, sp, 32
add x20, x20, 1
add x0, x0, x19
ldr w0, [x0, -4]
bl  crcu32
add x1, sp, 64
add x19, x1, x19
mov w1, w0
ldr w0, [x19, -4]
bl  crcu32
and w1, w0, 65535
cmp x20, 9
bne .L2

So going to assume GCC 9.1.0 also has a similar issue.

[Bug tree-optimization/90270] [8/9/10 Regression] Do not select best induction variable optimization

2019-04-27 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90270

Andrew Pinski  changed:

   What|Removed |Added

  Known to work||7.3.0
   Target Milestone|--- |8.4
  Known to fail||8.3.0

[Bug tree-optimization/90270] [8/9/10 Regression] Do not select best induction variable optimization

2019-04-27 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90270

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization
 Target||aarch64, riscv
Summary|Do not select best  |[8/9/10 Regression] Do not
   |induction variable  |select best induction
   |optimization|variable optimization

--- Comment #1 from Andrew Pinski  ---
Interesting aarch64 also has the same issue.

[Bug tree-optimization/90270] New: Do not select best induction variable optimization

2019-04-27 Thread rjiejie at me dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90270

Bug ID: 90270
   Summary: Do not select best induction variable optimization
   Product: gcc
   Version: 8.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: rjiejie at me dot com
  Target Milestone: ---

Using built-in specs.
COLLECT_GCC=/home/jojo/work/csky/cskytoolchain/csky-toolchain-build-riscv/riscv-install/bin/riscv64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/home/jojo/work/csky/cskytoolchain/csky-toolchain-build-riscv/riscv-install/libexec/gcc/riscv64-unknown-linux-gnu/8.1.0/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with:
/home/jojo/work/csky/cskytoolchain/csky-toolchain-build-riscv/riscv-gcc/configure
--target=riscv64-unknown-linux-gnu
--prefix=/home/jojo/work/csky/cskytoolchain/csky-toolchain-build-riscv/riscv-install
--with-sysroot=/home/jojo/work/csky/cskytoolchain/csky-toolchain-build-riscv/riscv-install/sysroot
--with-system-zlib --enable-shared --enable-tls --enable-languages=c,c++
--disable-libmudflap --disable-libssp --disable-libquadmath --disable-nls
--disable-bootstrap --src=.././riscv-gcc --enable-checking=yes
--with-pkgversion= --disable-multilib --with-abi=lp64 --with-arch=rv64imac
'CFLAGS_FOR_TARGET=-O2  -mcmodel=medlow' 'CXXFLAGS_FOR_TARGET=-O2 
-mcmodel=medlow' CFLAGS='-O0 -g' CXXFLAGS='-O0 -g'
Thread model: posix
gcc version 8.1.0 ()


The following case do not select the best iv vars:

extern unsigned short int crcu32(unsigned int newval, unsigned short int crc);
unsigned short int func(unsigned short int crc)
{
 unsigned int final_counts[8];
 unsigned int track_counts[8];
 unsigned int i;

for (i=0; i< 8; i++) {
  crc=crcu32(final_counts[i],crc);
  crc=crcu32(track_counts[i],crc);
 }
 return crc;
}

the asm code:

.L2:
sllis0,s1,2
add a5,sp,s0
lw  a0,-4(a5)
addis1,s1,1
callcrcu32
addia5,sp,32
add s0,a5,s0
mv  a1,a0
lw  a0,-4(s0)
callcrcu32
mv  a1,a0
bne s1,s2,.L2

i debug and found some info from "ivopts" tree optimization,

the bellow additional code will adjust cost of some type address in file
tree-ssa-loop-ivopts.c:

/* Cost of small invariant expression adjusted against loop niters
 is usually zero, which makes it difficult to be differentiated
 from candidate based on loop invariant variables.  Secondly, the
 generated invariant expression may not be hoisted out of loop by
 following pass.  We penalize the cost by rounding up in order to
 neutralize such effects.  */
cost.cost = adjust_setup_cost (data, cost.cost, true);
cost.scratch = cost.cost;


when i remove the two lines, the created asm code will better:

.L2:
lw  a0,0(s0)
addis0,s0,4
addis1,s1,4
callcrcu32
mv  a1,a0
lw  a0,-4(s1)
callcrcu32
mv  a1,a0
bne s0,s2,.L2

[Bug c/90267] [7.3 regression] wrong code generated wth -O2 as missing data dependence base on memory

2019-04-27 Thread zhongyunde at huawei dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90267

--- Comment #3 from vfdff  ---
but it doesn't warning anything, even with  -Wstrict-aliasing -Wall.

Accord to http://blog.sina.com.cn/s/blog_74caf0ce010173up.html, We expect an
warning similar the following infomation.

warning: dereferencing type-punned pointer will break strict-aliasing rules

[Bug c++/90173] [9 Regression] ICE: Segmentation fault (in strip_declarator_types)

2019-04-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90173

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Sat Apr 27 21:56:17 2019
New Revision: 270626

URL: https://gcc.gnu.org/viewcvs?rev=270626&root=gcc&view=rev
Log:
PR c++/90173
* g++.dg/cpp1z/class-deduction66.C: Use dg-do compile instead of
dg-do run.

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/cpp1z/class-deduction66.C

[Bug middle-end/90216] Stack Pointer decrementing even when not loading extra data to stack.

2019-04-27 Thread stevexiong98 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90216

--- Comment #2 from stevexiong98 at hotmail dot com ---
(In reply to Andrew Pinski from comment #1)
> Confirmed, part of the problem is union is forced to memory early on but
> then optimized out but the object still exist in memory even though it is
> dead.
> I am working on an optimization which improves this by the lowering of
> bit-fields.  But it won't go in until post GCC 9 (released next year).

Thanks so much for the update. I am looking forward to the next compiler
release!

[Bug objc++/49070] [7/8/9/10 regression] ObjC++ compiler fails to compile ObjC method invocations without keyword arguments

2019-04-27 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49070

Eric Gallager  changed:

   What|Removed |Added

 CC||iains at gcc dot gnu.org,
   ||mikestump at comcast dot net

--- Comment #4 from Eric Gallager  ---
cc-ing objc[++] maintainers

[Bug c/50422] -Wswitch warns about unhandled cases in nested switches

2019-04-27 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50422

Eric Gallager  changed:

   What|Removed |Added

 CC||dmalcolm at gcc dot gnu.org,
   ||dodji at gcc dot gnu.org

--- Comment #2 from Eric Gallager  ---
cc-ing diagnostics maintainers

[Bug c/55096] Wconversion-nul does not work in C

2019-04-27 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55096

Eric Gallager  changed:

   What|Removed |Added

 CC||dmalcolm at gcc dot gnu.org,
   ||dodji at gcc dot gnu.org

--- Comment #2 from Eric Gallager  ---
cc-ing diagnostics maintainers

[Bug tree-optimization/90269] loop distribution defeated by clobbers

2019-04-27 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90269

--- Comment #1 from Marc Glisse  ---
--- tree-loop-distribution.c(revision 270624)
+++ tree-loop-distribution.c(working copy)
@@ -3033,20 +3033,23 @@ find_seed_stmts_for_distribution (struct
 the loop.  */
  if (!stmt_has_scalar_dependences_outside_loop (loop, phi))
continue;
  work_list->safe_push (phi);
}
   for (gimple_stmt_iterator gsi = gsi_start_bb (bbs[i]);
   !gsi_end_p (gsi); gsi_next (&gsi))
{
  gimple *stmt = gsi_stmt (gsi);

+ if (gimple_clobber_p (stmt))
+   continue;
+
  /* If there is a stmt with side-effects bail out - we
 cannot and should not distribute this loop.  */
  if (gimple_has_side_effects (stmt))
{
  free (bbs);
  return false;
}

  /* Distribute stmts which have defs that are used outside of
 the loop.  */

works for this testcase, but that may be too crude (?).

[Bug tree-optimization/90269] New: loop distribution defeated by clobbers

2019-04-27 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90269

Bug ID: 90269
   Summary: loop distribution defeated by clobbers
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Keywords: missed-optimization
  Severity: enhancement
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: glisse at gcc dot gnu.org
  Target Milestone: ---

#include 
#ifndef EASY
typedef std::unique_ptr T;
#else
typedef int* T;
#endif
void f(T*__restrict a,T*__restrict b){
for(int i=0;i<1024;++i){
new(a+i)T(std::move(b[i]));
b[i].~T();
}
}

Compiling with -O3, with -DEASY I get a nice call to memcpy, while without it I
keep a loop. The difference, before the ldist pass, is that the version with
unique_ptr has clobbers:

  _8 = MEM[(int * const &)_3];
  MEM[(struct  &)_10] ={v} {CLOBBER};
  MEM[(struct _Head_base *)_10]._M_head_impl = _8;
  MEM[(struct  &)_3] ={v} {CLOBBER};

ldist checks gimple_has_side_effects (stmt) on the first clobber and gives up.
Vectorization does not seem to have any problem with those clobbers.

(by the way, I believe DSE could remove the first clobber, it seems pretty
useless when it is immediately followed by a write to the full object)

[Bug c/90036] [8/9/10 Regression] false positive: directive argument is null [-Werror=format-overflow=]

2019-04-27 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90036

Segher Boessenkool  changed:

   What|Removed |Added

 CC||segher at gcc dot gnu.org

--- Comment #4 from Segher Boessenkool  ---
x.cpp:22:11: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
   22 | printf("%s = %s\n", &N1[0], &N2[0]); // warning
  | ~~^

Side issue...  It's not clear what a "directive" or a "directive argument"
is here, without guessing.  "%s" is called a "conversion specifier".  "null"
is not a defined anything either, and the highlight should ideally be on the
argument, with maybe an extra info one for the conversion spec.

So maybe something like

x.cpp:22:11: error: argument to ‘%s’ is a null pointer
[-Werror=format-overflow=]
   22 | printf("%s = %s\n", &N1[0], &N2[0]); // warning
  | ^~  ^~

[Bug libstdc++/87106] Group move and destruction of the source, where possible, for speed

2019-04-27 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87106

--- Comment #21 from Marc Glisse  ---
Author: glisse
Date: Sat Apr 27 14:09:20 2019
New Revision: 270624

URL: https://gcc.gnu.org/viewcvs?rev=270624&root=gcc&view=rev
Log:
Use __restrict for __relocate_object_a

2019-04-27  Marc Glisse  

PR libstdc++/87106
* include/bits/stl_uninitialized.h (__relocate_object_a): Mark the
arguments with __restrict.

Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/stl_uninitialized.h

[Bug target/89261] ix86_data_alignment has wrong argument type

2019-04-27 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89261

Uroš Bizjak  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Assignee|unassigned at gcc dot gnu.org  |ubizjak at gmail dot com
   Target Milestone|--- |10.0

--- Comment #5 from Uroš Bizjak  ---
Fixed.

[Bug target/89261] ix86_data_alignment has wrong argument type

2019-04-27 Thread uros at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89261

--- Comment #4 from uros at gcc dot gnu.org ---
Author: uros
Date: Sat Apr 27 13:38:19 2019
New Revision: 270623

URL: https://gcc.gnu.org/viewcvs?rev=270623&root=gcc&view=rev
Log:
PR target/89261
* config/i386/i386-protos.h (ix86_data_alignment): Change
the second argument type to unsigned int.
* config/i386/i386.c (ix86_data_alignment): Change "align"
argument type to unsigned int.

testsuite/ChangeLog:

PR target/89261
* gcc.target/i386/pr89261.c: New test.


Added:
trunk/gcc/testsuite/gcc.target/i386/pr89261.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386-protos.h
trunk/gcc/config/i386/i386.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/89953] ICE in nothrow_spec_p, at cp/except.c:1244

2019-04-27 Thread h2+bugs at fsfe dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89953

Hannes Hauswedell  changed:

   What|Removed |Added

 CC||h2+bugs at fsfe dot org

--- Comment #17 from Hannes Hauswedell  ---
I don't want to sound presumptuous, but can we raise the importance of this
issue? Otherwise we will get a gcc9 release that breaks all projects using the
soon-to-be-released 1.0 release of range-v3.

I think that is quite significant or not?

Thank you for your work on GCC!

[Bug c/90036] [8/9/10 Regression] false positive: directive argument is null [-Werror=format-overflow=]

2019-04-27 Thread dimhen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90036

--- Comment #3 from Dmitry G. Dyachenko  ---
I see smth may be similar starts at r265648 / PR87041

265647 NO warnings
265648 warnings
270581 warnings

$ cat x.cpp
#include 
#include 

extern void extf(char*);

extern unsigned U1;
extern unsigned U2;

void foo()
{
if(U1 == 0)
return;
if(U2 == 0)
return;

std::vector N1(U1);
extf(&N1[0]);

std::vector N2(U2);
extf(&N2[0]);

printf("%s = %s\n", &N1[0], &N2[0]); // warning
}

void foo_i(unsigned i)
{
if(i == 0)
return;
if(U2 == 0)
return;

std::vector N1(i);
extf(&N1[0]);

std::vector N2(U2);
extf(&N2[0]);

printf("%s = %s\n", &N1[0], &N2[0]); // warning
}

void foo_j(unsigned j)
{
if(U1 == 0)
return;
if(j == 0)
return;

std::vector N1(U1);
extf(&N1[0]);

std::vector N2(j);
extf(&N2[0]);

printf("%s = %s\n", &N1[0], &N2[0]); // NO warning
}

void foo_2(unsigned i, unsigned j)
{
if(i == 0)
return;
if(j == 0)
return;

std::vector N1(i);
extf(&N1[0]);

std::vector N2(j);
extf(&N2[0]);

printf("%s = %s\n", &N1[0], &N2[0]);  // NO warning
}

$ g++ -O2 -Wall -Werror -c x.cpp
x.cpp: In function ‘void foo()’:
x.cpp:22:11: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
   22 | printf("%s = %s\n", &N1[0], &N2[0]); // warning
  | ~~^
x.cpp: In function ‘void foo_i(unsigned int)’:
x.cpp:38:11: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
   38 | printf("%s = %s\n", &N1[0], &N2[0]); // warning
  | ~~^

[Bug libobjc/90268] compile failure for gcc9, missing libtool in that directory

2019-04-27 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90268

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2019-04-27
 Ever confirmed|0   |1

--- Comment #3 from Andrew Pinski  ---
For me libtool is created when configure is run.

Also nothing has changed in libobjc/configure since October 2018.

Are you regenerating the configure files?

[Bug libobjc/90268] compile failure for gcc9, missing libtool in that directory

2019-04-27 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90268

--- Comment #2 from Andrew Pinski  ---
Are you building in the src directory?  That is normally not tested.

[Bug libobjc/90268] compile failure for gcc9, missing libtool in that directory

2019-04-27 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90268

Andrew Pinski  changed:

   What|Removed |Added

  Component|objc|libobjc

--- Comment #1 from Andrew Pinski  ---
How did you configure GCC?