[Bug rtl-optimization/77714] Wrong code generation for gcc.c-torture/execute/pr51447.c

2016-09-24 Thread edlinger at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77714

--- Comment #3 from Bernd Edlinger  ---
because a different pattern is choosen for this insn
the reg-note is overwritten here:

 Choosing alt 2 in insn 48:  (0) l  (1) l  (2) lL {*thumb1_addsi3}
  Creating newreg=129, assigning class LO_REGS to r129
   48: sfp:SI=r7:SI+r129:SI
  REG_EQUAL r7:SI+r129:SI
Inserting insn reload before:
   82: r129:SI=0xfff0

but it should be:

 Choosing alt 2 in insn 48:  (0) l  (1) l  (2) lL {*thumb1_addsi3}
  Creating newreg=129, assigning class LO_REGS to r129
   48: sfp:SI=r7:SI+r129:SI
  REG_EQUAL r7:SI-0x10
Inserting insn reload before:
   82: r129:SI=0xfff0

and in the next pass this insn is removed because the reg-note
is no longer found.


The reason is the alias between the reg-note and the SET_SRC.
So this would be a more conservative fix:


Index: lra-eliminations.c
===
--- lra-eliminations.c  (revision 240437)
+++ lra-eliminations.c  (working copy)
@@ -981,7 +981,7 @@ eliminate_regs_in_insn (rtx_insn *insn, bool repla
  }
lra_update_insn_recog_data (insn);
/* Add offset note for future updates.  */
-   add_reg_note (insn, REG_EQUAL, src);
+   add_reg_note (insn, REG_EQUAL, copy_rtx (src));
return;
  }
  }

[Bug libstdc++/65122] std::vector doesn't honor element alignment

2016-09-24 Thread jacob.benoit.1 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65122

--- Comment #18 from Benoit Jacob  ---
(In reply to Andrew Pinski from comment #17)
> I think this is fixed for GCC 7 with -std=c++17 support.

Thanks for the update, that's great news!

[Bug target/77728] New: Miscompilation multiple vector iteration on ARM

2016-09-24 Thread yyc1992 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77728

Bug ID: 77728
   Summary: Miscompilation multiple vector iteration on ARM
   Product: gcc
   Version: 6.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: yyc1992 at gmail dot com
  Target Milestone: ---

Code to reproduce is at
https://gist.github.com/yuyichao/a66edb9d05d18755fb7587b12e021a8a. The two cpp
files are

```c++
#include 
#include 

typedef std::vector> DWARFAddressRangesVector;

void dumpRanges(const DWARFAddressRangesVector& Ranges) {
for (const auto &Range: Ranges) {
(void)Range;
}
}

void collectChildrenAddressRanges(DWARFAddressRangesVector& Ranges)
{
const DWARFAddressRangesVector &DIERanges = DWARFAddressRangesVector();
Ranges.insert(Ranges.end(), DIERanges.begin(), DIERanges.end());
}
```

```c++
#include 
#include 

typedef std::vector> DWARFAddressRangesVector;

void collectAddressRanges(DWARFAddressRangesVector &CURanges,
  const DWARFAddressRangesVector &CUDIERanges)
{
CURanges.insert(CURanges.end(), CUDIERanges.begin(), CUDIERanges.end());
}

int main()
{
std::vector> CURanges;
std::vector> CUDIERanges{{1, 2}};
collectAddressRanges(CURanges, CUDIERanges);
return 0;
}
```

Both compiled with `g++ -O2` and linked together. When running the compiled
program, it raises an exception in the `insert`

```
terminate called after throwing an instance of 'std::length_error'
  what():  vector::_M_range_insert
```

which shouldn't happen. The issue seems to be related to merging duplicated
code since it is important to put the code into two files and the present of
the second .o file is important even though none of the code in it is used. The
iterations also have to be all on the const reference of vector. Removing one
of the const also makes the issue go away.

The g++ is version 6.2.1 from the ArchLinuxARM armv7h repository. This might be
a regression in gcc 5 since other devs using gcc <=4.9 doesn't seem to have
this issue and I was able to reproduce this on archlinux on 4-5 different
systems with gcc >=5.

This causes https://github.com/JuliaLang/julia/issues/14550

[Bug libstdc++/65122] std::vector doesn't honor element alignment

2016-09-24 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65122

--- Comment #17 from Andrew Pinski  ---
I think this is fixed for GCC 7 with -std=c++17 support.

[Bug tree-optimization/65084] Lack of type narrowing/widening inhibits good vectorization

2016-09-24 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65084

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization
 Blocks||53947
   Severity|normal  |enhancement


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

gcc-bugs@gcc.gnu.org

2016-09-24 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60962

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug preprocessor/60961] recipe for target 'doc/cpp.info' failed

2016-09-24 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60961

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||documentation
 Status|UNCONFIRMED |RESOLVED
  Component|c++ |preprocessor
 Resolution|--- |WONTFIX

--- Comment #3 from Andrew Pinski  ---
Closing as won't fix as we won't fix unsupported released any more.

