[Bug tree-optimization/81165] New: Regression in GCC-8.0.0's optimizer

2017-06-21 Thread ishiura-compiler at ml dot kwansei.ac.jp
|
| .p2align 4,,10  |   |
| .p2align 3  |   |
|.L10:|   |
| .cfi_restore_state  |   |
| ud2 |   |
| .p2align 4,,10  |   |
| .p2align 3  |   |
|.L7: |   |
| movl $2, %ecx   |   |
| xorl %edi, %edi |   |
| movl $2, %r8d   |   |
| xorl %r9d, %r9d |   |
| jmp .L2 |   |
| .cfi_endproc|  .cfi_endproc |
| .section .text.un...|   |
| .cfi_startproc  |   | 
| .type func.cold.0, @f...|   | 
|func.cold.0: |   | 
|.L6: |   | 
| .cfi_def_cfa_offset 32  |   | 
| call abort  |   | 
| .cfi_endproc|   | 
|.LFE1:   |.LFE1: | 
| .text   |   | 
| .size func, .-func  |  .size  func, .-func  |
| .section .text.un...|   |
| .size func.cold.0, .-...|   |
|.LCOLDE0:|   |
| .text   |   |
|.LHOTE0: |   |
| .section .text.st...|  .section  .text.st...|
| .p2align 4,,15  |  .p2align 4,,15   |
| .globl main |  .globl  main |
+-+---+
| movl $1, %ebx   |  movl  $1, %ebx   |
| .p2align 4,,10  |  .p2align 4,,10   |
| .p2align 3  |  .p2align 3   |
|.L12:|.L14:  |
| xorl %eax, %eax |  xorl  %eax, %eax |
| call func   |  call  func   |
| subq $1, %rbx   |  subq  $1, %rbx   |
| jne .L12|  jne  .L14|
| xorl %eax, %eax |  xorl  %eax, %eax |
| popq %rbx   |  popq  %rbx   |
| .cfi_def_cfa_offset 8   |  .cfi_def_cfa_offset 8|
+-+---+
| .size x0, 2 |  .size  x0, 2 |
|x0:  |x0:|
| .value 15   |  .value  15   |
| .ident "GCC: (GNU) 8|  .ident  "GCC: (GNU) 7.0.1 ...|
| .section .note.GN...|  .section  .note.GN...|
+-+---+

$ gcc-8.0 -v
using built-in specs.
COLLECT_GCC=gcc-8.0
COLLECT_LTO_WRAPPER=/home/kota/opt/gcc-8.0/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
target: x86_64-pc-linux-gnu
configure woth: ../gcc/configure --prefix=/home/kota/opt/gcc
--program-suffix=-8.0 --disable-multilib --enable-languages=c
thred model: posix
gcc version 8.0.0 20170621 (experimental) (GCC) 

$ gcc-7.0.1 -v
using built-in specs.
COLLECT_GCC=gcc-7.0.1
COLLECT_LTO_WRAPPER=/home/kota/opt/gcc-7.0.1/libexec/gcc/x86_64-pc-linux-gnu/7.0.1/lto-wrapper
target: x86_64-pc-linux-gnu
configure woth: ../gcc/configure --prefix=/home/kota/opt/gcc
--program-suffix=-7.0.1 --disable-multilib --enable-languages=c
thred model: posix
gcc version 7.0.1 20170216 (experimental) (GCC)

[Bug c++/81147] [avr] C++ for -mmcu=atmega2560 doesn't do NRVO or RVO when class inherits from empty base

2017-06-21 Thread felipe at expertisesolutions dot com.br
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81147

--- Comment #1 from Felipe Magno de Almeida  ---
Forgot to mention that removing the inheritance of A and seq from parser_base
(leaving it without inheriting anything) does make NRVO and RVO work again.
Unfortunately not a workaround I can use.

[Bug target/80510] Optimize Power7/power8 Altivec load/stores

2017-06-21 Thread meissner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80510

--- Comment #7 from Michael Meissner  ---
Author: meissner
Date: Thu Jun 22 00:56:55 2017
New Revision: 249493

URL: https://gcc.gnu.org/viewcvs?rev=249493=gcc=rev
Log:
2017-06-21  Michael Meissner  

Back port from mainline
PR target/80510
* gcc.target/powerpc/pr80510-1.c: Restrict test to 64-bit until
32-bit support is added.  Change ITYPE size to 64-bit integer.
* gcc.target/powerpc/pr80510-2.c: Likewise.


Modified:
branches/gcc-6-branch/gcc/testsuite/ChangeLog
branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/pr80510-1.c
branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/pr80510-2.c

[Bug c++/81164] New: [7/8 Regression] ICE in inherited_ctor_binfo_1 when using virtual inheritance

2017-06-21 Thread egor.pugin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81164

Bug ID: 81164
   Summary: [7/8 Regression] ICE in inherited_ctor_binfo_1 when
using virtual inheritance
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: egor.pugin at gmail dot com
  Target Milestone: ---

struct A {};
struct B : virtual A {};
struct C : virtual A {};
struct D : B,C { using A::A; };

Code is not correct, but g++-7 and above gives an ICE.

main.cpp:4:8: internal compiler error: in inherited_ctor_binfo_1, at
cp/method.c:528
 struct D : B,C { using A::A; };

[Bug tree-optimization/81163] New: error: ‘snprintf’ output may be truncated before the last format character [-werror=format-truncation=] note: ‘snprintf’ output between 2 and 266 bytes into a destin

2017-06-21 Thread perfeitoan at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81163

Bug ID: 81163
   Summary: error: ‘snprintf’ output may be truncated before the
last format character [-werror=format-truncation=]
note: ‘snprintf’ output between 2 and 266 bytes into a
destination of size 255
   Product: gcc
   Version: 7.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: perfeitoan at hotmail dot com
  Target Milestone: ---

Using gcc 7.1.1 and compiling Linux kernel version 3.10.18 the file name
relay.c: 423: 30 gcc stops compiling with this error message.
Using other versions prior to version 5 and including compilation occurs
without problems.

Compilated  in system ARM 32Bits Nvidia Tegra Tk1

I am using an ARM 32 bit machine from Nvidia model TK1 and linux distribution
Arch ARM

Isn't work compile Kernel 3.10.18-21 with gcc 7.1  

Take a look the crash

CC kernel/relay.o > apper in version 3.10.18 -19 -20 and .21 too this code
 the Proble !!, isnt ja the code of archive relay.o
kernel/relay.c: In function ‘relay_create_buf_file’:
kernel/relay.c:423:30: error: ‘snprintf’ output may be truncated before the
last format character [-Werror=format-truncation=]
snprintf(tmpname, NAME_MAX, "%s%d", chan->base_filename, cpu);
^~
kernel/relay.c:423:2: note: ‘snprintf’ output between 2 and 266 bytes into a
destination of size 255
snprintf(tmpname, NAME_MAX, "%s%d", chan->base_filename, cpu);
^
cc1: all warnings being treated as errors
make[1]: *** [scripts/Makefile.build:309: kernel/relay.o] Error 1
make: *** [Makefile:807: kernel] Error 2
==> ERROR: A failure occurred in build().
Aborting...


follow my host configures:

gcc (GCC) 7.1.1 20170516
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

MACHINE --- Chormebook HP 14 G3 running and compile

Linux alarm 3.10.18-19-ARCH #1 SMP Sun Mar 19 14:34:27 CET 2017 armv7l
GNU/Linux

[Bug c++/66944] ICE on static thread_local member in class template

2017-06-21 Thread jason.vas.dias at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66944

--- Comment #7 from Jason Vas Dias  ---
And there is no workaround, really - one cannot initialize a 
C++ class object member of a static thread_local C++ template class object
member in one place, outside the class, and use that same object in a 
non-static member function of the template class,
and instantiate another instance of the same template (with different
parameters) in the same translation unit - re-declaration in each
using member function allows compilation to succeed, but just hides
the static class member, so you can't actually use the single initialized 
static member in a non-static member function. 

So you HAVE to access thread_local static class members ONLY through pointers ?
I will try this.

[Bug c++/66944] ICE on static thread_local member in class template

2017-06-21 Thread jason.vas.dias at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66944