[Bug target/64960] Inefficient address pre-computation in PIC mode

2016-09-24 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64960

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug testsuite/65191] keep interesting core files and remove others

2016-09-24 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65191

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #4 from Andrew Pinski  ---
I don't think this is a good thing.  In fact it is a bad thing as you could run
out of space due to the core file multiples.  If you have a failure you can run
it manually to debug it anyways.

[Bug lto/65274] Internal compiler error: should die in combat

2016-09-24 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65274

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #5 from Andrew Pinski  ---
Closing then.

[Bug other/61439] contrib/download_prerequisites script does not verify integrity of packages

2016-09-24 Thread moritz at klammler dot eu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61439

--- Comment #7 from Moritz Klammler  ---
https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00606.html

[Bug other/61439] contrib/download_prerequisites script does not verify integrity of packages

2016-09-24 Thread krichter at posteo dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61439

krichter at posteo dot de changed:

   What|Removed |Added

 CC||krichter at posteo dot de

--- Comment #6 from krichter at posteo dot de ---
Has this been reviewed/merged yet? It'd be really appreciated.

Pinging based on [GCC patch tracking
infos](https://gcc.gnu.org/wiki/GCC_Patch_Tracking) which say it's fine to
annoy maintainers :)

[Bug libstdc++/77727] New: Unwrapping std::optional constructor is not working for non-transferable object

2016-09-24 Thread tomaszkam at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77727

Bug ID: 77727
   Summary: Unwrapping std::optional constructor is not working
for non-transferable object
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tomaszkam at gmail dot com
  Target Milestone: ---

The following code does not compile:
#include 

struct NonTransferable
{
NonTransferable(int) {}
NonTransferable(NonTransferable&&) = delete;
NonTransferable& operator=(NonTransferable&&) = delete;
};

int main()
{
std::optional oi;
std::optional ot(std::move(oi));

std::optional oi2(10);
std::optional ot2(oi2);
}

Both the construction of the ot and ot2 shall be well-formed according to
specification from http://cplusplus.github.io/LWG/lwg-active.html#2756 and
call:
optional::optional(optional&&);
optional::optional(optional const&);
constructors respectively as:
is_constructible_v
is_constructible_v
are true, and the NonTransferable class cannot be constructed/converted from
optional.

[Bug tree-optimization/77719] [7 Regression] ICE in pp_string, at pretty-print.c:955

2016-09-24 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77719

kugan at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kugan at gcc dot gnu.org

--- Comment #5 from kugan at gcc dot gnu.org ---
(In reply to Joost VandeVondele from comment #0)
> recent trunk regression:
> 
> > cat bug.f90
> SUBROUTINE urep_egr(erep,derep,surr)
>   INTEGER, PARAMETER :: dp=8
>   REAL(dp), INTENT(inout)  :: erep, derep(3)
>   REAL(dp), INTENT(in) :: surr(2)
>   REAL(dp) :: de_z, rz
>   IF (n_urpoly > 0) THEN
> IF (r < spxr(1,1)) THEN
>   ispg: DO isp = 1,spdim ! condition ca)
> IF (isp /= spdim) THEN
>   nsp = 5 ! condition cb
>   DO jsp = 0,nsp
> IF( jsp <= 3 ) THEN
> ELSE
>   erep = erep + surr(jsp-3)*rz**(jsp)
> ENDIF
>   END DO
> END IF
>   END DO ispg
> END IF
>   END IF
> END SUBROUTINE urep_egr
> 
> > gfortran  -c -O3 -ffast-math bug.f90
> [...]
> in pp_string, at pretty-print.c:955
> 0x14506c6 pp_string
>   ../../gcc/gcc/pretty-print.c:955
> 0x14506c6 pp_string(pretty_printer*, char const*)
>   ../../gcc/gcc/pretty-print.c:953
> 0x14514e9 pp_format(pretty_printer*, text_info*)
>   ../../gcc/gcc/pretty-print.c:597
> 0x14445f1 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
>   ../../gcc/gcc/diagnostic.c:941
> 0x1444e48 diagnostic_impl
>   ../../gcc/gcc/diagnostic.c:1064
> 0x1444f74 internal_error(char const*, ...)
>   ../../gcc/gcc/diagnostic.c:1349
> 0x9130f8 gimple_check_failed(gimple const*, char const*, int, char const*,
> gimple_code, tree_code)
>   ../../gcc/gcc/gimple.c:1177
> 0xd992d7 GIMPLE_CHECK2
>   ../../gcc/gcc/gimple.h:73
> 0xd8a037 gimple_phi_arg
>   ../../gcc/gcc/tree-phinodes.h:37
> 0xd8a037 gimple_phi_arg_imm_use_ptr
>   ../../gcc/gcc/tree-phinodes.h:37
> 0xd8a037 op_iter_next_use
>   ../../gcc/gcc/ssa-iterators.h:490
> 0xd8a037 link_use_stmts_after
>   ../../gcc/gcc/ssa-iterators.h:902
> 0xd8a037 next_imm_use_stmt
>   ../../gcc/gcc/ssa-iterators.h:955
> 0xd8a037 make_new_ssa_for_def
>   ../../gcc/gcc/tree-ssa-reassoc.c:1167
> 0xd8d908 make_new_ssa_for_all_defs
>   ../../gcc/gcc/tree-ssa-reassoc.c:1194
> 0xd8d908 zero_one_operation
>   ../../gcc/gcc/tree-ssa-reassoc.c:1338
> 0xd95430 undistribute_ops_list
>   ../../gcc/gcc/tree-ssa-reassoc.c:1684
> 0xd96178 reassociate_bb
>   ../../gcc/gcc/tree-ssa-reassoc.c:5393
> 0xd95fa7 reassociate_bb
>   ../../gcc/gcc/tree-ssa-reassoc.c:5528
> 0xd95fa7 reassociate_bb
>   ../../gcc/gcc/tree-ssa-reassoc.c:5528
> Please submit a full bug report,
> 
> > gfortran -v
> Using built-in specs.
> COLLECT_GCC=gfortran
> COLLECT_LTO_WRAPPER=/data/vjoost/gnu/gcc_trunk/install/libexec/gcc/x86_64-pc-
> linux-gnu/7.0.0/lto-wrapper
> Target: x86_64-pc-linux-gnu
> Configured with: ../gcc/configure
> --prefix=/data/vjoost/gnu/gcc_trunk/install --enable-languages=c,c++,fortran
> --disable-multilib --enable-plugins --enable-lto --disable-bootstrap
> Thread model: posix
> gcc version 7.0.0 20160924 (experimental) [trunk revision 240461] (GCC)

Sorry for the breakage. Sent a patch to fix this at
https://gcc.gnu.org/ml/gcc-patches/2016-09/msg01760.html.

[Bug libstdc++/77726] New: On MinGW targets, user-defined `operator delete(void *)` is not called if the sized-deallocation version is not provided in C++14 mode when libstdc++ is linked dynamically

2016-09-24 Thread lh_mouse at 126 dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77726

Bug ID: 77726
   Summary: On MinGW targets, user-defined `operator delete(void
*)` is not called if the sized-deallocation version is
not provided in C++14 mode when libstdc++ is linked
dynamically
   Product: gcc
   Version: 6.2.1
Status: UNCONFIRMED
  Severity: major
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: lh_mouse at 126 dot com
  Target Milestone: ---

Testcase:



E:\Desktop>cat test.cc
void *operator new(__SIZE_TYPE__ cb){
auto p = __builtin_malloc(cb);
__builtin_printf("%s: %p\n", __PRETTY_FUNCTION__, p);
return p;
}
void operator delete(void *p) noexcept {
__builtin_printf("%s: %p\n", __PRETTY_FUNCTION__, p);
__builtin_free(p);
}
#if 0
void operator delete(void *p, __SIZE_TYPE__ cb) noexcept {
__builtin_printf("%s: %p, %lu\n", __PRETTY_FUNCTION__, p, (unsigned
long)cb);
__builtin_free(p);
}
#endif
int main(){
delete new int;
}

E:\Desktop>g++ test.cc -std=c++14 -Wall -Wextra -pedantic
test.cc:6:6: warning: the program should also define 'void operator
delete(void*, unsigned int)' [-Wsized-deallocation]
 void operator delete(void *p) noexcept {
  ^~~~

E:\Desktop>a.exe
void* operator new(unsigned int): 003F6FA0

E:\Desktop>g++ test.cc -std=c++14 -Wall -Wextra -pedantic -static
test.cc:6:6: warning: the program should also define 'void operator
delete(void*, unsigned int)' [-Wsized-deallocation]
 void operator delete(void *p) noexcept {
  ^~~~

E:\Desktop>a.exe
void* operator new(unsigned int): 007C6CF8
void operator delete(void*): 007C6CF8

E:\Desktop>g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=C:/MinGW/MSYS2/mingw32/lib/gcc/i686-w64-mingw32/6.2.1/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../gcc/configure --prefix=/mingw32
--with-local-prefix=/mingw32/local --build=i686-w64-mingw32
--host=i686-w64-mingw32 --target=i686-w64-mingw32
--with-native-system-header-dir=/mingw
32/i686-w64-mingw32/include --libexecdir=/mingw32/lib --enable-bootstrap
--with-arch=i686 --with-tune=generic --enable-languages=c,lto,c++
--enable-shared --enable-static --enable-libatomic --enable-t
hreads=mcf --enable-graphite --enable-fully-dynamic-string
--enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug
--disable-isl-version-check --enable-lto --enable-libgomp --dis
able-multilib --enable-checking=release --disable-rpath
--disable-win32-registry --disable-nls --disable-werror --disable-symvers
--with-libiconv --with-system-zlib --with-gmp=/mingw32 --with-mpfr=/mi
ngw32 --with-mpc=/mingw32 --with-isl=/mingw32 --with-pkgversion='gcc-6-branch
HEAD with MCF thread model, built by LH_Mouse.'
--with-bugurl=http://github.lhmouse.com/ --with-gnu-as --with-gnu-ld --dis
able-tls --disable-sjlj-exceptions --with-dwarf2
Thread model: mcf
gcc version 6.2.1 20160924 (gcc-6-branch HEAD with MCF thread model, built by
LH_Mouse.)

[Bug c++/77725] New: An example from the standard regarding member lookup fails to compile

2016-09-24 Thread ilaizi at microsoft dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77725

Bug ID: 77725
   Summary: An example from the standard regarding member lookup
fails to compile
   Product: gcc
   Version: 6.1.0
Status: UNCONFIRMED
  Severity: major
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ilaizi at microsoft dot com
  Target Milestone: ---

Example of valid code from the standard (10.2.7 Member name lookup
[class.member.lookup])

compiled with command: "g++ -std=c++11 main.cpp && ./a.out" on Linux

compiler version:
g++ (GCC) 6.1.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
===
struct A { int x; };// S(x,A) = { { A::x }, { A } }
struct B { float x; };  // S(x,B) = { { B::x }, { B } }
struct C: public A, public B { };   // S(x,C) = { invalid, { A in C, B in C
} }
struct D: public virtual C { }; // S(x,D) = S(x,C)
struct E: public virtual C { char x; }; // S(x,E) = { { E::x }, { E } }
struct F: public D, public E { };   // S(x,F) = S(x,E)