--- Comment #6 from Jason Vas Dias  ---
(In reply to Jason Vas Dias from comment #5)
> It also happens with GCC 5.4.0 -

Also happens in GCC 6.3.0 .

[Bug target/80510] Optimize Power7/power8 Altivec load/stores

2017-06-21 Thread meissner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80510

--- Comment #6 from Michael Meissner  ---
Author: meissner
Date: Wed Jun 21 22:51:15 2017
New Revision: 249488

URL: https://gcc.gnu.org/viewcvs?rev=249488=gcc=rev
Log:
2017-06-21  Michael Meissner  

Back port from mainline
PR target/80510
* gcc.target/powerpc/pr80510-1.c: Restrict test to 64-bit until
32-bit support is added.  Change ITYPE size to 64-bit integer.
* gcc.target/powerpc/pr80510-2.c: Likewise.


Modified:
branches/gcc-7-branch/gcc/testsuite/ChangeLog
branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/pr80510-1.c
branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/pr80510-2.c

[Bug c++/66944] ICE on static thread_local member in class template

2017-06-21 Thread jason.vas.dias at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66944

Jason Vas Dias  changed:

   What|Removed |Added

 CC||jason.vas.dias at gmail dot com

--- Comment #5 from Jason Vas Dias  ---
Very glad to find this bug, enabling my sanity to be preserved .

It also happens with GCC 5.4.0 - and yes, re-declaring as
'static thread_local' in each member function that uses a
static thread_local class member object appears to be the only workaround - 

thanks!
I hope this is fixed in 7.1 ...

[Bug testsuite/80759] gcc.target/x86_64/abi/ms-sysv FAILs

2017-06-21 Thread daniel.santos at pobox dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80759

--- Comment #50 from Daniel Santos  ---
Created attachment 41605
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41605=edit
darwin fixup (on top of v6)

(In reply to r...@cebitec.uni-bielefeld.de from comment #49)
> 
> No worries at all: don't even think about this stuff before you're well
> again!

Thank you, but this is chronic and comes and goes.  The trend line seems to be
heading upward for the moment, however.

>[...]
> > In hopes of making your review easier, below is a delta between this new 
> > (v6)
> > patch set and your last posted patches.
> 
> The new patch works fine for me on both x86_64-pc-linux-gnu (as
> expected) and i386-pc-solaris2.12.
> 
> On x86_64-apple-darwin11.4.2, there are a couple of isues, some of which
> I'd already resolved before you posted the revised patch.
> 
> * Initially all tests SEGVed like this (e.g. with -p0 and compiled with -O2):
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x00010004664d in regs_to_mem ()
> 1: x/i $pc
> => 0x10004664d :   movaps %xmm6,(%rax)
> (gdb) where
> #0  0x00010004664d in regs_to_mem ()
> #1  0x0001000465df in do_test_body ()
> #2  0x00010002f227 in do_tests_ ()
> #3  0x0001000468e3 in main ()
> 
>   Here, %rax is 0x0.
> 
>   This happens because some setup happens between do_test_body0 and
>   do_test_body, and do_test_aligned jumps directly to do_test_body:
> 
> .globl _do_test_body0
> .no_dead_strip _do_test_body0
> _do_test_body0:
> movq_test_data@GOTPCREL(%rip), %rax
> 
> .globl _do_test_body
> _do_test_body:
> 
> # Save registers.
> lea (%rax), %rax
> call_regs_to_mem
> 
>   By that jump, you bypass the setup of %rax and make the test FAIL.  I
>   managed to avoid this by changing the jmp to do_test_body0 instead.
>   This gets me past this failure, and works on Linux/x86_64, too.
>   However, this makes the tests FAIL on Solaris/x86, supposedly due to
>   the -fomit-frame-pointer/-fno-omit-frame-pointer difference (though I
>   haven't looked more closely).

Thanks again for your help on this.  All of this asm is a big ABI hack and
presumes I'm working with 64-bit SystemV ABI, but apple's ABI appears to differ
somewhat (I've may have found a good description of that here:
https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/MachOTopics/1-Articles/x86_64_code.html).

My hope in declaring my own global symbol in the assembly and then explicitly
RET-ing was to bypass any ABI-specific setup and tear-down, most notably the
hard frame pointer.  In the case of Darwin, this doesn't appear to work since
the asm template instantiation of my "global + offset" seems to work quite
differently and wants to store the base address in a register that is already
being used for something else (actually, every register except XMM0-5 and
XMM16+ are volatile at this point).  I had expected it to generate something
akin to:

lea test_data + 224(%rip), %rax

It would be nice if the "naked" function attribute were available for the i386
back-end, then I wouldn't have to screw around with trying to hack-away the
ABI. (maybe a worthwhile future venture)

The attached patch (on top of v6) *might* solve the problem on Darwin, but I
don't understand exactly how GOTPCREL works, other than it's using a global
offset table for linking.  Hopefully, the linker can translate this directly
into a constant rip-rel offset.  What I'm doing here is that instead of feeding
addresses to the asm template, I'm giving in the offsets and schlepping
together an address operand from that, e.g.:

lea %p0 + test_data@GOTPCREL(%%rip), %%rax

Now if this fix *does* work, then I might need to investigate if this is a
performance problem for Darwin -- why use an extra instruction to copy the
address to a register before modifying it?  If it doesn't work then it's
probably because it really *needs* two instructions.  I'm curious what the
disassembly of the linked program looks like.

> 
> * With the do_test_body0 jump, I hit the next issue on Darwin with -O0:
>   the test SEGVs here:
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x000100031c4e in do_test_body0 ()
> at
> /vol/gcc/src/hg/trunk/solaris/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-
> sysv.c:163
> 163   __asm__ ("\n"
> 1: x/i $pc
> => 0x100031c4e :  mov%rax,0x2a8(%rdi)
> (gdb) where
> (gdb) p/x $rdi
> $1 = 0x5dc3340b214ef45c

Yeah, this won't work because the reality is that all GP registers are volatile
at this point, but gcc will generate code that clobbers them based upon the
alleged ABI of the function -- which is a lie. :)  If the attached patch
doesn't work, then I think it's best to just move the assembly back into
do-test.S and hard-code the offsets in a shared header file, so we can use them
as a macro from do-test.S and also check them with asserts in 

[Bug target/81151] -Wmaybe-uninitialized in insn-emit.c

2017-06-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81151

--- Comment #4 from Jakub Jelinek  ---
Author: jakub
Date: Wed Jun 21 22:23:16 2017
New Revision: 249484

URL: https://gcc.gnu.org/viewcvs?rev=249484=gcc=rev
Log:
PR target/81151
* config/i386/sse.md (round2): Renumber match_dup and
operands indexes to avoid gap between operands and match_dups.

Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/config/i386/sse.md

[Bug c++/81154] OpenMP with shared variable in a template class crash

2017-06-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81154

--- Comment #4 from Jakub Jelinek  ---
Author: jakub
Date: Wed Jun 21 22:22:05 2017
New Revision: 249483

URL: https://gcc.gnu.org/viewcvs?rev=249483=gcc=rev
Log:
PR c++/81154
* semantics.c (handle_omp_array_sections_1, finish_omp_clauses):
Complain about t not being a variable if t is OVERLOAD even
when processing_template_decl.

* g++.dg/gomp/pr81154.C: New test.

Added:
branches/gcc-7-branch/gcc/testsuite/g++.dg/gomp/pr81154.C
Modified:
branches/gcc-7-branch/gcc/cp/ChangeLog
branches/gcc-7-branch/gcc/cp/semantics.c
branches/gcc-7-branch/gcc/testsuite/ChangeLog

[Bug c++/81130] [6/7/8 Regression] ICE OpenMP shared clause in gimplify_var_or_parm_decl, at gimplify.c:2584

2017-06-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81130

--- Comment #4 from Jakub Jelinek  ---
Author: jakub
Date: Wed Jun 21 22:19:38 2017
New Revision: 249482

URL: https://gcc.gnu.org/viewcvs?rev=249482=gcc=rev
Log:
PR c++/81130
* gimplify.c (omp_add_variable): Don't force GOVD_SEEN for types
with ctors/dtors if GOVD_SHARED is set.

* testsuite/libgomp.c++/pr81130.C: New test.

Added:
branches/gcc-7-branch/libgomp/testsuite/libgomp.c++/pr81130.C
Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/gimplify.c
branches/gcc-7-branch/libgomp/ChangeLog

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

2017-06-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81121

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Wed Jun 21 22:18:34 2017
New Revision: 249481

URL: https://gcc.gnu.org/viewcvs?rev=249481=gcc=rev
Log:
Backported from mainline
2017-06-20  Jakub Jelinek  

PR target/81121
* config/i386/i386.md (TARGET_USE_VECTOR_CONVERTS float si->{sf,df}
splitter): Require TARGET_SSE2 in the condition.

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

Added:
branches/gcc-7-branch/gcc/testsuite/gcc.target/i386/pr81121.c
Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/config/i386/i386.md
branches/gcc-7-branch/gcc/testsuite/ChangeLog

[Bug sanitizer/81111] [8 Regression] Cannot build libstdc++ with -fsanitize=undefined

2017-06-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=8

--- Comment #7 from Jakub Jelinek  ---
Author: jakub
Date: Wed Jun 21 22:17:49 2017
New Revision: 249480

URL: https://gcc.gnu.org/viewcvs?rev=249480=gcc=rev
Log:
Backported from mainline
2017-06-20  Jakub Jelinek  

PR sanitizer/81125
* ubsan.h (ubsan_encode_value): Workaround buggy clang++ parser
by removing enum keyword.
(ubsan_type_descriptor): Likewise.  Formatting fix.

2017-06-19  Jakub Jelinek  

PR sanitizer/81125
* ubsan.h (enum ubsan_encode_value_phase): New.
(ubsan_encode_value): Change second argument to
enum ubsan_encode_value_phase with default value of
UBSAN_ENCODE_VALUE_GENERIC.
* ubsan.c (ubsan_encode_value): Change second argument to
enum ubsan_encode_value_phase PHASE from bool IN_EXPAND_P,
adjust uses, for UBSAN_ENCODE_VALUE_GENERIC use just
create_tmp_var_raw instead of create_tmp_var and use a
TARGET_EXPR.
(ubsan_expand_bounds_ifn, ubsan_build_overflow_builtin,
instrument_bool_enum_load, ubsan_instrument_float_cast): Adjust
ubsan_encode_value callers.

PR sanitizer/8
* ubsan.c (ubsan_encode_value): If current_function_decl is NULL,
use create_tmp_var_raw instead of create_tmp_var, mark it addressable
just by setting TREE_ADDRESSABLE on the result and use a TARGET_EXPR.

PR sanitizer/81125
* g++.dg/ubsan/pr81125.C: New test.

PR sanitizer/8
* g++.dg/ubsan/pr8.C: New test.

Added:
branches/gcc-7-branch/gcc/testsuite/g++.dg/ubsan/pr8.C
branches/gcc-7-branch/gcc/testsuite/g++.dg/ubsan/pr81125.C
Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/testsuite/ChangeLog
branches/gcc-7-branch/gcc/ubsan.c
branches/gcc-7-branch/gcc/ubsan.h

[Bug sanitizer/81125] [7/8 Regression] -fsanitize=undefined ICE

2017-06-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81125

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Wed Jun 21 22:17:49 2017
New Revision: 249480

URL: https://gcc.gnu.org/viewcvs?rev=249480=gcc=rev
Log:
Backported from mainline
2017-06-20  Jakub Jelinek  

PR sanitizer/81125
* ubsan.h (ubsan_encode_value): Workaround buggy clang++ parser
by removing enum keyword.
(ubsan_type_descriptor): Likewise.  Formatting fix.

2017-06-19  Jakub Jelinek  

PR sanitizer/81125
* ubsan.h (enum ubsan_encode_value_phase): New.
(ubsan_encode_value): Change second argument to
enum ubsan_encode_value_phase with default value of
UBSAN_ENCODE_VALUE_GENERIC.
* ubsan.c (ubsan_encode_value): Change second argument to
enum ubsan_encode_value_phase PHASE from bool IN_EXPAND_P,
adjust uses, for UBSAN_ENCODE_VALUE_GENERIC use just
create_tmp_var_raw instead of create_tmp_var and use a
TARGET_EXPR.
(ubsan_expand_bounds_ifn, ubsan_build_overflow_builtin,
instrument_bool_enum_load, ubsan_instrument_float_cast): Adjust
ubsan_encode_value callers.

PR sanitizer/8
* ubsan.c (ubsan_encode_value): If current_function_decl is NULL,
use create_tmp_var_raw instead of create_tmp_var, mark it addressable
just by setting TREE_ADDRESSABLE on the result and use a TARGET_EXPR.

PR sanitizer/81125
* g++.dg/ubsan/pr81125.C: New test.

PR sanitizer/8
* g++.dg/ubsan/pr8.C: New test.

Added:
branches/gcc-7-branch/gcc/testsuite/g++.dg/ubsan/pr8.C
branches/gcc-7-branch/gcc/testsuite/g++.dg/ubsan/pr81125.C
Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/testsuite/ChangeLog
branches/gcc-7-branch/gcc/ubsan.c
branches/gcc-7-branch/gcc/ubsan.h

[Bug sanitizer/80973] ICE with lambda and -fsanitize=undefined

2017-06-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80973

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Wed Jun 21 22:15:55 2017
New Revision: 249479

URL: https://gcc.gnu.org/viewcvs?rev=249479=gcc=rev
Log:
Backported from mainline
2017-06-13  Jakub Jelinek  

PR c++/80973
* cp-gimplify.c (cp_genericize_r): Don't instrument MEM_REF second
argument even if it has REFERENCE_TYPE.

* g++.dg/ubsan/pr80973.C: New test.

Added:
branches/gcc-7-branch/gcc/testsuite/g++.dg/ubsan/pr80973.C
Modified:
branches/gcc-7-branch/gcc/cp/ChangeLog
branches/gcc-7-branch/gcc/cp/cp-gimplify.c
branches/gcc-7-branch/gcc/testsuite/ChangeLog

[Bug c++/80984] [5/6/7 Regression] ICE with label/variable ambiguity

2017-06-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80984

--- Comment #4 from Jakub Jelinek  ---
Author: jakub
Date: Wed Jun 21 22:14:23 2017
New Revision: 249478

URL: https://gcc.gnu.org/viewcvs?rev=249478=gcc=rev
Log:
Backported from mainline
2017-06-13  Jakub Jelinek  

PR c++/80984
* cp-gimplify.c (cp_genericize): Only look for VAR_DECLs in
BLOCK_VARS (outer) chain.
(cxx_omp_const_qual_no_mutable): Likewise.

* g++.dg/opt/nrv18.C: New test.

Added:
branches/gcc-7-branch/gcc/testsuite/g++.dg/opt/nrv18.C
Modified:
branches/gcc-7-branch/gcc/cp/ChangeLog
branches/gcc-7-branch/gcc/cp/cp-gimplify.c
branches/gcc-7-branch/gcc/testsuite/ChangeLog

[Bug middle-end/81161] poor code concatenating bitfields

2017-06-21 Thread nathan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81161

--- Comment #3 from Nathan Sidwell  ---
similar but different.  Maybe same underlying optimization is needed.  I don't
know.

[Bug c/81156] GCC fails to compile a formula with tgmath.h

2017-06-21 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81156

--- Comment #1 from joseph at codesourcery dot com  ---
Different OSes (and sometimes different compilers) have different tgmath.h 
implementations.  Those implementations typically expand calls to tgmath.h 
macros to expansions that repeat their arguments many times.

You have sqrt(pow(sqrt(pow(.  In glibc's tgmath.h, pow expands to 
repeat each of its arguments 58 times, and sqrt repeats each of its 
arguments 57 times.  So you have 58*57*58*57 = 10929636 repetitions of 
each of the arguments to each of the inner pow calls, even before 
accounting for all of the other text in there, and all those tokens need 
to be generated and parsed even though most of it ends up getting folded 
away eventually.  I expect in principle your code could compile given 
enough memory and time, but "enough" might be very large.

Maybe I should implement __builtin_tgmath to allow macros that expand each 
argument once only, which is clearly best for such macros to allow deeply 
nested calls.  (My inclination is to prefer a smart __builtin_tgmath that 
can be used for all tgmath.h macros, instead of several dumber variants 
such as I previously suggested in projects/c-frontend.html; it would be 
desirable for it to be able to handle TS 18661-1 functions that round 
result to narrower type and TS 18661-3 types as well.  Such builtins would 
probably be necessary for implementing TS 18661-5 
__STDC_TGMATH_OPERATOR_EVALUATION__.)

[Bug tree-optimization/81162] New: UBSAN switch triggers incorrect optimization

2017-06-21 Thread babokin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81162

Bug ID: 81162
   Summary: UBSAN switch triggers incorrect optimization
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: babokin at gmail dot com
  Target Milestone: ---

gcc trunk rev249427, x86_64

In presence of -fsanitize=undefined optimisations (-O2) produce wrong code.

> cat f.cpp
#include 
short s;
int i1 = 1;
int i2 = 1;
unsigned char uc = 147;

int main() {
  s = (-uc + 2147483647) << 0;
  if (9031239389974324562ULL >= (-((i1 && i2) + uc) ^ -21096) ) {
printf("OK\n");
  } else {
printf("FAIL\n");
  }

  return 0;
}

> g++ -std=c++11 -fsanitize=undefined -O0 f.cpp -o out
> ./out
OK
> g++ -std=c++11 -fsanitize=undefined -O2 f.cpp -o out
> ./out
FAIL

[Bug target/79799] Improve vec_insert of float on Power9

2017-06-21 Thread meissner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79799

--- Comment #2 from Michael Meissner  ---
Note, the test fails on big endian systems.  It used the wrong test.

[Bug libstdc++/80940] [7/8 Regression] Private inheritance from std::ostream - compilation error for custom operator <

2017-06-21 Thread ville.voutilainen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80940

Ville Voutilainen  changed:

   What|Removed |Added

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

--- Comment #4 from Ville Voutilainen  ---
Fixed.

[Bug libstdc++/80675] Incorrect implementation of LWG 2534

2017-06-21 Thread ville.voutilainen at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80675

Ville Voutilainen  changed:

   What|Removed |Added

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

--- Comment #4 from Ville Voutilainen  ---
Fixed.

[Bug libstdc++/80675] Incorrect implementation of LWG 2534

2017-06-21 Thread ville at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80675

--- Comment #3 from ville at gcc dot gnu.org ---
Author: ville
Date: Wed Jun 21 21:09:46 2017
New Revision: 249471

URL: https://gcc.gnu.org/viewcvs?rev=249471=gcc=rev
Log:
PR libstdc++/80675, PR libstdc++/80940

Backport from mainline
2017-06-21  Ville Voutilainen  

PR libstdc++/80675
PR libstdc++/80940
* include/std/istream:
(__is_convertible_to_basic_istream_test(basic_istream<_Ch, _Up>*)): New.
(__do_is_convertible_to_basic_istream_impl): Likewise.
(__is_convertible_to_basic_istream_impl): Likewise.
(__is_convertible_to_basic_istream): Use the new base.
(__rvalue_istream_type): New.
(operator>>(_Istream&&, _Tp&&)): Use the new helper alias
for the SFINAE check, convert to the helper alias type before
doing the actual extraction.
* include/std/ostream:
(__is_convertible_to_basic_ostream_test(basic_ostream<_Ch, _Up>*)): New.
(__do_is_convertible_to_basic_ostream_impl): Likewise.
(__is_convertible_to_basic_ostream_impl): Likewise.
(__is_convertible_to_basic_ostream): Use the new base.
(__rvalue_ostream_type): New.
(operator<<(_Ostream&&, const _Tp&)): Use the new helper alias
for the SFINAE check, convert to the helper alias type before
doing the actual insertion.
* testsuite/27_io/rvalue_streams-2.cc: Add new tests.

Modified:
branches/gcc-7-branch/libstdc++-v3/ChangeLog
branches/gcc-7-branch/libstdc++-v3/include/std/istream
branches/gcc-7-branch/libstdc++-v3/include/std/ostream
branches/gcc-7-branch/libstdc++-v3/testsuite/27_io/rvalue_streams-2.cc

[Bug libstdc++/80940] [7/8 Regression] Private inheritance from std::ostream - compilation error for custom operator <

2017-06-21 Thread ville at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80940

--- Comment #3 from ville at gcc dot gnu.org ---
Author: ville
Date: Wed Jun 21 21:09:46 2017
New Revision: 249471

URL: https://gcc.gnu.org/viewcvs?rev=249471=gcc=rev
Log:
PR libstdc++/80675, PR libstdc++/80940

Backport from mainline
2017-06-21  Ville Voutilainen  

PR libstdc++/80675
PR libstdc++/80940
* include/std/istream:
(__is_convertible_to_basic_istream_test(basic_istream<_Ch, _Up>*)): New.
(__do_is_convertible_to_basic_istream_impl): Likewise.
(__is_convertible_to_basic_istream_impl): Likewise.
(__is_convertible_to_basic_istream): Use the new base.
(__rvalue_istream_type): New.
(operator>>(_Istream&&, _Tp&&)): Use the new helper alias
for the SFINAE check, convert to the helper alias type before
doing the actual extraction.
* include/std/ostream:
(__is_convertible_to_basic_ostream_test(basic_ostream<_Ch, _Up>*)): New.
(__do_is_convertible_to_basic_ostream_impl): Likewise.
(__is_convertible_to_basic_ostream_impl): Likewise.
(__is_convertible_to_basic_ostream): Use the new base.
(__rvalue_ostream_type): New.
(operator<<(_Ostream&&, const _Tp&)): Use the new helper alias
for the SFINAE check, convert to the helper alias type before
doing the actual insertion.
* testsuite/27_io/rvalue_streams-2.cc: Add new tests.

Modified:
branches/gcc-7-branch/libstdc++-v3/ChangeLog
branches/gcc-7-branch/libstdc++-v3/include/std/istream
branches/gcc-7-branch/libstdc++-v3/include/std/ostream
branches/gcc-7-branch/libstdc++-v3/testsuite/27_io/rvalue_streams-2.cc

[Bug target/80510] Optimize Power7/power8 Altivec load/stores

2017-06-21 Thread meissner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80510

--- Comment #5 from Michael Meissner  ---
Author: meissner
Date: Wed Jun 21 21:08:40 2017
New Revision: 249470

URL: https://gcc.gnu.org/viewcvs?rev=249470=gcc=rev
Log:
2017-06-21  Michael Meissner  

PR target/80510
* gcc.target/powerpc/pr80510-1.c: Restrict test to 64-bit until
32-bit support is added.  Change ITYPE size to 64-bit integer.
* gcc.target/powerpc/pr80510-2.c: Likewise.


Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.target/powerpc/pr80510-1.c
trunk/gcc/testsuite/gcc.target/powerpc/pr80510-2.c

[Bug tree-optimization/35503] Warning about restricted pointers?

2017-06-21 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35503

Martin Sebor  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
  Component|c   |tree-optimization

--- Comment #8 from Martin Sebor  ---
I'm testing a patch for the sprintf case.

[Bug middle-end/81161] poor code concatenating bitfields

2017-06-21 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81161

--- Comment #2 from Andrew Pinski  ---
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18041#c7 .

[Bug middle-end/81161] poor code concatenating bitfields

2017-06-21 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81161

Andrew Pinski  changed:

   What|Removed |Added

 Depends on||18041

--- Comment #1 from Andrew Pinski  ---
More like PR 18041.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18041
[Bug 18041] OR of two single-bit bitfields is inefficient

[Bug c++/66639] declare __func__ , __FUNCTION__ & __PRETTY_FUNCTION__ as constexpr

2017-06-21 Thread gcc at jonesmz dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66639

Michael Jones  changed:

   What|Removed |Added

 CC||gcc at jonesmz dot com

--- Comment #10 from Michael Jones  ---
Is there a work in progress patch available anywhere for this bug?

I have code that uses constexpr __PRETTY_FUNC__ with clang, and the equivalent
on Visual Studio 2015, and would like to patch my installation of GCC to
compile the same code.

[Bug target/81151] -Wmaybe-uninitialized in insn-emit.c

2017-06-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81151

--- Comment #3 from Jakub Jelinek  ---
Author: jakub
Date: Wed Jun 21 20:02:00 2017
New Revision: 249469

URL: https://gcc.gnu.org/viewcvs?rev=249469=gcc=rev
Log:
PR target/81151
* config/i386/sse.md (round2): Renumber match_dup and
operands indexes to avoid gap between operands and match_dups.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/sse.md

[Bug libstdc++/80940] [7/8 Regression] Private inheritance from std::ostream - compilation error for custom operator <

2017-06-21 Thread ville at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80940

--- Comment #2 from ville at gcc dot gnu.org ---
Author: ville
Date: Wed Jun 21 19:53:26 2017
New Revision: 249468

URL: https://gcc.gnu.org/viewcvs?rev=249468=gcc=rev
Log:
PR libstdc++/80675, PR libstdc++/80940

* include/std/istream:
(__is_convertible_to_basic_istream_test(basic_istream<_Ch, _Up>*)): New.
(__do_is_convertible_to_basic_istream_impl): Likewise.
(__is_convertible_to_basic_istream_impl): Likewise.
(__is_convertible_to_basic_istream): Use the new base.
(__rvalue_istream_type): New.
(operator>>(_Istream&&, _Tp&&)): Use the new helper alias
for the SFINAE check, convert to the helper alias type before
doing the actual extraction.
* include/std/ostream:
(__is_convertible_to_basic_ostream_test(basic_ostream<_Ch, _Up>*)): New.
(__do_is_convertible_to_basic_ostream_impl): Likewise.
(__is_convertible_to_basic_ostream_impl): Likewise.
(__is_convertible_to_basic_ostream): Use the new base.
(__rvalue_ostream_type): New.
(operator<<(_Ostream&&, const _Tp&)): Use the new helper alias
for the SFINAE check, convert to the helper alias type before
doing the actual insertion.
* testsuite/27_io/rvalue_streams-2.cc: Add new tests.

Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/std/istream
trunk/libstdc++-v3/include/std/ostream
trunk/libstdc++-v3/testsuite/27_io/rvalue_streams-2.cc

[Bug libstdc++/80675] Incorrect implementation of LWG 2534

2017-06-21 Thread ville at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80675

--- Comment #2 from ville at gcc dot gnu.org ---
Author: ville
Date: Wed Jun 21 19:53:26 2017
New Revision: 249468

URL: https://gcc.gnu.org/viewcvs?rev=249468=gcc=rev
Log:
PR libstdc++/80675, PR libstdc++/80940

* include/std/istream:
(__is_convertible_to_basic_istream_test(basic_istream<_Ch, _Up>*)): New.
(__do_is_convertible_to_basic_istream_impl): Likewise.
(__is_convertible_to_basic_istream_impl): Likewise.
(__is_convertible_to_basic_istream): Use the new base.
(__rvalue_istream_type): New.
(operator>>(_Istream&&, _Tp&&)): Use the new helper alias
for the SFINAE check, convert to the helper alias type before
doing the actual extraction.
* include/std/ostream:
(__is_convertible_to_basic_ostream_test(basic_ostream<_Ch, _Up>*)): New.
(__do_is_convertible_to_basic_ostream_impl): Likewise.
(__is_convertible_to_basic_ostream_impl): Likewise.
(__is_convertible_to_basic_ostream): Use the new base.
(__rvalue_ostream_type): New.
(operator<<(_Ostream&&, const _Tp&)): Use the new helper alias
for the SFINAE check, convert to the helper alias type before
doing the actual insertion.
* testsuite/27_io/rvalue_streams-2.cc: Add new tests.

Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/std/istream
trunk/libstdc++-v3/include/std/ostream
trunk/libstdc++-v3/testsuite/27_io/rvalue_streams-2.cc

[Bug c/35503] Warning about restricted pointers?

2017-06-21 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35503

--- Comment #7 from Martin Sebor  ---
I don't think the current implementation of the warning is prone to false
positives so it seems that it could safely be included it in -Wall. 
Unfortunately, the overly simplistic implementation makes it prone to many
false negatives (in fact, the warning detects only the most basic cases where
the pointer arguments are the same), making it useful for not much more than
demos.  To make it suitable for more than that it will need to be moved from
the front-end to the middle-end.

The request should probably also not be considered fully resolved until the
motivating example comment #0 (printf(buf, "%s-%s", buf, to_add)) is diagnosed.
 I think that should actually be fairly easily doable in the
gimple-ssa-sprintf.c pass.

[Bug fortran/81160] arith.c:2009: bad statement order ?

2017-06-21 Thread jvdelisle at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81160

Jerry DeLisle  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2017-06-21
 CC||jvdelisle at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |jvdelisle at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Jerry DeLisle  ---
We probably should do:

static bool
wprecision_int_real (mpz_t n, mpfr_t r)
{
  bool result;
  mpz_t i;
  mpz_init (i);
  mpfr_get_z (i, r, GFC_RND_MODE);
  mpz_sub (i, i, n);
  result = mpz_cmp_si (i, 0) != 0;
  mpz_clear (i);
  return result;
}

I will check this further.

[Bug middle-end/81161] New: poor code concatenating bitfields

2017-06-21 Thread nathan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81161

Bug ID: 81161
   Summary: poor code concatenating bitfields
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: nathan at gcc dot gnu.org
  Target Milestone: ---

Created attachment 41604
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41604=edit
example

The example code is trying to use a set of adjacent single bit fields as a
wider value.  (Think TREE_LANG_FLAG_{N,N+2} to explain why I can't just make a
3-bit bitfield).  We don't spot this is just extrating a wider bitfield[*] 
here's the x86_64 code I get:
movzbl  (%rdi), %edx
movl%edx, %eax
movl%edx, %ecx
shrb$2, %dl
shrb$4, %al
shrb$3, %cl
andl$1, %edx
andl$1, %eax
andl$1, %ecx
sall$2, %eax
addl%ecx, %ecx
orl %ecx, %eax
orl %edx, %eax
ret

which is roughly doing:
   t1 = (val >> 2) & 1
   t2 = (val >> 3) & 1
   t3 = (val >> 4) & 1
   r = (t3 << 2) | (t2 + t1) | t1

optimal code would be something like:
   movzbl   (%rdi), %eax
   shrb $2,%al
   andl $7,%eax

this is similar to 68360, but looks sufficiently different to warrant a new
report.

[*] where bitfield packing was from the other end of the object, one might want
to swap the bitfields around to get a nice ordering.  Let's just assume
little-endian packing for the sake of argument.

[Bug fortran/81160] New: arith.c:2009: bad statement order ?

2017-06-21 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81160

Bug ID: 81160
   Summary: arith.c:2009: bad statement order ?
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

trunk/gcc/fortran/arith.c:2009]: (style) Statements following return, break,
continue, goto or throw will never be executed.

Source code is

static bool
wprecision_int_real (mpz_t n, mpfr_t r)
{
  mpz_t i;
  mpz_init (i);
  mpfr_get_z (i, r, GFC_RND_MODE);
  mpz_sub (i, i, n);
  return mpz_cmp_si (i, 0) != 0;
  mpz_clear (i);

}

Suggest either delete the mpz_clear or use it.

[Bug c++/81159] New: New warning idea: -Wself-move

2017-06-21 Thread simon.marchi at polymtl dot ca
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81159

Bug ID: 81159
   Summary: New warning idea: -Wself-move
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: simon.marchi at polymtl dot ca
  Target Milestone: ---

clang has this warning, -Wself-move, which warns about things like this:

  int a = 1;

  a = std::move (a);

I don't see any reason why code like this would be desirable, so any code that
ends up like this would likely be a mistake.  It would be nice to point it out.

Example output:

test.c:6:4: error: explicitly moving variable of type 'int' to itself
[-Werror,-Wself-move]
a = std::move(a);
~ ^   ~
1 error generated.

[Bug ipa/81133] [8 Regression] PGO/LTO bootstrap: ICE: in inline_small_functions, at ipa-inline.c:1891

2017-06-21 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81133

Jan Hubicka  changed:

   What|Removed |Added

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

--- Comment #2 from Jan Hubicka  ---
I will take a look.

[Bug middle-end/78918] missing -Wrestrict on memcpy copying over self

2017-06-21 Thread fw at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78918

Florian Weimer  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=32667

--- Comment #3 from Florian Weimer  ---
PR32667 says that GCC itself uses memcpy with exact overlaps, so we probably
should not add restrict qualifiers until that is fixed.

[Bug middle-end/78918] missing -Wrestrict on memcpy copying over self

2017-06-21 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78918

Martin Sebor  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-06-21
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=35503
 Ever confirmed|0   |1

--- Comment #2 from Martin Sebor  ---
One reason for the missing warning in the test case in comment #0 is that GCC
built-ins aren't declared using the restrict qualifier.  In particular, both
memcpy and memmove are declared in builtins.def like so:

DEF_LIB_BUILTIN_CHKP   (BUILT_IN_MEMCPY, "memcpy",
BT_FN_PTR_PTR_CONST_PTR_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)
DEF_LIB_BUILTIN_CHKP   (BUILT_IN_MEMMOVE, "memmove",
BT_FN_PTR_PTR_CONST_PTR_SIZE, ATTR_RET1_NOTHROW_NONNULL_LEAF)

with BT_FN_PTR_PTR_CONST_PTR_SIZE specifying the same signature.  BT_PTR
expands to void_ptr_node, with no restrict qualifier.

The second reason is that the -Wrestrict warning is implemented in the
front-end, with no ability to determine relationships between distinct
pointers.  So while memcpy(p, p, n) is diagnosed (provided memcpy is declared
restrict), memcpy(p, q, n) is not.  That limitation limits the warning to just
the most basic and obvious cases, missing the more interesting problems.

Confirming on that basis.  Adding a reference to bug 35503 under which the
warning was implemented (in r242366).

[Bug c++/46476] Missing Warning about unreachable code after return

2017-06-21 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46476

--- Comment #16 from David Binderman  ---
(In reply to Manuel López-Ibáñez from comment #14)
> But the main barrier for this is not technical or acceptance, it is 
> leadership and human resources. 

And the usual time and money. There are plenty of static analysers out there.
Unless it is substantially better, why write another one ?

My favourite static analyser, cppcheck, says this for the original code:

$ ~/cppcheck/trunk/cppcheck --enable=all bug46476.cc
[bug46476.cc:5]: (style) Statements following return, break, continue, goto or
throw will never be executed.
[bug46476.cc:11]: (style) Statements following return, break, continue, goto or
throw will never be executed.
[bug46476.cc:8]: (style) The function 'bar' is never used.
[bug46476.cc:2]: (style) The function 'foo' is never used.
$

which pretty much does the job.

Running the same static analyser over the source code of a recent gcc
found 22 occurrences of this kind of problem.

Here they are:

$ fgrep "Statements following" cppcheck.20170617.out
[trunk/gcc/c/c-decl.c:3211]: (style) Statements following return, break,
continue, goto or throw will never be executed.
[trunk/gcc/fortran/arith.c:2009]: (style) Statements following return, break,
continue, goto or throw will never be executed.
[trunk/libbacktrace/dwarf.c:2709]: (style) Statements following return, break,
continue, goto or throw will never be executed.
[trunk/libbacktrace/dwarf.c:2758]: (style) Statements following return, break,
continue, goto or throw will never be executed.
[trunk/libbacktrace/dwarf.c:2892]: (style) Statements following return, break,
continue, goto or throw will never be executed.
[trunk/libbacktrace/dwarf.c:3025]: (style) Statements following return, break,
continue, goto or throw will never be executed.
[trunk/libbacktrace/elf.c:448]: (style) Statements following return, break,
continue, goto or throw will never be executed.
[trunk/libbacktrace/elf.c:493]: (style) Statements following return, break,
continue, goto or throw will never be executed.
[trunk/libbacktrace/elf.c:967]: (style) Statements following return, break,
continue, goto or throw will never be executed.
[trunk/libbacktrace/fileline.c:64]: (style) Statements following return, break,
continue, goto or throw will never be executed.
[trunk/libbacktrace/fileline.c:75]: (style) Statements following return, break,
continue, goto or throw will never be executed.
[trunk/libbacktrace/pecoff.c:499]: (style) Statements following return, break,
continue, goto or throw will never be executed.
[trunk/libbacktrace/pecoff.c:564]: (style) Statements following return, break,
continue, goto or throw will never be executed.
[trunk/libbacktrace/pecoff.c:931]: (style) Statements following return, break,
continue, goto or throw will never be executed.
[trunk/libcilkrts/runtime/cilk_fiber.cpp:968]: (style) Statements following
return, break, continue, goto or throw will never be executed.
[trunk/libcilkrts/runtime/scheduler.c:2468]: (style) Statements following
return, break, continue, goto or throw will never be executed.
[trunk/libcilkrts/runtime/scheduler.c:2550]: (style) Statements following
return, break, continue, goto or throw will never be executed.
[trunk/libcilkrts/runtime/scheduler.c:2439]: (style) Statements following
return, break, continue, goto or throw will never be executed.
[trunk/libffi/src/dlmalloc.c:3877]: (style) Statements following return, break,
continue, goto or throw will never be executed.
[trunk/libgomp/error.c:90]: (style) Statements following return, break,
continue, goto or throw will never be executed.
[trunk/libgomp/libgomp-plugin.c:79]: (style) Statements following return,
break, continue, goto or throw will never be executed.
[trunk/libobjc/error.c:41]: (style) Statements following return, break,
continue, goto or throw will never be executed.
$

Most of them seem to be in libbacktrace. I could look deeper into these
and generate some bug reports. That's the usual way to provoke gcc developers
into developing a new warning: show that the gcc source code would benefit
from it.

[Bug sanitizer/81094] -fsanitize=object-size does not instrument aggregate call arguments

2017-06-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81094

Jakub Jelinek  changed:

   What|Removed |Added

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

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

[Bug c++/81154] OpenMP with shared variable in a template class crash

2017-06-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81154

--- Comment #3 from Jakub Jelinek  ---
Author: jakub
Date: Wed Jun 21 18:30:32 2017
New Revision: 249467

URL: https://gcc.gnu.org/viewcvs?rev=249467=gcc=rev
Log:
PR c++/81154
* semantics.c (handle_omp_array_sections_1, finish_omp_clauses):
Complain about t not being a variable if t is OVERLOAD even
when processing_template_decl.

* g++.dg/gomp/pr81154.C: New test.

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

[Bug target/81158] New: [8 regression] Many test case failures starting with r249424

2017-06-21 Thread seurer at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81158

Bug ID: 81158
   Summary: [8 regression] Many test case failures starting with
r249424
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: seurer at gcc dot gnu.org
  Target Milestone: ---

The following tests are the ones that fail on powerpc64.  Most fail on just LE
but a few also fail on BE.

FAIL: gcc.c-torture/execute/pr51581-1.c   -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: gcc.c-torture/execute/pr51581-1.c   -O3 -g  execution test
FAIL: gcc.c-torture/execute/pr51581-2.c   -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
FAIL: gcc.c-torture/execute/pr51581-2.c   -O3 -g  execution test
FAIL: gcc.c-torture/execute/pr53645.c   -O1  execution test
FAIL: gcc.c-torture/execute/pr53645.c   -O2  execution test
FAIL: gcc.c-torture/execute/pr53645.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  execution test
FAIL: gcc.c-torture/execute/pr53645.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  execution test
FAIL: gcc.c-torture/execute/pr53645.c   -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions  execution test
FAIL: gcc.c-torture/execute/pr53645.c   -O3 -g  execution test
FAIL: gcc.c-torture/execute/pr53645.c   -Os  execution test
FAIL: gcc.dg/vect/pr51581-1.c -flto -ffat-lto-objects execution test
FAIL: gcc.dg/vect/pr51581-1.c execution test
FAIL: gcc.dg/vect/pr51581-2.c -flto -ffat-lto-objects execution test
FAIL: gcc.dg/vect/pr51581-2.c execution test
FAIL: gcc.dg/vect/pr51581-3.c -flto -ffat-lto-objects execution test
FAIL: gcc.dg/vect/pr51581-3.c execution test
FAIL: gcc.target/powerpc/builtins-3.c scan-assembler-times vmulesh 1
FAIL: gcc.target/powerpc/builtins-3.c scan-assembler-times vmuleuh 1
FAIL: gcc.target/powerpc/builtins-3.c scan-assembler-times vmulosh 1
FAIL: gcc.target/powerpc/builtins-3.c scan-assembler-times vmulouh 1
Note: builttin-3 also fails on BE
FAIL: libgomp.fortran/appendix-a/a.16.1.f90   -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions  execution test


>From looking at the failures it appears that array values are getting messed
up.


Looking at pr51581-1:

(gdb) run
Starting program: /home/seurer/gcc/build/gcc-test/pr51581-1.exe 

Program received signal SIGABRT, Aborted.
0x3fffb7d00a88 in __GI_raise (sig=) at
../nptl/sysdeps/unix/sysv/linux/raise.c:56
56  ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) where
#0  0x3fffb7d00a88 in __GI_raise (sig=) at
../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x3fffb7d0686c in __GI_abort () at abort.c:89
#2  0x1874 in main () at
/home/seurer/gcc/gcc-test/gcc/testsuite/gcc.c-torture/execute/pr51581-1.c:130


int
main ()
{
. . .
  for (i = 0; i < N; i++)
if (c[i] != a[i] / 3 || d[i] != b[i] / 3)
  abort ();  // line 130
. . .


Looking at pr53645:

(gdb) run
Starting program: /home/seurer/gcc/build/gcc-test/pr53645.exe 

Program received signal SIGABRT, Aborted.
0x3fffb7d00a88 in __GI_raise (sig=) at
../nptl/sysdeps/unix/sysv/linux/raise.c:56
56  ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) where
#0  0x3fffb7d00a88 in __GI_raise (sig=) at
../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x3fffb7d0686c in __GI_abort () at abort.c:89
#2  0x10001fc8 in main () at
/home/seurer/gcc/gcc-test/gcc/testsuite/gcc.c-torture/execute/pr53645.c:74



int
main ()
{
  UV ur, ur2;
  SV sr, sr2;
  int i;
#undef TEST
#define TEST(a, b, c, d)\
uq##a##b##c##d (, u + i);\
if (ur[0] != u[i][0] / a || ur[3] != u[i][3] / d)   \
 abort ();  \
asm volatile ("" : : "r" () : "memory"); \
if (ur[2] != u[i][2] / c || ur[1] != u[i][1] / b)   \
 abort ();  \
asm volatile ("" : : "r" () : "memory"); \
ur##a##b##c##d (, u + i);\
if (ur[0] != u[i][0] % a || ur[3] != u[i][3] % d)   \
 abort ();  \
asm volatile ("" : : "r" () : "memory"); \
if (ur[2] != u[i][2] % c || ur[1] != u[i][1] % b)   \
 abort ();  \
asm volatile ("" : : "r" () : "memory");
  for (i = 0; i < sizeof (u) / sizeof (u[0]); i++)
{
  TESTS  // Line 74
}




The last one fails with a segmentation fault:

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
FAIL: libgomp.fortran/appendix-a/a.16.1.f90   -O3 -g  execution test

[Bug target/68163] GCC on power8 does not issue the stxsspx instruction on power8

2017-06-21 Thread meissner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68163

Michael Meissner  changed:

   What|Removed |Added

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

--- Comment #6 from Michael Meissner  ---
Patch applied to trunk, gcc 7, and gcc 6 branches.

[Bug target/80718] GCC generates slow code for offsettable vec_duplicate

2017-06-21 Thread meissner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80718

Michael Meissner  changed:

   What|Removed |Added

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

--- Comment #6 from Michael Meissner  ---
Fix back ported to gcc 7/6 branches.

[Bug target/80510] Optimize Power7/power8 Altivec load/stores

2017-06-21 Thread meissner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80510

--- Comment #4 from Michael Meissner  ---
Author: meissner
Date: Wed Jun 21 18:02:37 2017
New Revision: 249466

URL: https://gcc.gnu.org/viewcvs?rev=249466=gcc=rev
Log:
[gcc]
2017-06-21  Michael Meissner  

Back port from mainline
2017-05-19  Michael Meissner  

PR target/80718
* config/rs6000/vsx.md (vsx_splat_, VSX_D iterator): Prefer
VSX registers over GPRs, particularly on ISA 2.07 which does not
have the MTVSRDD instruction.

Back port from mainline
2017-05-18  Michael Meissner  

PR target/80510
* config/rs6000/predicates.md (simple_offsettable_mem_operand):
New predicate.

* config/rs6000/rs6000.md (ALTIVEC_DFORM): New iterator.
(define_peephole2 for Altivec d-form load): Add peepholes to catch
cases where the register allocator uses a move and an offsettable
memory operation to/from a FPR register on ISA 2.06/2.07.
(define_peephole2 for Altivec d-form store): Likewise.

Back port from mainline
2017-05-09  Michael Meissner  

PR target/68163
* config/rs6000/rs6000.md (f32_lr): Delete mode attributes that
are now unused after splitting mov{sf,sd}_hardfloat.
(f32_lr2): Likewise.
(f32_lm): Likewise.
(f32_lm2): Likewise.
(f32_li): Likewise.
(f32_li2): Likewise.
(f32_lv): Likewise.
(f32_sr): Likewise.
(f32_sr2): Likewise.
(f32_sm): Likewise.
(f32_sm2): Likewise.
(f32_si): Likewise.
(f32_si2): Likewise.
(f32_sv): Likewise.
(f32_dm): Likewise.
(f32_vsx): Likewise.
(f32_av): Likewise.
(mov_hardfloat): Split into separate movsf and movsd pieces.
For movsf, order stores so the VSX stores occur before the GPR
store which encourages the register allocator to use a traditional
FPR instead of a GPR.  For movsd, order the stores so that the GPR
store comes before the VSX stores to allow the power6 to work.
This is due to the power6 not having a 32-bit integer store
instruction from a FPR.
(movsf_hardfloat): Likewise.
(movsd_hardfloat): Likewise.

[gcc/testsuite]
2017-06-21  Michael Meissner  

Back port from mainline
2017-05-19  Michael Meissner  

PR target/80718
* gcc.target/powerpc/pr80718.c: New test.

Back port from mainline
2017-05-18  Michael Meissner  

PR target/80510
* gcc.target/powerpc/pr80510-1.c: New test.
* gcc.target/powerpc/pr80510-2.c: Likewise.

Back port from mainline
2017-05-09  Michael Meissner  

PR target/68163
* gcc.target/powerpc/pr68163.c: New test.


Added:
branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/pr68163.c
  - copied unchanged from r249041,
trunk/gcc/testsuite/gcc.target/powerpc/pr68163.c
branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/pr80510-1.c
branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/pr80510-2.c
branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/pr80718.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/config/rs6000/predicates.md
branches/gcc-6-branch/gcc/config/rs6000/rs6000.md
branches/gcc-6-branch/gcc/config/rs6000/vsx.md
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug target/68163] GCC on power8 does not issue the stxsspx instruction on power8

2017-06-21 Thread meissner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68163

--- Comment #5 from Michael Meissner  ---
Author: meissner
Date: Wed Jun 21 18:02:37 2017
New Revision: 249466

URL: https://gcc.gnu.org/viewcvs?rev=249466=gcc=rev
Log:
[gcc]
2017-06-21  Michael Meissner  

Back port from mainline
2017-05-19  Michael Meissner  

PR target/80718
* config/rs6000/vsx.md (vsx_splat_, VSX_D iterator): Prefer
VSX registers over GPRs, particularly on ISA 2.07 which does not
have the MTVSRDD instruction.

Back port from mainline
2017-05-18  Michael Meissner  

PR target/80510
* config/rs6000/predicates.md (simple_offsettable_mem_operand):
New predicate.

* config/rs6000/rs6000.md (ALTIVEC_DFORM): New iterator.
(define_peephole2 for Altivec d-form load): Add peepholes to catch
cases where the register allocator uses a move and an offsettable
memory operation to/from a FPR register on ISA 2.06/2.07.
(define_peephole2 for Altivec d-form store): Likewise.

Back port from mainline
2017-05-09  Michael Meissner  

PR target/68163
* config/rs6000/rs6000.md (f32_lr): Delete mode attributes that
are now unused after splitting mov{sf,sd}_hardfloat.
(f32_lr2): Likewise.
(f32_lm): Likewise.
(f32_lm2): Likewise.
(f32_li): Likewise.
(f32_li2): Likewise.
(f32_lv): Likewise.
(f32_sr): Likewise.
(f32_sr2): Likewise.
(f32_sm): Likewise.
(f32_sm2): Likewise.
(f32_si): Likewise.
(f32_si2): Likewise.
(f32_sv): Likewise.
(f32_dm): Likewise.
(f32_vsx): Likewise.
(f32_av): Likewise.
(mov_hardfloat): Split into separate movsf and movsd pieces.
For movsf, order stores so the VSX stores occur before the GPR
store which encourages the register allocator to use a traditional
FPR instead of a GPR.  For movsd, order the stores so that the GPR
store comes before the VSX stores to allow the power6 to work.
This is due to the power6 not having a 32-bit integer store
instruction from a FPR.
(movsf_hardfloat): Likewise.
(movsd_hardfloat): Likewise.

[gcc/testsuite]
2017-06-21  Michael Meissner  

Back port from mainline
2017-05-19  Michael Meissner  

PR target/80718
* gcc.target/powerpc/pr80718.c: New test.

Back port from mainline
2017-05-18  Michael Meissner  

PR target/80510
* gcc.target/powerpc/pr80510-1.c: New test.
* gcc.target/powerpc/pr80510-2.c: Likewise.

Back port from mainline
2017-05-09  Michael Meissner  

PR target/68163
* gcc.target/powerpc/pr68163.c: New test.


Added:
branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/pr68163.c
  - copied unchanged from r249041,
trunk/gcc/testsuite/gcc.target/powerpc/pr68163.c
branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/pr80510-1.c
branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/pr80510-2.c
branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/pr80718.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/config/rs6000/predicates.md
branches/gcc-6-branch/gcc/config/rs6000/rs6000.md
branches/gcc-6-branch/gcc/config/rs6000/vsx.md
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug target/80718] GCC generates slow code for offsettable vec_duplicate

2017-06-21 Thread meissner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80718

--- Comment #5 from Michael Meissner  ---
Author: meissner
Date: Wed Jun 21 18:02:37 2017
New Revision: 249466

URL: https://gcc.gnu.org/viewcvs?rev=249466=gcc=rev
Log:
[gcc]
2017-06-21  Michael Meissner  

Back port from mainline
2017-05-19  Michael Meissner  

PR target/80718
* config/rs6000/vsx.md (vsx_splat_, VSX_D iterator): Prefer
VSX registers over GPRs, particularly on ISA 2.07 which does not
have the MTVSRDD instruction.

Back port from mainline
2017-05-18  Michael Meissner  

PR target/80510
* config/rs6000/predicates.md (simple_offsettable_mem_operand):
New predicate.

* config/rs6000/rs6000.md (ALTIVEC_DFORM): New iterator.
(define_peephole2 for Altivec d-form load): Add peepholes to catch
cases where the register allocator uses a move and an offsettable
memory operation to/from a FPR register on ISA 2.06/2.07.
(define_peephole2 for Altivec d-form store): Likewise.

Back port from mainline
2017-05-09  Michael Meissner  

PR target/68163
* config/rs6000/rs6000.md (f32_lr): Delete mode attributes that
are now unused after splitting mov{sf,sd}_hardfloat.
(f32_lr2): Likewise.
(f32_lm): Likewise.
(f32_lm2): Likewise.
(f32_li): Likewise.
(f32_li2): Likewise.
(f32_lv): Likewise.
(f32_sr): Likewise.
(f32_sr2): Likewise.
(f32_sm): Likewise.
(f32_sm2): Likewise.
(f32_si): Likewise.
(f32_si2): Likewise.
(f32_sv): Likewise.
(f32_dm): Likewise.
(f32_vsx): Likewise.
(f32_av): Likewise.
(mov_hardfloat): Split into separate movsf and movsd pieces.
For movsf, order stores so the VSX stores occur before the GPR
store which encourages the register allocator to use a traditional
FPR instead of a GPR.  For movsd, order the stores so that the GPR
store comes before the VSX stores to allow the power6 to work.
This is due to the power6 not having a 32-bit integer store
instruction from a FPR.
(movsf_hardfloat): Likewise.
(movsd_hardfloat): Likewise.

[gcc/testsuite]
2017-06-21  Michael Meissner  

Back port from mainline
2017-05-19  Michael Meissner  

PR target/80718
* gcc.target/powerpc/pr80718.c: New test.

Back port from mainline
2017-05-18  Michael Meissner  

PR target/80510
* gcc.target/powerpc/pr80510-1.c: New test.
* gcc.target/powerpc/pr80510-2.c: Likewise.

Back port from mainline
2017-05-09  Michael Meissner  

PR target/68163
* gcc.target/powerpc/pr68163.c: New test.


Added:
branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/pr68163.c
  - copied unchanged from r249041,
trunk/gcc/testsuite/gcc.target/powerpc/pr68163.c
branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/pr80510-1.c
branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/pr80510-2.c
branches/gcc-6-branch/gcc/testsuite/gcc.target/powerpc/pr80718.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/config/rs6000/predicates.md
branches/gcc-6-branch/gcc/config/rs6000/rs6000.md
branches/gcc-6-branch/gcc/config/rs6000/vsx.md
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug c++/81157] New: If constexpr does not support Short-circuit evaluation

2017-06-21 Thread kmp53 at sina dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81157

Bug ID: 81157
   Summary: If constexpr does not support Short-circuit evaluation
   Product: gcc
   Version: 7.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: kmp53 at sina dot com
  Target Milestone: ---

template  concept bool Same=std::is_same_v;
template concept bool IsContainer=requires(T t){
  t.cnt();
  typename T::innerType;
};
struct Ct {
  void cnt(){;}
  using innerType=int;
};
template
requires IsContainer&||Same void
fn(const V ) {
void fn(const V ) {
  if constexpr(IsContainer&) ;//①
  //if constexpr(IsContainer)//②
//if constexpr(Same) ;
  else if (Same) ;
}
int main(int argc,char*argv[]){
  fn(1);//ill-formed
  fn(Ct());//OK
}
Concept supports short expressions, while if constexpr does not.
When I write ①, there is an error
'int' is not a class, struct, or union type
If it is written ②, there will be no problem. Is it a bug or a defect?

[Bug sanitizer/81148] UBSAN: two more false positives

2017-06-21 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81148

--- Comment #7 from Marek Polacek  ---
So were in "associate:", where
lit0 = -123
lit1 = -1
which is associated to
lit0 = -124
and
var0 = null
var1 = -((long int) ~(x != 0) ^ 9223372036854775806)
which is associated to
var0 = -((long int) ~(x != 0) ^ 9223372036854775806)

Then
 9765   con0 = associate_trees (loc, con0, lit0, code, atype);
 9766   return
 9767 fold_convert_loc (loc, type, associate_trees (loc, var0,
con0,
 9768   code,
atype));

creates the bogus expression with overflow.

[Bug c/81156] New: GCC fails to compile a formula with tgmath.h

2017-06-21 Thread equilibrium556 at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81156

Bug ID: 81156
   Summary: GCC fails to compile a formula with tgmath.h
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: equilibrium556 at gmx dot de
  Target Milestone: ---

Created attachment 41603
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41603=edit
C file that fails to compile with GCC

Hey, I ran into some problems compiling code that contained a specific formula.
I am using the type generic tgmath.h header because I am switching between
float and double for performance testing reasons.

If I include the tgmath.h header, the code doesn't compile, GCC ends up filling
up all my RAM and doesn't succeed to compile the file. It compiles using the
math.h header without a problem.

Here's the code in question (also in the attachment):
/* memory_leak.c */
#include 
#include 
#include 

#ifdef TEST_SP
typedef float test_float;
#else
typedef double test_float;
#endif

int main(int argc, char *argv[]) {
int b = -1;
test_float a, c, d, e, f, g, h, i;
a = c = d = e = f = g = h = i = 1;

a = 2*b/abs(b)*sqrt(pow(sqrt(pow(c, 2) - pow(d, 2)) -
e*f*cos(g)*cos(h)/abs(b)*(i - 1), 2) + pow(d/2, 2));

return 0;
}
/* END */

Compile with:
gcc -o memory_leak -DTEST_SP -std=c99 memory_leak.c -lm

It ends up eating all the memory there is.
Doesn't work on current GCC 7.1.1 on Arch nor on an RHEL6 distro with GCC
4.4.7.
Works with GCC 5.3 in Cygwin.
Clang and ICC compile without problems as well on Linux.

[Bug bootstrap/78251] config/gettext.m4 and config/iconv.m4 contaminate CPPFLAGS

2017-06-21 Thread mikestump at comcast dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78251

--- Comment #3 from Mike Stump  ---
I've been avoiding this bug for years by just removing the unwind.h header. 
:-(

[Bug c++/81154] OpenMP with shared variable in a template class crash

2017-06-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81154

Jakub Jelinek  changed:

   What|Removed |Added

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

--- Comment #2 from Jakub Jelinek  ---
Created attachment 41602
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41602=edit
gcc8-pr81154.patch

Untested fix.

[Bug bootstrap/81037] Xcode 9 requires back ports on gcc-5-branch and gcc-6-branch for bootstrapping under Xcode 9

2017-06-21 Thread mrs at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81037

mrs at gcc dot gnu.org  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-06-21
 CC||mrs at gcc dot gnu.org
  Known to work||6.3.1
 Ever confirmed|0   |1
  Known to fail||6.3.0

[Bug bootstrap/81037] Xcode 9 requires back ports on gcc-5-branch and gcc-6-branch for bootstrapping under Xcode 9

2017-06-21 Thread mikestump at comcast dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81037

--- Comment #5 from Mike Stump  ---
Fixed in 6.4.  Leaving open for 5 backports.

[Bug bootstrap/81150] [8 Regression] GCC is miscompiled with -O3

2017-06-21 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81150

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |WORKSFORME

--- Comment #1 from H.J. Lu  ---
I can no longer reproduce it with r249449.

[Bug tree-optimization/81136] [8 Regression] ICE: in vect_update_misalignment_for_peel, at tree-vect-data-refs.c:910

2017-06-21 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81136

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

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

[Bug sanitizer/81148] UBSAN: two more false positives

2017-06-21 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81148

--- Comment #6 from Marek Polacek  ---
We basically have
-123 - (LONG_MIN + 1)
but it's being folded to
-LONG_MIN + -124
which is of course not correct.

[Bug debug/81155] New: Debug make check regressions in GCC 8.0

2017-06-21 Thread andrey.y.guskov at intel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81155

Bug ID: 81155
   Summary: Debug make check regressions in GCC 8.0
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: andrey.y.guskov at intel dot com
  Target Milestone: ---

Revision r249105 produces several new make check fails:

FAIL: gcc.dg/guality/pr43051-1.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  line 34 c == [0]
FAIL: gcc.dg/guality/pr43051-1.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  line 36 e == [1]
FAIL: gcc.dg/guality/pr43051-1.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  line 39 c == [0]
FAIL: gcc.dg/guality/pr43051-1.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  line 41 e == [1]
FAIL: gcc.dg/guality/pr43051-1.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  line 34 c == [0]
FAIL: gcc.dg/guality/pr43051-1.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  line 36 e == [1]
FAIL: gcc.dg/guality/pr43051-1.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  line 39 c == [0]
FAIL: gcc.dg/guality/pr43051-1.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  line 41 e == [1]
FAIL: gcc.dg/guality/pr45882.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  line 16 b == 7
FAIL: gcc.dg/guality/pr45882.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  line 16 c == 11
FAIL: gcc.dg/guality/pr45882.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  line 16 d == 112
FAIL: gcc.dg/guality/pr45882.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  line 16 e == 142
FAIL: gcc.dg/guality/pr45882.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  line 16 b == 7
FAIL: gcc.dg/guality/pr45882.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  line 16 c == 11

./configure line:
--enable-languages=c,c++ --enable-clocale=gnu --enable-cloog-backend=
isl --enable-shared --disable-libsanitizer --disable-bootstrap --disable-nls
--with-system-zlib --with-demangler-in-ld --with-arch=corei
7 --with-cpu=corei7 --with-fpmath=sse

[Bug c++/46476] Missing Warning about unreachable code after return

2017-06-21 Thread jg at jguk dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46476

--- Comment #15 from Jon Grant  ---
I saw Bjarne Stroustrup announced C++ Core Guidelines, as a gitproject which
includes a checker. At least it would all be in one place as a project.

[Bug c++/81152] False strict-aliasing warning

2017-06-21 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81152

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-06-21
 CC||jason at redhat dot com,
   ||marxin at gcc dot gnu.org,
   ||rguenth at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Martin Liška  ---
Started with r236221.

[Bug sanitizer/81148] UBSAN: two more false positives

2017-06-21 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81148

--- Comment #5 from Marek Polacek  ---
It's the
(flag_sanitize & SANITIZE_SI_OVERFLOW) == 0
check in fold_negate_expr_1 that makes the difference w/ and w/o ubsan.

[Bug sanitizer/81148] UBSAN: two more false positives

2017-06-21 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81148

--- Comment #4 from Marek Polacek  ---
Started with

commit 69693ea7b7ed45a12cbd505b2a66257fd4e81669
Author: rguenth 
Date:   Fri Jun 26 10:59:27 2015 +

2015-06-26  Richard Biener  

* fold-const.c (fold_binary_loc): Remove -A CMP -B -> A CMP B
and -A CMP CST -> A CMP -CST which is redundant with a pattern
in match.pd.
Move (A | C) == D where C & ~D != 0 -> 0, (X ^ Y) ==/!= 0 -> X
==/!= Y,
(X ^ Y) ==/!= {Y,X} -> {X,Y} ==/!= 0 and
(X ^ C1) op C2 -> X op (C1 ^ C2) to ...
* match.pd: ... patterns here.

* gcc.dg/tree-ssa/forwprop-25.c: Adjust.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225007
138bc75d-0d04-0410-961f-82ee72b054a4

it seems.

[Bug c++/46476] Missing Warning about unreachable code after return

2017-06-21 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46476

--- Comment #14 from Manuel López-Ibáñez  ---
(In reply to Jon Grant from comment #13)
> May be simpler to just implement these static analysis checkers outside of a
> compiler.

Or as a plugin to GCC (so that it reuses GCC internals) that is stored in GCC
source repository and build alongside. But the main barrier for this is not
technical or acceptance, it is leadership and human resources. Someone has to
take care of such a project, find developers and commit to maintain it. For
various (bad) reasons, people tend to prefer to develop their personal in-house
ad-hoc solution, rather than work with others with similar goals and with the
GCC community. The end result is that existing solutions are poor, not widely
used and often abandoned.

On the other hand, there are many examples to follow on how to approach such a
project. This includes all the enhancements to diagnostics done by non-core
developers, libcc1, the D front-end, every new target added by non-core
developers, etc.

[Bug c++/81154] OpenMP with shared variable in a template class crash

2017-06-21 Thread mplaneta at os dot inf.tu-dresden.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81154

mplaneta at os dot inf.tu-dresden.de changed:

   What|Removed |Added

 CC||mplaneta at os dot 
inf.tu-dresden.
   ||de

--- Comment #1 from mplaneta at os dot inf.tu-dresden.de ---
The log:

$ gcc a.cpp -fopenmp
a.cpp: In instantiation of ‘double C::overlap_prob(T) const [with T = int]’:
a.cpp:21:29:   required from here
a.cpp:8:9: internal compiler error: in tsubst_copy, at cp/pt.c:14634
 #pragma omp parallel for reduction(+:overlap_prob)
 ^~~
0x612260 tsubst_copy
/dev/shm/schmaik/gcc-7.1.0/gcc/cp/pt.c:14634
0x61bf4e tsubst_copy
/dev/shm/schmaik/gcc-7.1.0/gcc/cp/pt.c:14433
0x61bf4e tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
/dev/shm/schmaik/gcc-7.1.0/gcc/cp/pt.c:17930
0x6107d7 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/dev/shm/schmaik/gcc-7.1.0/gcc/cp/pt.c:16468
0x6118a2 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/dev/shm/schmaik/gcc-7.1.0/gcc/cp/pt.c:15704
0x6118a2 tsubst_omp_clause_decl
/dev/shm/schmaik/gcc-7.1.0/gcc/cp/pt.c:15098
0x614f83 tsubst_omp_clauses
/dev/shm/schmaik/gcc-7.1.0/gcc/cp/pt.c:15196
0x610101 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/dev/shm/schmaik/gcc-7.1.0/gcc/cp/pt.c:16126
0x610685 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/dev/shm/schmaik/gcc-7.1.0/gcc/cp/pt.c:15719
0x61051b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/dev/shm/schmaik/gcc-7.1.0/gcc/cp/pt.c:15945
0x60ecb2 instantiate_decl(tree_node*, bool, bool)
/dev/shm/schmaik/gcc-7.1.0/gcc/cp/pt.c:22897
0x62c5fb instantiate_pending_templates(int)
/dev/shm/schmaik/gcc-7.1.0/gcc/cp/pt.c:23018
0x64c2d0 c_parse_final_cleanups()
/dev/shm/schmaik/gcc-7.1.0/gcc/cp/decl2.c:4526
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug c++/81154] New: OpenMP with shared variable in a template class crash

2017-06-21 Thread mplaneta at os dot inf.tu-dresden.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81154

Bug ID: 81154
   Summary: OpenMP with shared variable in a template class crash
   Product: gcc
   Version: 7.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: mplaneta at os dot inf.tu-dresden.de
  Target Milestone: ---

Created attachment 41601
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41601=edit
Minimal example

Code compilation fails when following clauses are met:

1. In instantiation of a template class
2. There is a function overload
3. Inside one of the function overloads there is an OpenMP parallel for pragma
4. Pragma uses reduction or shared clause
5. A variable name is a function name (erroneously)
6. Compilation happens with -fopenmp (obviously)

The code is incorrect, but instead of adequate error message the compiler
crashes.

Bug exists in many versions of GCC, not only 7.1.

[Bug c++/12944] [meta-bug] C++ name-lookup problems

2017-06-21 Thread nathan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12944
Bug 12944 depends on bug 67074, which changed state.

Bug 67074 Summary: Name lookup ambiguity between namespace and its alias
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67074

   What|Removed |Added

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

[Bug c++/67074] Name lookup ambiguity between namespace and its alias

2017-06-21 Thread nathan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67074

Nathan Sidwell  changed:

   What|Removed |Added

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

--- Comment #3 from Nathan Sidwell  ---
Fixed r249408.

[Bug c/81153] Incorrect annotation causes an internal compiler error at tree-ssanames.c line 375

2017-06-21 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81153

Marek Polacek  changed:

   What|Removed |Added

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

--- Comment #3 from Marek Polacek  ---
Will do so.

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

[Bug tree-optimization/80612] [7 Regression] ICE in get_range_info, at tree-ssanames.c:375

2017-06-21 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80612

Marek Polacek  changed:

   What|Removed |Added

 CC||ernst.vanveenendaal@prismte
   ||ch.com

--- Comment #9 from Marek Polacek  ---
*** Bug 81153 has been marked as a duplicate of this bug. ***

[Bug c/81153] Incorrect annotation causes an internal compiler error at tree-ssanames.c line 375

2017-06-21 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81153

--- Comment #2 from Marek Polacek  ---
I fixed this in r247586 but seems I never backported the fix.

[Bug c/81153] Incorrect annotation causes an internal compiler error at tree-ssanames.c line 375

2017-06-21 Thread ernst.vanveenendaal at prismtech dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81153

--- Comment #1 from ernst.vanveenendaal at prismtech dot com ---
Created attachment 41600
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41600=edit
reproducer

[Bug c/81153] New: Incorrect annotation causes an internal compiler error at tree-ssanames.c line 375

2017-06-21 Thread ernst.vanveenendaal at prismtech dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81153

Bug ID: 81153
   Summary: Incorrect annotation causes an internal compiler error
at tree-ssanames.c line 375
   Product: gcc
   Version: 7.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ernst.vanveenendaal at prismtech dot com
  Target Milestone: ---

Created attachment 41599
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41599=edit
reproducer

I encounted an internal compiler error:
test.c: In function ‘main’:
test.c:8:8: internal compiler error: in get_range_info, at tree-ssanames.c:375
  void *ptr2 = my_realloc(ptr,20);
^~~~

because the code I was trying to compile had an incorrect annotation for a
function prototype. Correction the annotation fixed the crash, but I don't
expect the compiler to crash on such an error.

GCC version is gcc-7 (SUSE Linux) 7.1.1 20170530 [gcc-7-branch revision 248621]
on OpenSuse thumbleweed

Reproducer (just build with gcc test.c):

test.c:
===
#include "test.h"
#include 
#include 

void main(void)
{
void *ptr = malloc(20);
void *ptr2 = my_realloc(ptr,20);
printf("ptr = %x, ptr2 = %x\n", ptr, ptr2);
}

void* my_realloc(void* ptr, int size) 
{
return realloc(ptr, size);
}

===
test.h
===
void *my_realloc(void*, int) 
__attribute__((alloc_size(1)));

===

Compiling this with gcc will result in an error:

test.c: In function ‘main’:
test.c:8:8: internal compiler error: in get_range_info, at tree-ssanames.c:375
  void *ptr2 = my_realloc(ptr,20);
^~~~

[Bug tree-optimization/79489] Strange static branch prediction for n != 0

2017-06-21 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79489

--- Comment #7 from Martin Liška  ---
Author: marxin
Date: Wed Jun 21 12:51:46 2017
New Revision: 249450

URL: https://gcc.gnu.org/viewcvs?rev=249450=gcc=rev
Log:
Make early return predictor more precise.

2017-06-21  Martin Liska  

PR tree-optimization/79489
* gimplify.c (maybe_add_early_return_predict_stmt): New
function.
(gimplify_return_expr): Call the function.
* predict.c (tree_estimate_probability_bb): Remove handling
of early return.
* predict.def: Update comment about early return predictor.
* gimple-predict.h (is_gimple_predict): New function.
* predict.def: Change default value of early return to 66.
* tree-tailcall.c (find_tail_calls): Skip GIMPLE_PREDICT
statements.
* passes.def: Put pass_strip_predict_hints to the beginning of
IPA passes.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/gimple-low.c
trunk/gcc/gimple-predict.h
trunk/gcc/gimplify.c
trunk/gcc/passes.def
trunk/gcc/predict.c
trunk/gcc/predict.def
trunk/gcc/tree-tailcall.c

[Bug c++/81152] False strict-aliasing warning

2017-06-21 Thread rrrlasse at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81152

--- Comment #1 from Lasse Reinhold  ---
Created attachment 41598
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41598=edit
Non-stack overflowing version

[Bug libstdc++/81138] std::money_put facet does not write '0' before decimal point

2017-06-21 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81138

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-06-21
 Ever confirmed|0   |1

--- Comment #2 from Jonathan Wakely  ---
The patch is wrong, because we don't want to add the zero when frac_digits() is
not positive.

[Bug target/81151] -Wmaybe-uninitialized in insn-emit.c

2017-06-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81151

Jakub Jelinek  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
Created attachment 41597
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41597=edit
gcc8-pr81151.patch

Untested fix.

[Bug target/81151] -Wmaybe-uninitialized in insn-emit.c

2017-06-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81151

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
 CC||jakub at gcc dot gnu.org
  Component|c++ |target
 Ever confirmed|0   |1

[Bug c++/81152] New: False strict-aliasing warning

2017-06-21 Thread rrrlasse at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81152

Bug ID: 81152
   Summary: False strict-aliasing warning
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: rrrlasse at hotmail dot com
  Target Milestone: ---

Version 8.0.0 20170620 (and also version 7.1) gives following false warning:


me@ubuntu:~$ g++ -Wall -Wextra -O3 -std=c++14 -fstrict-aliasing
-Wstrict-aliasing /mnt/hgfs/D/c.cpp
/mnt/hgfs/D/c.cpp: In constructor ‘BasicArray::BasicArray()’:
/mnt/hgfs/D/c.cpp:18:40: warning: dereferencing type-punned pointer will break
strict-aliasing rules [-Wstrict-aliasing]
  char* p = reinterpret_cast(tmp.m_data);
^~

Below is a minimal code sample. I can't reduce it further - you need both the
inheritance and also the templates for it to trigger:


struct Array
{
char* m_data = nullptr;
};

template  struct BasicArray : public Array
{
BasicArray();
};

template  BasicArray::BasicArray()
{
BasicArray tmp;

// aliasing warning
char* p = reinterpret_cast(tmp.m_data);

// avoid unused variable warning
static_cast(p);
}

int main()
{
BasicArray f;
}

[Bug c++/81134] C++ partial template specialization issue

2017-06-21 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81134

--- Comment #5 from Jonathan Wakely  ---
To determine the type of the conditional expression it's necessary to know the
types of both GCD::value and GCD::value, which requires
instantiating both of GCD and GCD, which triggers the infinite
recursion.

[Bug c++/46476] Missing Warning about unreachable code after return

2017-06-21 Thread jg at jguk dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46476

--- Comment #13 from Jon Grant  ---
May be simpler to just implement these static analysis checkers outside of a
compiler.

[Bug c++/81151] -Wmaybe-uninitialized in insn-emit.c

2017-06-21 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81151

Martin Liška  changed:

   What|Removed |Added

   Last reconfirmed||2017-6-21
 CC||rguenth at gcc dot gnu.org

--- Comment #1 from Martin Liška  ---
Started with r245840.

[Bug c++/81151] New: -Wmaybe-uninitialized in insn-emit.c

2017-06-21 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81151

Bug ID: 81151
   Summary: -Wmaybe-uninitialized in insn-emit.c
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: marxin at gcc dot gnu.org
  Target Milestone: ---

Created attachment 41596
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41596=edit
Test-case

Building current GCC with GCC 7.1 produces warning:

g++ insn-emit.ii -Wmaybe-uninitialized
insn-emit.c: In function ‘rtx_def* gen_roundv16sf2(rtx, rtx)’:
insn-emit.c:148125:14: warning: ‘operands[2]’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
 operand2 = operands[2];
 ~^
insn-emit.c: In function ‘rtx_def* gen_roundv8sf2(rtx, rtx)’:
insn-emit.c:148194:14: warning: ‘operands[2]’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
 operand2 = operands[2];
 ~^
insn-emit.c: In function ‘rtx_def* gen_roundv4sf2(rtx, rtx)’:
insn-emit.c:148263:14: warning: ‘operands[2]’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
 operand2 = operands[2];
 ~^
insn-emit.c: In function ‘rtx_def* gen_roundv8df2(rtx, rtx)’:
insn-emit.c:148332:14: warning: ‘operands[2]’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
 operand2 = operands[2];
 ~^
insn-emit.c: In function ‘rtx_def* gen_roundv4df2(rtx, rtx)’:
insn-emit.c:148401:14: warning: ‘operands[2]’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
 operand2 = operands[2];
 ~^
insn-emit.c: In function ‘rtx_def* gen_roundv2df2(rtx, rtx)’:
insn-emit.c:148470:14: warning: ‘operands[2]’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
 operand2 = operands[2];
 ~^

[Bug sanitizer/81125] [7/8 Regression] -fsanitize=undefined ICE

2017-06-21 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81125

--- Comment #4 from Dominique d'Humieres  ---
Still fails on darwin

/opt/gcc/_clean/gcc/testsuite/g++.dg/ubsan/pr81125.C: In constructor 'A::A(long
int)':
/opt/gcc/_clean/gcc/testsuite/g++.dg/ubsan/pr81125.C:19:14: internal compiler
error: in make_decl_rtl, at varasm.c:1311
   long b = a % c;
~~^~~

[Bug inline-asm/70184] Explicit register variables holding function arguments overwritten by conversion libcall

2017-06-21 Thread ramana at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70184

Ramana Radhakrishnan  changed:

   What|Removed |Added

   Target Milestone|--- |6.3

--- Comment #11 from Ramana Radhakrishnan  ---
Fixed in 6.3

[Bug target/81142] Segmentation fault when using static __thread variables

2017-06-21 Thread tomas_paukrt at conel dot cz
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81142

--- Comment #7 from tomas_paukrt at conel dot cz ---
I attached another C source file that is even simpler.

Compiled program causes segmentation fault on AM335X (Cortex-A8) as well as on
SPEAr320S-2 (ARM926EJ-S).

Using option -ftls-model=initial-exec or -mtls-dialect=gnu2 leads to generating
different assembler code that do not cause segmentation fault.

[Bug bootstrap/81150] [8 Regression] GCC is miscompiled with -O3

2017-06-21 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81150

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |8.0

[Bug target/81142] Segmentation fault when using static __thread variables

2017-06-21 Thread tomas_paukrt at conel dot cz
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81142

--- Comment #6 from tomas_paukrt at conel dot cz ---
Created attachment 41595
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41595=edit
C source file without snprintf

[Bug ipa/81133] [8 Regression] PGO/LTO bootstrap: ICE: in inline_small_functions, at ipa-inline.c:1891

2017-06-21 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81133

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-06-21
 Ever confirmed|0   |1

[Bug bootstrap/81150] New: [8 Regression] GCC is miscompiled with -O3

2017-06-21 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81150

Bug ID: 81150
   Summary: [8 Regression] GCC is miscompiled with -O3
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: bootstrap
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

On Linux/x86-64, I saw

20083 hjl   20   0   69400   1488   1340 R 199.7  0.0 505:16.72 fib.exe

 6288 hjl   20   0   64288   2652   2328 R 100.0  0.0 246:38.57
fib-opr-overloa  
21594 hjl   20   0   64284   2736   2416 R 100.0  0.0 278:27.75
fib-opr-overloa  
 1181 hjl   20   0   64288   1512   1368 R  99.7  0.0 223:01.07
fib-opr-overloa

Executing on host: /export/gnu/import/git/gcc-test/bld/gcc/xgcc
-B/export/gnu/import/git/gcc-test/bld/gcc/
/export/gnu/import/git/gcc-test/src-trunk/gcc/testsuite/c-c++-common/cilk-plus/CK/fib.c
 -m32   
-B/export/gnu/import/git/gcc-test/bld/x86_64-pc-linux-gnu/32/libcilkrts/ 
-L/export/gnu/import/git/gcc-test/bld/x86_64-pc-linux-gnu/32/libcilkrts/.libs
-fno-diagnostics-show-caret -fdiagnostics-color=never   -g  -fcilkplus  -lm  -o
./fib.exe(timeout = 300)
spawn -ignore SIGHUP /export/gnu/import/git/gcc-test/bld/gcc/xgcc
-B/export/gnu/import/git/gcc-test/bld/gcc/
/export/gnu/import/git/gcc-test/src-trunk/gcc/testsuite/c-c++-common/cilk-plus/CK/fib.c
-m32 -B/export/gnu/import/git/gcc-test/bld/x86_64-pc-linux-gnu/32/libcilkrts/
-L/export/gnu/import/git/gcc-test/bld/x86_64-pc-linux-gnu/32/libcilkrts/.libs
-fno-diagnostics-show-caret -fdiagnostics-color=never -g -fcilkplus -lm -o
./fib.exe

when running GCC testsuite with r249394 when configured with

--prefix=/usr/8.0.0 --enable-clocale=gnu --with-system-zlib --enable-shared
--with-demangler-in-ld --enable-libmpx --with-build-config='bootstrap-O3
bootstrap-debug' --disable-werror --with-fpmath=sse

[Bug c++/81130] [6/7/8 Regression] ICE OpenMP shared clause in gimplify_var_or_parm_decl, at gimplify.c:2584

2017-06-21 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81130

--- Comment #3 from Jakub Jelinek  ---
Author: jakub
Date: Wed Jun 21 10:58:00 2017
New Revision: 249445

URL: https://gcc.gnu.org/viewcvs?rev=249445=gcc=rev
Log:
PR c++/81130
* gimplify.c (omp_add_variable): Don't force GOVD_SEEN for types
with ctors/dtors if GOVD_SHARED is set.

* testsuite/libgomp.c++/pr81130.C: New test.

Added:
trunk/libgomp/testsuite/libgomp.c++/pr81130.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/gimplify.c
trunk/libgomp/ChangeLog

[Bug ipa/81133] [8 Regression] PGO/LTO bootstrap: ICE: in inline_small_functions, at ipa-inline.c:1891

2017-06-21 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81133

Markus Trippelsdorf  changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com

--- Comment #1 from Markus Trippelsdorf  ---
*** Bug 81149 has been marked as a duplicate of this bug. ***

[Bug bootstrap/81149] [8 Regression] profiledbootstrap failed with LTO

2017-06-21 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81149

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||trippels at gcc dot gnu.org
 Resolution|--- |DUPLICATE

--- Comment #1 from Markus Trippelsdorf  ---
dup.

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

[Bug bootstrap/81149] [8 Regression] profiledbootstrap failed with LTO

2017-06-21 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81149

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-06-21
   Target Milestone|--- |8.0
 Ever confirmed|0   |1

[Bug bootstrap/81149] New: [8 Regression] profiledbootstrap failed with LTO

2017-06-21 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81149

Bug ID: 81149
   Summary: [8 Regression] profiledbootstrap failed with LTO
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: bootstrap
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hjl.tools at gmail dot com
CC: mliska at suse dot cz
  Target Milestone: ---

On Linux/x86-64, r249367 caused profiledbootstrap to fail with LTO:

lto1: internal compiler error: in inline_small_functions, at ipa-inline.c:1891
0x7dff38 inline_small_functions
/export/project/git/gcc-regression/gcc/gcc/ipa-inline.c:1891
0x7dff38 ipa_inline
/export/project/git/gcc-regression/gcc/gcc/ipa-inline.c:2429
0x7dff38 execute
/export/project/git/gcc-regression/gcc/gcc/ipa-inline.c:2835
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
lto-wrapper: fatal error:
/export/project/git/gcc-regression-bootstrap/master/249367/bld/./prev-gcc/xg++
returned 1 exit status
compilation terminated.
/usr/local/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
/export/project/git/gcc-regression/gcc/gcc/fortran/Make-lang.in:97: recipe for
target 'f951' failed
make[3]: *** [f951] Error 1

when configured with

 --prefix=/export/project/git/gcc-regression-bootstrap/master/249367/usr
--enable-clocale=gnu --with-system-zlib --with-demangler-in-ld
--enable-languages=c,c++,fortran --enable-bootstrap --with-fpmath=sse
--with-build-config=bootstrap-lto --disable-werror --disable-multilib
--disable-libcc1 --disable-libcilkrts --disable-libsanitizer

[Bug tree-optimization/80928] SLP vectorization does not handle induction in outer loop vectorization

2017-06-21 Thread ro at CeBiTec dot Uni-Bielefeld.DE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80928

--- Comment #20 from ro at CeBiTec dot Uni-Bielefeld.DE  ---
> --- Comment #18 from rguenther at suse dot de  ---
[...]
> I have not yet built a native i686 compiler with 64bit support but only
> tried a x86_64 -> i686 cross with 64bit support where it doesn't
> reproduce.

Now that you mention it, the ICE doesn't occur on both
x86_64-pc-linux-gnu and amd64-pc-solaris compilers, but only in the
i?86-*-* ones.

Rainer

[Bug c++/81134] C++ partial template specialization issue

2017-06-21 Thread manish.baphna at citi dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81134

--- Comment #4 from Manish  ---
Which section in particular you are referring?

I am looking at this doc, section 14.7 but couldn't find relevant point.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3690.pdf

  1   2   >