int main() 
{
   F f;
   f.x = 0; // OK, lookup finds E::x
}
===
Error message:

main.cpp: In function 'int main()':
main.cpp:11:6: error: request for member 'x' is ambiguous
f.x = 0; // OK, lookup finds E::x
  ^
main.cpp:2:18: note: candidates are: float B::x
 struct B { float x; };  // S(x,B) = { { B::x }, { B } }
  ^
main.cpp:1:16: note: int A::x
 struct A { int x; };// S(x,A) = { { A::x }, { A } }
^

[Bug target/53659] ARM: Using -mcpu=cortex-a9 option results in bad performance for Cortex-A9 processor in C-Ray phoronix benchmark

2016-09-24 Thread tulipawn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53659

--- Comment #6 from PeteVine  ---
Testing different 32-bit codegen options in aarch32 mode on a Cortex A53, shows
A15 is probably also affected. Full comparison below:

$ for i in 8 5 7 9 15 ; do gcc -marm -Ofast -o c-ray-a$i c-ray-mt.c -lm 
-lpthread -mcpu=cortex-a$i; done
$ for i in 8 5 7 9 15 ; do echo Cortex-A$i  ; ./c-ray-a$i -t 32 -s 160x120 -r 8
-i sphfract -o output.ppm ; done

Cortex-A8
c-ray-mt v1.1
Rendering took: 1 seconds (1660 milliseconds)
Cortex-A5
c-ray-mt v1.1
Rendering took: 1 seconds (1638 milliseconds)
Cortex-A7
c-ray-mt v1.1
Rendering took: 1 seconds (1645 milliseconds)
Cortex-A9
c-ray-mt v1.1
Rendering took: 2 seconds (2027 milliseconds)
Cortex-A15
c-ray-mt v1.1
Rendering took: 1 seconds (1922 milliseconds)

[Bug ipa/60674] missed devirtualization in function called by destructor

2016-09-24 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60674

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug target/60563] FAIL: g++.dg/ext/sync-4.C on *-apple-darwin*

2016-09-24 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60563

Dominique d'Humieres  changed:

   What|Removed |Added

 CC||mrs at gcc dot gnu.org

--- Comment #12 from Dominique d'Humieres  ---
> Filed radr://19802258 and uploaded a standalone test case for the darwin
> linker developer to debug with.

No progress after more than two years and a half. Is there any objection to
submit the following patch?

--- ../_clean/gcc/testsuite/g++.dg/ext/sync-4.C 2015-04-30 23:36:40.0
+0200
+++ gcc/testsuite/g++.dg/ext/sync-4.C   2016-09-24 17:48:44.0 +0200
@@ -2,6 +2,8 @@
 /* { dg-require-effective-target sync_long_long_runtime } */
 /* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
 /* { dg-additional-options "-march=pentium" { target { { i?86-*-* x86_64-*-* }
&& ia32 } } } */
+/* FIXME The following additional option should be removed after the fix for
radr://19802258.
+/* { dg-additional-options "-fno-align-functions" { target { *-*-darwin* } } }
*/

 /* Verify that the builtin functions are correctly marked as trapping
when using -fnon-call-exceptions.  */

[Bug tree-optimization/77724] [7 Regression] bootstrap-O3 broken: ICE: in tree_to_uhwi, at tree.c:7330

2016-09-24 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77724

Markus Trippelsdorf  changed:

   What|Removed |Added

 CC||amker at gcc dot gnu.org

--- Comment #2 from Markus Trippelsdorf  ---
Started with r240412:

commit 2227160d6674e3e822a8d74c2d24452e3dc7eea1
Author: amker 
Date:   Fri Sep 23 09:47:52 2016 +

* tree-vect-loop-manip.c (create_intersect_range_checks_index):
New.
(create_intersect_range_checks): New.
(vect_create_cond_for_alias_checks): Call above function.

[Bug tree-optimization/77724] [7 Regression] bootstrap-O3 broken: ICE: in tree_to_uhwi, at tree.c:7330

2016-09-24 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77724

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-09-24
 Ever confirmed|0   |1

--- Comment #1 from Markus Trippelsdorf  ---
Cleaned up testcase:

int a[81];
int b, c;
void fn1() {
  int d = b;
  for (; c; --c)
a[c + d] = a[c];
}

[Bug tree-optimization/77724] [7 Regression] bootstrap-O3 broken: ICE: in tree_to_uhwi, at tree.c:7330

2016-09-24 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77724

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||build, ice-on-valid-code
   Target Milestone|--- |7.0

[Bug tree-optimization/77724] New: [7 Regression] bootstrap-O3 broken: ICE: in tree_to_uhwi, at tree.c:7330

2016-09-24 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77724

Bug ID: 77724
   Summary: [7 Regression] bootstrap-O3 broken: ICE: in
tree_to_uhwi, at tree.c:7330
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: trippels at gcc dot gnu.org
  Target Milestone: ---

markus@x4 libquadmath % cat strtoflt128.i
int a[81];
int b, c;
__float128 fn1(nptr, endptr, group) int nptr;
int endptr;
int group;
{
  int d = b;
  for (; c; --c)
a[c + d] = a[c];
  return 0;
}

markus@x4 libquadmath % gcc -O3 -c strtoflt128.i
strtoflt128.i: In function ‘fn1’:
strtoflt128.i:3:12: internal compiler error: in tree_to_uhwi, at tree.c:7330
 __float128 fn1(nptr, endptr, group) int nptr;
^~~
0xe5f30a tree_to_uhwi(tree_node const*)
../../gcc/gcc/tree.c:7330
0xe204a6 create_intersect_range_checks_index
../../gcc/gcc/tree-vect-loop-manip.c:2313
0xe204a6 create_intersect_range_checks
../../gcc/gcc/tree-vect-loop-manip.c:2412
0xe204a6 vect_create_cond_for_alias_checks(_loop_vec_info*, tree_node**)
../../gcc/gcc/tree-vect-loop-manip.c:2500
0xe21b62 vect_loop_versioning(_loop_vec_info*, unsigned int, bool)
../../gcc/gcc/tree-vect-loop-manip.c:2574
0xe11107 vect_transform_loop(_loop_vec_info*)
../../gcc/gcc/tree-vect-loop.c:6780
0xe311e4 vectorize_loops()
../../gcc/gcc/tree-vectorizer.c:585
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug rtl-optimization/77714] Wrong code generation for gcc.c-torture/execute/pr51447.c

2016-09-24 Thread edlinger at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77714

Bernd Edlinger  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-09-24
 Ever confirmed|0   |1

--- Comment #2 from Bernd Edlinger  ---
Maybe you can try this:

Index: lra-eliminations.c
===
--- lra-eliminations.c  (revision 240437)
+++ lra-eliminations.c  (working copy)
@@ -973,11 +973,11 @@
   up.  */
validate_change (insn, &SET_SRC (old_set), src, 1);
validate_change (insn, &SET_DEST (old_set),
-ep->from_rtx, 1);
+ep->to_rtx, 1);
if (! apply_change_group ())
  {
SET_SRC (old_set) = src;
-   SET_DEST (old_set) = ep->from_rtx;
+   SET_DEST (old_set) = ep->to_rtx;
  }
lra_update_insn_recog_data (insn);
/* Add offset note for future updates.  */

[Bug tree-optimization/61171] vectorization fails for a reduction in presence of subtraction

2016-09-24 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61171

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug target/61064] ARM G++ compiler mis-optimizes safe Abs function

2016-09-24 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61064

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #2 from Andrew Pinski  ---
No feedback in over 2 years so closing as invalid.

[Bug tree-optimization/60888] x86 vector widen multiplication by constant is not replaced with shift and sub

2016-09-24 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60888

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug target/60880] Wrong assert in promote_duplicated_reg in i386.c

2016-09-24 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60880

--- Comment #1 from Andrew Pinski  ---
Has this been fixed?

[Bug target/60889] -Os generate much bigger code

2016-09-24 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60889

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization
 Target||x86_64-*-*
  Component|middle-end  |target

--- Comment #1 from Andrew Pinski  ---
There are now different parameters for SRA if defined but I don't think the x86
back-end defines them.

[Bug preprocessor/77723] New: Macro counts each element within brace-initialization as argument to macro

2016-09-24 Thread jamespharvey20 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77723

Bug ID: 77723
   Summary: Macro counts each element within brace-initialization
as argument to macro
   Product: gcc
   Version: 6.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: preprocessor
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jamespharvey20 at gmail dot com
  Target Milestone: ---

[test.cpp]
--
#define MAC(arg) arg

class foo {
   public:
  foo(int a, int b) { };
};

int main() {
   foo x = MAC(foo(1,2));
   foo y = MAC((foo{1,2}));
   foo z = MAC(foo{1,2});
}
--

$ g++ -std=c++11 test.cpp
test.cpp:11:25: error: macro "MAC" passed 2 arguments, but takes just 1
foo z = MAC(foo{5, 7});
 ^
test.cpp: In function ‘int main()’:
test.cpp:11:12: error: ‘MAC’ was not declared in this scope
foo z = MAC(foo{5, 7});
^~~

Note the brace-initialization on y and z.  The preprocessor appears to know to
not count commas within parentheses, but appears to count them within
brace-initialization.

Note y compiles because of the additional parentheses that encapsulate the
construction.

I saw a stackoverflow comment where someone said this is caused because the
preprocessor standard was never updated after c++11's brace-initialization, and
isn't aware of whether c++ or c++11 is even being used, so this is a standards
issue rather than a compiler issue.  I write for two reasons.

First, I hope that is wrong, or even if correct, that g++ would fix this.  The
additional parentheses prevents a macro from performing expression
decomposition, such as within catch (the unit test framework) or lest (another
unit test framework), which uses a macro with an argument of an expression, and
is able to output both the text of the expression, and the expression with the
values substituted in.  With the parentheses, it sees the whole argument as
either true or false, not looking inside.

Second, if g++ won't fix unless the standard is updated, clang++ gives a
helpful note that g++ doesn't, as shown below, which would be nice to add to
g++.



FWIW, clang++ also compiles x and y, but fails on z.  BUT, it at least gives a
helpful note that g++ doesn't:

$ clang++ -std=c++11 test.cpp
test.cpp:11:23: error: too many arguments provided to function-like macro
invocation
   foo z = MAC(foo{5, 7});
  ^
test.cpp:1:9: note: macro 'MAC' defined here
#define MAC(arg) arg
^
test.cpp:11:12: note: parentheses are required around macro argument containing
braced initializer list
   foo z = MAC(foo{5, 7});
   ^
   ()

[Bug c++/77722] New: -fsanitize=undefined doesn't give runtime error in function without return value, unless at least 2 instructions

2016-09-24 Thread jamespharvey20 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77722

Bug ID: 77722
   Summary: -fsanitize=undefined doesn't give runtime error in
function without return value, unless at least 2
instructions
   Product: gcc
   Version: 6.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jamespharvey20 at gmail dot com
  Target Milestone: ---

[test.cpp]
--
int func() {
}
int main() {
   func();
}
--

$ g++ test.cpp -fsanitize=undefined -O0
$ ./a.out
(No runtime error)

--
int func() {
   int a = 5;
}
--

$ ./a.out
(No runtime error)

--
int func() {
   int a = 5;
   int b = 5;
}
--

$ ./a.out
test.cpp:1:5: runtime error: execution reached the end of a value-returning
function without returning a value

I'm not sure what (if any) relation there is in the gcc to clang fsanitize
code.  But, clang 3.8.1's fsanitize=undefined gives a runtime error on all 3
above versions of func().

As a note, -Wreturn-type does issue a warning even for an empty version of
func(), so it does catch the situation, but fsanitize=undefined does not.

[Bug middle-end/77721] New: -Wformat-length not uses arg range for converted vars

2016-09-24 Thread dimhen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77721

Bug ID: 77721
   Summary: -Wformat-length not uses arg range for converted vars
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dimhen at gmail dot com
  Target Milestone: ---

gcc version 7.0.0 20160922 (experimental) [trunk revision 240342] (GCC)

no warns in foo() but warns in bar()

$ cat x.c
int snprintf (char*, __SIZE_TYPE__, const char*, ...);

void foo(unsigned j, char *p)
{
if(j > 999)
return;
snprintf(p, 4, "%3u", j);
}

void bar(int j, char *p)
{
const unsigned k = (unsigned) j;
if(k > 999)
return;
snprintf(p, 4, "%3u", k);
}

$ gcc -Wall -c -O2 x.c
x.c: In function ‘bar’:
x.c:15:21: warning: ‘%3u’ directive output may be truncated writing between 3
and 10 bytes into a region of size 4 [-Wformat-length=]
 snprintf(p, 4, "%3u", k);
 ^~~
x.c:15:20: note: directive argument in the range [0u, 4294967295u]
 snprintf(p, 4, "%3u", k);
^
x.c:15:5: note: format output between 4 and 11 bytes into a destination of size
4
 snprintf(p, 4, "%3u", k);
 ^~~~

[Bug middle-end/77720] New: -Wformat-length= wit -O3 emit warning twice with incorrect linenumbers

2016-09-24 Thread dimhen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77720

Bug ID: 77720
   Summary: -Wformat-length= wit -O3 emit warning twice with
incorrect linenumbers
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dimhen at gmail dot com
  Target Milestone: ---

gcc version 7.0.0 20160922 (experimental) [trunk revision 240342] (GCC) 

-O2 : warning for baz()
-O3 : warning for bar() and baz() but lineno twice points to baz()

$ cat x.c
int snprintf (char*, __SIZE_TYPE__, const char*, ...);

void foo(unsigned j, char *p)
{
if(j > 999)
return;
snprintf(p, 4, "%3d", j);
}

void bar(int j, char *p)
{
const unsigned k = (unsigned) j;
if(k > 999)
return;
snprintf(p, 4, "%3u", k);
}

void baz(int j, char *p)
{
if((unsigned)j > 999)
return;
snprintf(p, 4, "%3u", (unsigned)j);
}

$ gcc -Wall -c -O2 x.c
x.c: In function ‘baz’:
x.c:22:21: warning: ‘%3u’ directive output may be truncated writing between 3
and 10 bytes into a region of size 4 [-Wformat-length=]
 snprintf(p, 4, "%3u", (unsigned)j);
 ^~~
x.c:22:20: note: directive argument in the range [0u, 4294967295u]
 snprintf(p, 4, "%3u", (unsigned)j);
^
x.c:22:5: note: format output between 4 and 11 bytes into a destination of size
4
 snprintf(p, 4, "%3u", (unsigned)j);
 ^~

$ gcc -Wall -c -O3 x.c
x.c: In function ‘bar’:
x.c:22:21: warning: ‘%3u’ directive output may be truncated writing between 3
and 10 bytes into a region of size 4 [-Wformat-length=]
 snprintf(p, 4, "%3u", (unsigned)j);
 ^~~
x.c:22:20: note: directive argument in the range [0u, 4294967295u]
 snprintf(p, 4, "%3u", (unsigned)j);
^
x.c:22:5: note: format output between 4 and 11 bytes into a destination of size
4
 snprintf(p, 4, "%3u", (unsigned)j);
 ^~
x.c: In function ‘baz’:
x.c:22:21: warning: ‘%3u’ directive output may be truncated writing between 3
and 10 bytes into a region of size 4 [-Wformat-length=]
 snprintf(p, 4, "%3u", (unsigned)j);
 ^~~
x.c:22:20: note: directive argument in the range [0u, 4294967295u]
 snprintf(p, 4, "%3u", (unsigned)j);
^
x.c:22:5: note: format output between 4 and 11 bytes into a destination of size
4
 snprintf(p, 4, "%3u", (unsigned)j);
 ^~

[Bug tree-optimization/77719] [7 Regression] ICE in pp_string, at pretty-print.c:955

2016-09-24 Thread Joost.VandeVondele at mat dot ethz.ch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77719

--- Comment #4 from Joost VandeVondele  
---
(In reply to Dominique d'Humieres from comment #3)
> I
> don't think the code is valid: spdim is an implicit real used uninitialized.

yeah, auto-reduced from valid code.

but thanks for confirming, BTW!

[Bug tree-optimization/77719] [7 Regression] ICE in pp_string, at pretty-print.c:955

2016-09-24 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77719

Dominique d'Humieres  changed:

   What|Removed |Added

   Priority|P4  |P3

--- Comment #3 from Dominique d'Humieres  ---
> why P4, it is a middle end bug on valid code ?

Too much time spent on gfortran regressions, reset to P3! BTW as such I don't
think the code is valid: spdim is an implicit real used uninitialized.

[Bug tree-optimization/77719] [7 Regression] ICE in pp_string, at pretty-print.c:955

2016-09-24 Thread Joost.VandeVondele at mat dot ethz.ch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77719

Joost VandeVondele  changed:

   What|Removed |Added

 CC||Joost.VandeVondele at mat dot 
ethz
   ||.ch

--- Comment #2 from Joost VandeVondele  
---
why P4, it is a middle end bug on valid code ?

[Bug tree-optimization/77719] [7 Regression] ICE in pp_string, at pretty-print.c:955

2016-09-24 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77719

Dominique d'Humieres  changed:

   What|Removed |Added

   Priority|P3  |P4
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-09-24
 Ever confirmed|0   |1

--- Comment #1 from Dominique d'Humieres  ---
Revision r240271 is OK, r240403 gives the ICE.

[Bug c/77490] bit-not (~) on boolean should be warned about

2016-09-24 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77490

Marek Polacek  changed:

   What|Removed |Added

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

--- Comment #4 from Marek Polacek  ---
Done.

[Bug c/77490] bit-not (~) on boolean should be warned about

2016-09-24 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77490

--- Comment #3 from Marek Polacek  ---
Author: mpolacek
Date: Sat Sep 24 09:39:23 2016
New Revision: 240462

URL: https://gcc.gnu.org/viewcvs?rev=240462&root=gcc&view=rev
Log:
PR c/77490
* c.opt (Wbool-operation): New.

* c-typeck.c (build_unary_op): Warn about bit not on expressions that
have boolean value.  Warn about ++/-- on booleans.

* typeck.c (cp_build_unary_op): Warn about bit not on expressions that
have boolean value.

* doc/invoke.texi: Document -Wbool-operation.

* c-c++-common/Wbool-operation-1.c: New test.
* gcc.dg/Wbool-operation-1.c: New test.

Added:
trunk/gcc/testsuite/c-c++-common/Wbool-operation-1.c
trunk/gcc/testsuite/gcc.dg/Wbool-operation-1.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c.opt
trunk/gcc/c/ChangeLog
trunk/gcc/c/c-typeck.c
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/typeck.c
trunk/gcc/doc/invoke.texi
trunk/gcc/testsuite/ChangeLog

[Bug tree-optimization/77719] New: [7 Regression] ICE in pp_string, at pretty-print.c:955

2016-09-24 Thread Joost.VandeVondele at mat dot ethz.ch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77719

Bug ID: 77719
   Summary: [7 Regression] ICE in pp_string, at pretty-print.c:955
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: Joost.VandeVondele at mat dot ethz.ch
  Target Milestone: ---

recent trunk regression:

> cat bug.f90
SUBROUTINE urep_egr(erep,derep,surr)
  INTEGER, PARAMETER :: dp=8
  REAL(dp), INTENT(inout)  :: erep, derep(3)
  REAL(dp), INTENT(in) :: surr(2)
  REAL(dp) :: de_z, rz
  IF (n_urpoly > 0) THEN
IF (r < spxr(1,1)) THEN
  ispg: DO isp = 1,spdim ! condition ca)
IF (isp /= spdim) THEN
  nsp = 5 ! condition cb
  DO jsp = 0,nsp
IF( jsp <= 3 ) THEN
ELSE
  erep = erep + surr(jsp-3)*rz**(jsp)
ENDIF
  END DO
END IF
  END DO ispg
END IF
  END IF
END SUBROUTINE urep_egr

> gfortran  -c -O3 -ffast-math bug.f90
[...]
in pp_string, at pretty-print.c:955
0x14506c6 pp_string
../../gcc/gcc/pretty-print.c:955
0x14506c6 pp_string(pretty_printer*, char const*)
../../gcc/gcc/pretty-print.c:953
0x14514e9 pp_format(pretty_printer*, text_info*)
../../gcc/gcc/pretty-print.c:597
0x14445f1 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
../../gcc/gcc/diagnostic.c:941
0x1444e48 diagnostic_impl
../../gcc/gcc/diagnostic.c:1064
0x1444f74 internal_error(char const*, ...)
../../gcc/gcc/diagnostic.c:1349
0x9130f8 gimple_check_failed(gimple const*, char const*, int, char const*,
gimple_code, tree_code)
../../gcc/gcc/gimple.c:1177
0xd992d7 GIMPLE_CHECK2
../../gcc/gcc/gimple.h:73
0xd8a037 gimple_phi_arg
../../gcc/gcc/tree-phinodes.h:37
0xd8a037 gimple_phi_arg_imm_use_ptr
../../gcc/gcc/tree-phinodes.h:37
0xd8a037 op_iter_next_use
../../gcc/gcc/ssa-iterators.h:490
0xd8a037 link_use_stmts_after
../../gcc/gcc/ssa-iterators.h:902
0xd8a037 next_imm_use_stmt
../../gcc/gcc/ssa-iterators.h:955
0xd8a037 make_new_ssa_for_def
../../gcc/gcc/tree-ssa-reassoc.c:1167
0xd8d908 make_new_ssa_for_all_defs
../../gcc/gcc/tree-ssa-reassoc.c:1194
0xd8d908 zero_one_operation
../../gcc/gcc/tree-ssa-reassoc.c:1338
0xd95430 undistribute_ops_list
../../gcc/gcc/tree-ssa-reassoc.c:1684
0xd96178 reassociate_bb
../../gcc/gcc/tree-ssa-reassoc.c:5393
0xd95fa7 reassociate_bb
../../gcc/gcc/tree-ssa-reassoc.c:5528
0xd95fa7 reassociate_bb
../../gcc/gcc/tree-ssa-reassoc.c:5528
Please submit a full bug report,

> gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/data/vjoost/gnu/gcc_trunk/install/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/data/vjoost/gnu/gcc_trunk/install
--enable-languages=c,c++,fortran --disable-multilib --enable-plugins
--enable-lto --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160924 (experimental) [trunk revision 240461] (GCC)

[Bug fortran/77694] ICE in optimize_binop_array_assignment, at fortran/frontend-passes.c:1080

2016-09-24 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77694

Thomas Koenig  changed:

   What|Removed |Added

 CC||tkoenig at gcc dot gnu.org

--- Comment #4 from Thomas Koenig  ---
Hi Steve,

> Index: frontend-passes.c
> ===
> --- frontend-passes.c (revision 240220)
> +++ frontend-passes.c (working copy)
> @@ -1076,6 +1076,9 @@ optimize_binop_array_assignment (gfc_cod
>  {
>gfc_expr *e;
>  
> +  if (!*rhs)
> +return false;
> +
>e = *rhs;
>if (e->expr_type == EXPR_OP)
>  {

OK for trunk (alternatively, obvious :-).

Thanks!