[Bug tree-optimization/77862] [7 Regression] ice in add_equivalence

2016-12-07 Thread kugan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77862

kugan at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #8 from kugan at gcc dot gnu.org ---
Fixed in trunk.

[Bug tree-optimization/77862] [7 Regression] ice in add_equivalence

2016-12-07 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77862

--- Comment #7 from David Binderman  ---
(In reply to Jakub Jelinek from comment #6)
> So is this fixed now?

It seems fixed to me. Latest gcc trunk.

[Bug rtl-optimization/78671] [7 Regression] ICE: in extract_constrain_insn, at recog.c:2213 with -Og -march=skylake-avx512

2016-12-07 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78671

--- Comment #4 from Uroš Bizjak  ---
(In reply to Vladimir Makarov from comment #3)

> It has just triggered a latent bug.  It is a pretty interesting bug.  The
> problem is that a TImode pseudo has class INT_SSE_REGS and r15(44) smoothly
> goes to xmm8 (45).  So using available regs in LRA, r15 is ok for the pseudo.
> 
> Actually on machine-depended side, a more detail implementation
> HARD_REGNO_MODE_OK could solve the problem.  But it is too complicated and
> error prone and require a lot of efforts to define the macro accurately for
> all classes and modes.
On machine-dependend side, there is HARD_REGNO_NREGS macro that should be taken
into account when allocating modes that live in multiple registers. This macro
returns 2 for r15 in TImode. There is no r16 available, so r15 should be
rejected as a TImode register from the beginning.

[Bug c/68725] suboptimal handling of constant compound literals

2016-12-07 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68725

--- Comment #2 from Andrew Pinski  ---
I think this has now been fixed on the trunk. There is a pass which combines
stores for constants.

[Bug fortran/78682] [Coarray] [OOP] ICE calling (locally) a TBP of a remote CAF derived type

2016-12-07 Thread damian at sourceryinstitute dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78682

Damian Rouson  changed:

   What|Removed |Added

 CC||damian at sourceryinstitute 
dot or
   ||g

--- Comment #5 from Damian Rouson  ---
In the August 31 draft of the Fortran 2015 standard, section 11.6.2, paragraph
3, the first bullet states, "if a variable is defined on an image in a segment,
it shall not be referenced, defined, or become undefined in a segment on
another image unless the segments are ordered".  In Stefano's example, the 
line 

core_caf%core_value = 1

defines a value on on image 1 that is later referenced on image 2 via

   if (this_image()==2) call core_caf[1]%core_value_print

but there is no image control statement between the definition and the
reference.  That makes the code non-conforming.

[Bug c/68725] suboptimal handling of constant compound literals

2016-12-07 Thread lukas at wunner dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68725

Lukas Wunner  changed:

   What|Removed |Added

 CC||lukas at wunner dot de

--- Comment #1 from Lukas Wunner  ---
I've just hit the same issue with the 128-bit UUIDs that are used all over the
place in the kernel, in particular in the EFI subsystem.


Reproducer:

#include 
#include 
#include 

typedef struct {
uint8_t b[16];
} efi_guid_t;

#define EFI_GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)   \
((const efi_guid_t) \
{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
   (b) & 0xff, ((b) >> 8) & 0xff,   \
   (c) & 0xff, ((c) >> 8) & 0xff,   \
   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})

#define EFI_RNG_ALGORITHM_RAW   EFI_GUID(0xe43176d7, 0xb6e8,
0x4827,  0xb7, 0x84, 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61)
#define EFI_CONSOLE_OUT_DEVICE_GUID EFI_GUID(0xd3b36f2c, 0xd551,
0x11d4,  0x9a, 0x46, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
#define EFI_MEMORY_ATTRIBUTES_TABLE_GUIDEFI_GUID(0xdcfa911d, 0x26eb,
0x469f,  0xa2, 0x20, 0x38, 0xb7, 0xdc, 0x46, 0x12, 0x20)
#define HCDP_TABLE_GUID EFI_GUID(0xf951938d, 0x620b,
0x42ef,  0x82, 0x79, 0xa8, 0x4b, 0x79, 0x61, 0x78, 0x98)

static int efi_print_guid_ptr(const efi_guid_t *vendor)
{
for (int i = 0; i < sizeof(efi_guid_t) ; i++)
printf("%hhX", vendor->b[i]);
printf("\n");
}

static int efi_print_guid(const efi_guid_t vendor)
{
for (int i = 0; i < sizeof(efi_guid_t) ; i++)
printf("%hhX", vendor.b[i]);
printf("\n");
}

void main()
{
const efi_guid_t guid1 = EFI_RNG_ALGORITHM_RAW;
const efi_guid_t guid2 = EFI_MEMORY_ATTRIBUTES_TABLE_GUID;

efi_print_guid_ptr();
efi_print_guid_ptr(_TABLE_GUID);

efi_print_guid(guid2);
efi_print_guid(EFI_CONSOLE_OUT_DEVICE_GUID);
}


Compiled with -O2 (no other options) on x86_64 results in:

00400440 :
  400440:   55  push   %rbp
  400441:   53  push   %rbx
  400442:   48 83 ec 48 sub$0x48,%rsp
  400446:   48 89 e7mov%rsp,%rdi
  400449:   c6 04 24 d7 movb   $0xd7,(%rsp)
  40044d:   c6 44 24 01 76  movb   $0x76,0x1(%rsp)
  400452:   c6 44 24 02 31  movb   $0x31,0x2(%rsp)
  400457:   c6 44 24 03 e4  movb   $0xe4,0x3(%rsp)
  40045c:   48 8d 5c 24 30  lea0x30(%rsp),%rbx
  400461:   c6 44 24 04 e8  movb   $0xe8,0x4(%rsp)
  400466:   c6 44 24 05 b6  movb   $0xb6,0x5(%rsp)
  40046b:   48 8d 6c 24 40  lea0x40(%rsp),%rbp
  400470:   c6 44 24 06 27  movb   $0x27,0x6(%rsp)
  400475:   c6 44 24 07 48  movb   $0x48,0x7(%rsp)
  40047a:   c6 44 24 08 b7  movb   $0xb7,0x8(%rsp)
  40047f:   c6 44 24 09 84  movb   $0x84,0x9(%rsp)
  400484:   c6 44 24 0a 7f  movb   $0x7f,0xa(%rsp)
  400489:   c6 44 24 0b fd  movb   $0xfd,0xb(%rsp)
  40048e:   c6 44 24 0c c4  movb   $0xc4,0xc(%rsp)
  400493:   c6 44 24 0d b6  movb   $0xb6,0xd(%rsp)
  400498:   c6 44 24 0e 85  movb   $0x85,0xe(%rsp)
  40049d:   c6 44 24 0f 61  movb   $0x61,0xf(%rsp)
  4004a2:   e8 f9 01 00 00  callq  4006a0 
  4004a7:   48 8d 7c 24 10  lea0x10(%rsp),%rdi
  4004ac:   c6 44 24 10 8d  movb   $0x8d,0x10(%rsp)
  4004b1:   c6 44 24 11 93  movb   $0x93,0x11(%rsp)
  4004b6:   c6 44 24 12 51  movb   $0x51,0x12(%rsp)
  4004bb:   c6 44 24 13 f9  movb   $0xf9,0x13(%rsp)
  4004c0:   c6 44 24 14 0b  movb   $0xb,0x14(%rsp)
  4004c5:   c6 44 24 15 62  movb   $0x62,0x15(%rsp)
  4004ca:   c6 44 24 16 ef  movb   $0xef,0x16(%rsp)
  4004cf:   c6 44 24 17 42  movb   $0x42,0x17(%rsp)
  4004d4:   c6 44 24 18 82  movb   $0x82,0x18(%rsp)
  4004d9:   c6 44 24 19 79  movb   $0x79,0x19(%rsp)
  4004de:   c6 44 24 1a a8  movb   $0xa8,0x1a(%rsp)
  4004e3:   c6 44 24 1b 4b  movb   $0x4b,0x1b(%rsp)
  4004e8:   c6 44 24 1c 79  movb   $0x79,0x1c(%rsp)
  4004ed:   c6 44 24 1d 61  movb   $0x61,0x1d(%rsp)
  4004f2:   c6 44 24 1e 78  movb   $0x78,0x1e(%rsp)
  4004f7:   c6 44 24 1f 98  movb   $0x98,0x1f(%rsp)
  4004fc:   e8 9f 01 00 00  callq  4006a0 
  400501:   48 8b 05 78 02 00 00mov0x278(%rip),%rax  # 400780

  400508:   48 8b 15 79 02 00 00mov0x279(%rip),%rdx  # 400788

  40050f:   48 89 44 24 

Re: Possible bug with switch when optimization is turned on.

2016-12-07 Thread Jim Wilson

On 12/05/2016 03:24 PM, luke B wrote:

The following code seems to be correctly executed when compiled with
GCC 4.4.7 and LLVM 6.1. It does not correctly compile with gcc version
5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4).


I created a bug report and added some info.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78731

Jim



[Bug tree-optimization/78731] Possible bug with switch when optimization is turned on.

2016-12-07 Thread wilson at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78731

Jim Wilson  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-12-08
Version|5.4.1   |5.4.0
 Ever confirmed|0   |1

--- Comment #1 from Jim Wilson  ---
I can reproduce with gcc-5.4 on x86_64 and aarch64.  But not with gcc-6.

The problem appears in the dom2 tree dump, where the switch statement is
optimized incorrectly.

git bisect tracked the fix down to a patch from Jeff Law.  However, this patch
appears to be an optimization, not a bug fix, so it isn't obvious why it fixes
the problem.  I haven't tried debugging dom to see what the problem is yet.

Jeff's patch is
https://gcc.gnu.org/ml/gcc-patches/2015-09/msg02391.html

2015-09-30  Jeff Law  

* tree-ssa-dom.c (optimize_stmt): Collapse control flow statements
with constant conditions.
* tree-ssa-threadupdate.c (remove_jump_threads_starting_at): New.
(remove_ctrl_stmt_and_useless_edges): No longer static.
* tree-ssa-threadupdate.h (remove_jump_threads_starting_at): Prototype.
(remove_ctrl_stmt_and_useless_edges): Likewise.

On the main branch, the first good git revision is
f1344f45994243478b1f4225e676446fedf18bf5.  The last bad git revision is
a4f58df11093c1253f9648e0ffa7fbdf604d05c2.

[Bug fortran/59997] c_pointer = c_loc(...) internal compiler error

2016-12-07 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59997

kargl at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P3  |P4
 Status|NEW |WAITING
 CC||kargl at gcc dot gnu.org
   Severity|major   |normal

--- Comment #9 from kargl at gcc dot gnu.org ---
The original code in comment #1 compiles and executes.
Is there some reason why this PR is still open?

[Bug tree-optimization/78731] New: Possible bug with switch when optimization is turned on.

2016-12-07 Thread wilson at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78731

Bug ID: 78731
   Summary: Possible bug with switch when optimization is turned
on.
   Product: gcc
   Version: 5.4.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: wilson at gcc dot gnu.org
  Target Milestone: ---

Creating a bug from the original message, which is here
https://gcc.gnu.org/ml/gcc-bugs/2016-12/msg00678.html

Hi

The following code seems to be correctly executed when compiled with
GCC 4.4.7 and LLVM 6.1. It does not correctly compile with gcc version
5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4).

The following is what I have reduced the problem to:

#include 
#include 

#define GENERAL 1
#define BRACKETS 2
#define QUOTES 3

//This method contains the issue.
void foo(char *qb, char* into) {
  //The starting state is important for the bug.
  int state = QUOTES;
  int save_state = BRACKETS;

  while (qb) { //Always true, it seems this can't just be '1'
printf("State is %d\n", state);
switch (state) {
case BRACKETS:
  printf("Yay this was correctly executed\n");
  exit(0);
  break;
case GENERAL:
printf("Oh no how did you get here?\n");
printf("State is %d\n", state);
exit(1);
  break;
case QUOTES:
state = save_state;
printf("State went to %d btw BRACKETS is %d\n", state, BRACKETS);
save_state = GENERAL; //Remove this line and it will work even
when optimised.
printf("After save state, state went to %d btw BRACKETS is
%d\n", state, BRACKETS);
  break;
default: ;
}
printf("State %d btw GENERAL %d\n", state, GENERAL);
  }
  printf("If you see this then something is really wrong.\n");
  exit(4);
}

int main() {
//These don't seem to matter don't concern yourself with them.
char *b = "123";
char out[4];
foo(b, out);
return 1;
}

If I compile this with:
gcc -O0 -g -Wall -Werror sillyswitch.c -o sillyswitch

It will correctly print "Yay this was correctly executed"

However if I compile this with:
gcc -O -g -Wall -Werror sillyswitch.c -o sillyswitch

It will print "Oh no how did you get here?"

I suspect this is a bug. I am unable to create an account to report
this as a bug though.

-Luke

[Bug fortran/65173] ICE while compiling wrong code

2016-12-07 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65173

--- Comment #12 from kargl at gcc dot gnu.org ---
Patch posted to fort...@gcc.gnu.org

[Bug fortran/68439] ICE in alloc_scalar_allocatable_for_subcomponent_assignment, at fortran/trans-expr.c:6711

2016-12-07 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68439

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu.org

--- Comment #3 from kargl at gcc dot gnu.org ---
(In reply to Gerhard Steinmetz from comment #2)
> ICE is completely gone for all tested constellations with
> gcc-Version 7.0.0 20160821 (experimental) (GCC)

Is the testcase suppose to compile without error?

[Bug rtl-optimization/78730] New: [7 Regression] ICE in rtl_verify_bb_insns, at cfgrtl.c:2656 (error: flow control insn inside a basic block)

2016-12-07 Thread asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78730

Bug ID: 78730
   Summary: [7 Regression] ICE in rtl_verify_bb_insns, at
cfgrtl.c:2656 (error: flow control insn inside a basic
block)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: asolokha at gmx dot com
  Target Milestone: ---
Target: powerpc-*-linux-gnu*

gcc-7.0.0-alpha20161204 snapshot ICEs when compiling the following snippet w/
-Os:

int k0;

void
fn1 (int bu, int z1)
{
  signed char x6;
  int *nr = (bu != 0) ?  : 

  for (;;)
{
  unsigned char *qj = (unsigned char *)bu;

  x6 = *qj;
  z1 = (x6 != 0 && (bu / 0) != 0);
  *nr = (k0 == z1) ? 1 : 2;

  if (qj != 0)
z1 = 1;
  else
x6 *= 2;

  x6 += 3;
  if (x6 < z1)
{
  z1 = (z1 != 0) ? (x6 < 1) : 1;
  if (z1 != 0)
bu = 3;
  --bu;
  k0 /= 0;
}
}
}

% powerpc-e300c3-linux-gnu-gcc-7.0.0-alpha20161204 -Os -w -c q0fqbzjz.c 
q0fqbzjz.c: In function 'fn1':
q0fqbzjz.c:32:1: error: in basic block 12:
 }
 ^
q0fqbzjz.c:32:1: error: flow control insn inside a basic block
(insn 104 127 65 12 (trap_if (const_int 1 [0x1])
(const_int 0 [0])) 823 {trap}
 (nil))
q0fqbzjz.c:32:1: internal compiler error: in rtl_verify_bb_insns, at
cfgrtl.c:2656
0x2e5e5fdec35 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/rtl-error.c:108
0x2e5e5ba5117 rtl_verify_bb_insns
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfgrtl.c:2656
0x2e5e5ba5117 rtl_verify_flow_info_1
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfgrtl.c:2742
0x2e5e5ba5184 rtl_verify_flow_info
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfgrtl.c:2984
0x2e5e5b9131d verify_flow_info()
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfghooks.c:258
0x2e5e66bcdc6 checking_verify_flow_info
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfghooks.h:198
0x2e5e66bcdc6 try_optimize_cfg
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfgcleanup.c:2988
0x2e5e66bcdc6 cleanup_cfg(int)
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfgcleanup.c:3152
0x2e5e5e5dbce do_reload
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/ira.c:5435
0x2e5e5e5dbce execute
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/ira.c:5570

[Bug rtl-optimization/78729] New: [7 Regression] ICE in rtl_verify_bb_insns, at cfgrtl.c:2656 (error: flow control insn inside a basic block)

2016-12-07 Thread asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78729

Bug ID: 78729
   Summary: [7 Regression] ICE in rtl_verify_bb_insns, at
cfgrtl.c:2656 (error: flow control insn inside a basic
block)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: asolokha at gmx dot com
  Target Milestone: ---
Target: powerpc-*-linux-gnu*

gcc-7.0.0-alpha20161204 snapshot ICEs when compiling the following snippet w/
-Os:

int k0;

void
p9 (int bu, int z1)
{
  signed char x6;
  int *nr = (bu != 0) ?  : 

  for (;;)
{
  unsigned char *qj;

  bu = k0;
  qj = (unsigned char *)bu;
  x6 = *qj;
  z1 = (x6 != 0 && (z1 / 0) != 0);
  bu += z1;
  k0 = (bu != 0) ? 0 : 2;

  if (qj != 0)
{
  x6 *= 2;
  z1 = x6;
}

  ++x6;
  if (z1 > x6)
{
  ((k0 != 0) ? (x6 < 1) : *nr) && (++z1);
  --z1;
  k0 /= 0;
}
}
}

% powerpc-e300c3-linux-gnu-gcc-7.0.0-alpha20161204 -Os -w -c pl8gmryz.c 
pl8gmryz.c:34:1: error: in basic block 14:
 }
 ^
pl8gmryz.c:34:1: error: flow control insn inside a basic block
(insn 118 57 149 14 (trap_if (const_int 1 [0x1])
(const_int 0 [0])) 823 {trap}
 (nil))
pl8gmryz.c:34:1: internal compiler error: in rtl_verify_bb_insns, at
cfgrtl.c:2656
0x2ca8305dc35 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/rtl-error.c:108
0x2ca82c24117 rtl_verify_bb_insns
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfgrtl.c:2656
0x2ca82c24117 rtl_verify_flow_info_1
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfgrtl.c:2742
0x2ca82c24184 rtl_verify_flow_info
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfgrtl.c:2984
0x2ca82c1031d verify_flow_info()
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfghooks.c:258
0x2ca82c2af21 execute
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfgrtl.c:3569

[Bug rtl-optimization/78727] New: [7 Regression] ICE in rtl_verify_bb_insns, at cfgrtl.c:2656 (error: flow control insn inside a basic block)

2016-12-07 Thread asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78727

Bug ID: 78727
   Summary: [7 Regression] ICE in rtl_verify_bb_insns, at
cfgrtl.c:2656 (error: flow control insn inside a basic
block)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: asolokha at gmx dot com
  Target Milestone: ---
Target: powerpc-*-linux-gnu*

gcc-7.0.0-alpha20161204 snapshot ICEs when compiling the following snippet w/
-O2:

int
dd (int gj, unsigned int o7)
{
  long long int e8 = gj;

  e8 |= gj + 1u;
  if (e8 != 0)
{
  short int *mn = (short int *)
  int pv;

  e8 &= e8 > gj;
  gj = o7 > e8;
  pv = ((gj != 0) ? gj : *mn) && e8;
  gj |= *mn / pv;
}

  return gj;
}

% powerpc-e300c3-linux-gnu-gcc-7.0.0-alpha20161204 -O2 -c hvquiakt.c
hvquiakt.c: In function 'dd':
hvquiakt.c:19:1: error: in basic block 5:
 }
 ^
hvquiakt.c:19:1: error: flow control insn inside a basic block
(insn 121 61 135 5 (trap_if (const_int 1 [0x1])
(const_int 0 [0])) 823 {trap}
 (nil))
hvquiakt.c:19:1: internal compiler error: in rtl_verify_bb_insns, at
cfgrtl.c:2656
0x2b36917ec35 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/rtl-error.c:108
0x2b368d45117 rtl_verify_bb_insns
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfgrtl.c:2656
0x2b368d45117 rtl_verify_flow_info_1
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfgrtl.c:2742
0x2b368d3131d verify_flow_info()
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfghooks.c:258
0x2b36985cdc6 checking_verify_flow_info
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfghooks.h:198
0x2b36985cdc6 try_optimize_cfg
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfgcleanup.c:2988
0x2b36985cdc6 cleanup_cfg(int)
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfgcleanup.c:3152
0x2b3698488aa execute
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/bb-reorder.c:2571

[Bug rtl-optimization/78728] New: [7 Regression] ICE in rtl_verify_bb_insns, at cfgrtl.c:2656 (error: flow control insn inside a basic block)

2016-12-07 Thread asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78728

Bug ID: 78728
   Summary: [7 Regression] ICE in rtl_verify_bb_insns, at
cfgrtl.c:2656 (error: flow control insn inside a basic
block)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Keywords: ice-on-valid-code
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: asolokha at gmx dot com
  Target Milestone: ---
Target: powerpc-*-linux-gnu*

gcc-7.0.0-alpha20161204 snapshot ICEs when compiling the following snippet w/
-Os:

int k0;

void
ur (int bu, int z1)
{
  signed char x6;
  char *sk = (char *)
  unsigned char *qj;

  bu = k0;
  qj = (unsigned char *)bu;
  x6 = *qj;
  z1 = (x6 != 0 && (z1 / 0) != 0);
  k0 = (bu != 0) ? 0 : 2;

  if (qj != 0)
{
  x6 *= 2;
  z1 = x6;
}

  ++x6;
  if (z1 > x6)
{
  ((z1 != 0) ? (x6 < 1) : *sk) && (++k0);
  k0 /= 0;
}
}

% powerpc-e300c3-linux-gnu-gcc-7.0.0-alpha20161204 -Os -w -c k5naowlz.c
k5naowlz.c: In function 'ur':
k5naowlz.c:28:1: error: in basic block 8:
 }
 ^
k5naowlz.c:28:1: error: flow control insn inside a basic block
(insn 103 47 65 8 (trap_if (const_int 1 [0x1])
(const_int 0 [0])) 823 {trap}
 (nil))
k5naowlz.c:28:1: internal compiler error: in rtl_verify_bb_insns, at
cfgrtl.c:2656
0x30d23c30c35 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/rtl-error.c:108
0x30d237f7117 rtl_verify_bb_insns
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfgrtl.c:2656
0x30d237f7117 rtl_verify_flow_info_1
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfgrtl.c:2742
0x30d237e331d verify_flow_info()
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfghooks.c:258
0x30d2430edc6 checking_verify_flow_info
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfghooks.h:198
0x30d2430edc6 try_optimize_cfg
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfgcleanup.c:2988
0x30d2430edc6 cleanup_cfg(int)
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/cfgcleanup.c:3152
0x30d2432cddd rest_of_handle_combine
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/combine.c:14608
0x30d2432cddd execute
   
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-7.0.0_alpha20161204/work/gcc-7-20161204/gcc/combine.c:14642

[Bug target/78382] ICE when compiling on aarch64 in ILP32 mode with traditional thread local storage and pic

2016-12-07 Thread hs.naveen2u at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78382

--- Comment #2 from hs.naveen2u at gmail dot com ---
Fixed and Committed as:-
https://gcc.gnu.org/viewcvs/gcc?view=revision=243428

[Bug target/71112] [6/7 Regression] ICE with -fpie on aarch64 ILP32 big-endian

2016-12-07 Thread hs.naveen2u at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71112

hs.naveen2u at gmail dot com changed:

   What|Removed |Added

 CC||hs.naveen2u at gmail dot com

--- Comment #6 from hs.naveen2u at gmail dot com ---
Fixed and Committed as:-
https://gcc.gnu.org/ml/gcc-cvs/2016-12/msg00338.html

[Bug fortran/69860] ICE on missing end apostrophe with character(kind=4)

2016-12-07 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69860

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||janus at gcc dot gnu.org

--- Comment #13 from kargl at gcc dot gnu.org ---
(In reply to kargl from comment #12)
> (In reply to Gerhard Steinmetz from comment #11)
> > And with "kind=4" instead of "kind=1", i.e. with testfile z1.f90 ?
> > 
> > 
> > for n in `seq 1 1000`
> > do
> >gfortran-7-20160821 -O2 -mavx -c z1.f90
> > done > list 2>&1
> > 
> > grep 'internal compiler' list | wc
> > 9465676   47300
> > 
> > 
> > I can also confirm that ICEs are gone for z2.f90 ("kind=1").
> 
> Ugh.  I was testing apparently a kind=1 version.  The problem
> is that gfortran is inserting __convert_s1_s4 to convert to
> the same kind, which of course fails.  This un-regression-tested
> patch covers up the ICE, but it is perhaps not the correct fix.
> Fortunately, I don't use kind=4 character types, so I don't have
> a dog in this fight.
> 

This might have been fixed by Janus patch:

2016-12-04  Janus Weil  

PR fortran/78618
* intrinsic.c (gfc_convert_type_warn): Do not set the full typespec for
the conversion symbol, but only type and kind. Set the full typespec
for the expression.
(gfc_convert_chartype): Ditto.

Gerhard can re-do your testing.  I seem to have good luck with FreeBSD
in testing this.

[Bug middle-end/78703] -fprintf-return-value floating point handling incorrect in locales with a mulltibyte decimal point

2016-12-07 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78703

--- Comment #4 from Martin Sebor  ---
I agree.  It's hard to strike a balance between false positives and false
negatives.

FYI: The pass tracks three byte counters for every sprintf call: exact (for
values we know are exact), minimum (optimistic), and maximum (worst case), and
two for each directive (minimum and maximum; when they're the same the count is
exact).  It also uses some flags: the bounded flag[1] indicates that the
function's output/return value is guaranteed to be bounded by the range (i.e.,
it can be used for optimization); and the knownrange flag indicates that the
range comes from values in known ranges (e.g., determined by VRP).

To decide what to diagnose the pass uses the exact counter when it's available.
 When it isn't (because a directive's exact output cannot be determined[2]), at
level one it uses the minimum counter and at level two the maximum.  It also
uses the knownrange flag to fine tune the text of the diagnostics.  There's
some hardwired fuzzy logic here to help diagnose what's likely (like unknown
strings are assumed to have a length of 0 at level 1, and a length of 1 at
level 2, though I'm not sure how useful this is).  This logic could be
generalized (e.g., by adding another counter) to make the warnings even more
independent of the optimization.

---
[1] I think the bounded flag might be unnecessary because all output is bounded
by INT_MAX (and so if the result is less than INT_MAX it's implicitly bounded).
[2] Such as for directives with unknown width specified by an asterisk, or
strings of unknown length, or numbers with a precision specified by an
asterisk.

[Bug c/78666] conflicting attribute alloc_size accepted

2016-12-07 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78666

--- Comment #3 from Martin Sebor  ---
Attribute format suffers from a similar problem.

(I'm not looking for ways to break things, btw., but rather trying to come up
with a test to exercise my patch for bug 78673 in whose review Jeff pointed out
I wasn't handling attribute nonnull quite right.  I'm looking at how other
attributes are being handled to make sure they're all consistent.)

$ cat a.c && /build/gcc-git/gcc/xgcc -B /build/gcc-git/gcc -S -Wall -Wextra a.c
#define P(f, a) __attribute__ ((format (printf, f, a)))

void P (1, 3) P (2, 3) f1 (const char*, const char *, ...);

void P (1, 3) f2 (const char*, const char *, ...);
void P (2, 3) f2 (const char*, const char *, ...);

void g (void)
{
  f1 ("%i", "%s", "123");

  f2 ("%i", "%s", "123");
}
a.c: In function ‘g’:
a.c:10:9: warning: format ‘%i’ expects argument of type ‘int’, but argument 3
has type ‘char *’ [-Wformat=]
   f1 ("%i", "%s", "123");
~^ ~
%s
a.c:12:9: warning: format ‘%i’ expects argument of type ‘int’, but argument 3
has type ‘char *’ [-Wformat=]
   f2 ("%i", "%s", "123");
~^ ~
%s

[Bug middle-end/78726] New: [5/6/7 Regression] Incorrect unsigned arithmetic optimization

2016-12-07 Thread babokin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78726

Bug ID: 78726
   Summary: [5/6/7 Regression] Incorrect unsigned arithmetic
optimization
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: babokin at gmail dot com
  Target Milestone: ---

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

-O2 produces different result than -O0 for unsigned arithmetic.

Reproduces with gcc 5, 6, and 7, while 4.9 works fine.

> cat driver.cpp
#include 

unsigned char A = 36;
unsigned char B = 173;
unsigned long int C;

extern void foo ();

int main () {
foo ();
printf("%lu\n", C);
return 0;
}
> cat func.cpp
extern unsigned char A;
extern unsigned char B;
extern unsigned long int C;

void foo() {
  unsigned a = ~A;
  C = a * B * B + 1023094746 * a;
}

> g++ -O0 -o no_opt driver.cpp func.cpp
> ./no_opt
799092689
> g++ -O2 -o opt driver.cpp func.cpp
> ./opt
800200062

[Bug middle-end/78153] strlen return value can be assumed to be less than PTRDIFF_MAX

2016-12-07 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78153

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #5 from Martin Sebor  ---
Implemented in r242786.

[Bug libstdc++/78723] [variant] P0393r3: "Making variant greater equal again" is unimplemented

2016-12-07 Thread timshen at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78723

Tim Shen  changed:

   What|Removed |Added

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

--- Comment #1 from Tim Shen  ---
I refuse to implement this due to a different political stance.

Just kidding ;). Assigned to myself.

[Bug middle-end/78138] missing warnings on buffer overflow with non-constant source length

2016-12-07 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78138

--- Comment #2 from Martin Sebor  ---
Implemented in 7.0 via r243419.

[Bug middle-end/77784] duplicate warning for snprintf when n > object size

2016-12-07 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77784

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=78138
 Resolution|--- |FIXED

--- Comment #4 from Martin Sebor  ---
Fixed in r243419.

[Bug c/53562] Add -Werror= support for -D_FORTIFY_SOURCE / __builtin___memcpy_chk

2016-12-07 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53562

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=77784
 Resolution|--- |FIXED

--- Comment #5 from Martin Sebor  ---
Implemented in r243419.

[Bug middle-end/78149] missing warning on strncpy buffer overflow due to an excessive bound

2016-12-07 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78149

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=53562,
   ||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=77784
 Resolution|--- |FIXED

--- Comment #4 from Martin Sebor  ---
Fixed by 243419.

[Bug rtl-optimization/78638] [7 regression] test cases gcc.target/powerpc/rlwimi-0.c and rlwimi-2.c fail starting with r243000

2016-12-07 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78638

Segher Boessenkool  changed:

   What|Removed |Added

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

--- Comment #7 from Segher Boessenkool  ---
All fixed now.

[Bug rtl-optimization/78638] [7 regression] test cases gcc.target/powerpc/rlwimi-0.c and rlwimi-2.c fail starting with r243000

2016-12-07 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78638

--- Comment #6 from Segher Boessenkool  ---
Author: segher
Date: Thu Dec  8 00:09:01 2016
New Revision: 243420

URL: https://gcc.gnu.org/viewcvs?rev=243420=gcc=rev
Log:
simplify-rtx: Fix the last fix (PR78638)

I managed to get the last obvious fix wrong: mode is M1, GET_MODE (op)
is M2.

[ adding missing PR marker ]


PR rtl-optimization/78638
* simplify-rtx.c (simplify_truncation): M2 is not mode, it is
GET_MODE (op).  Fix this.

Modified:
trunk/gcc/ChangeLog

[Bug middle-end/77784] duplicate warning for snprintf when n > object size

2016-12-07 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77784

--- Comment #3 from Martin Sebor  ---
Author: msebor
Date: Thu Dec  8 00:01:33 2016
New Revision: 243419

URL: https://gcc.gnu.org/viewcvs?rev=243419=gcc=rev
Log:
PR c/53562 - Add -Werror= support for -D_FORTIFY_SOURCE /
__builtin___memcpy_chk
PR middle-end/77784 - duplicate warning for snprintf when n > object size
PR middle-end/78149 - missing warning on strncpy buffer overflow due to an
excessive bound
PR middle-end/78138 - missing warnings on buffer overflow with non-constant
source length

gcc/c-family/ChangeLog:

PR c/53562
PR middle-end/77784
PR middle-end/78149
PR middle-end/78138
* c.opt (-Wstringop-overflow): New option.

gcc/ChangeLog:

PR middle-end/77784
PR middle-end/78149
PR middle-end/78138

* builtins.c (expand_builtin_strcat, expand_builtin_strncat): New
functions.
(compute_dest_size, get_size_range, check_sizes, check_strncat_sizes)
(check_memop_sizes): Same.
(expand_builtin_memcpy): Call check memop_sizes.
(expand_builtin_mempcpy): Same.
(expand_builtin_memset): Same,
(expand_builtin_bzero): Same.
(expand_builtin_memory_chk): Call check_sizes.
(expand_builtin_strcpy): Same.
(expand_builtin_strncpy): Same.
(maybe_emit_sprintf_chk_warning): Same.
(expand_builtin): Handle strcat and strncat.
(fini_object_sizes): Reset pointers.
(compute_object_size): New function.
* gimple-ssa-sprintf.c (pass_sprintf_length::handle_gimple_call):
Avoid issuing warnings also issued during built-in expansion.
* doc/invoke.texi (Warning Options): Document -Wstringop-overflow.

gcc/testsuite/ChangeLog:

PR middle-end/77784
PR middle-end/78149
PR middle-end/78138

* c-c++-common/Wsizeof-pointer-memaccess2.c: Adjust expected
diagnostic.
* g++.dg/ext/builtin-object-size3.C (bar): Same.
* g++.dg/ext/strncpy-chk1.C: Same.
* g++.dg/opt/memcpy1.C: Same.
* g++.dg/torture/Wsizeof-pointer-memaccess1.C: Same.
* gcc.c-torture/compile/pr55569.c: Disable -Wstringop-overflow.
* gcc.dg/Wobjsize-1.c: Adjust expected diagnostic.
* gcc.dg/attr-alloc_size.c: Same.
* gcc.dg/builtin-stringop-chk-1.c: Adjust expected diagnostic.
* gcc.dg/builtin-stringop-chk-2.c: Same.
* gcc.dg/builtin-stringop-chk-4.c: New test.
* gcc.dg/builtin-strncat-chk-1.c: Adjust expected diagnostic.
* gcc.dg/memcpy-2.c: Same.
* gcc.dg/pr40340-1.c: Same.
* gcc.dg/pr40340-2.c (main): Same.
* gcc.dg/pr40340-5.c (main): Same.
* gcc.dg/torture/Wsizeof-pointer-memaccess1.c: Same.
* gcc.dg/torture/pr71132.c: Disable -Wstringop-overflow.
* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Adjust text of expected
warning.
* gfortran.dg/char_length_3.f90: Prune expected warnings.
* gfortran.dg/pr38868.f: Add expected warnings.


Added:
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-4.c
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-5.c
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-6.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c.opt
trunk/gcc/doc/invoke.texi
trunk/gcc/gimple-ssa-sprintf.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess2.c
trunk/gcc/testsuite/g++.dg/ext/builtin-object-size3.C
trunk/gcc/testsuite/g++.dg/ext/strncpy-chk1.C
trunk/gcc/testsuite/g++.dg/opt/memcpy1.C
trunk/gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess1.C
trunk/gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess2.C
trunk/gcc/testsuite/gcc.c-torture/compile/pr55569.c
trunk/gcc/testsuite/gcc.dg/Wobjsize-1.c
trunk/gcc/testsuite/gcc.dg/attr-alloc_size.c
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-1.c
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-2.c
trunk/gcc/testsuite/gcc.dg/builtin-strncat-chk-1.c
trunk/gcc/testsuite/gcc.dg/fstack-protector-strong.c
trunk/gcc/testsuite/gcc.dg/memcpy-2.c
trunk/gcc/testsuite/gcc.dg/pr40340-1.c
trunk/gcc/testsuite/gcc.dg/pr40340-2.c
trunk/gcc/testsuite/gcc.dg/pr40340-5.c
trunk/gcc/testsuite/gcc.dg/torture/Wsizeof-pointer-memaccess1.c
trunk/gcc/testsuite/gcc.dg/torture/pr71132.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c
trunk/gcc/testsuite/gfortran.dg/char_length_3.f90
trunk/gcc/testsuite/gfortran.dg/pr38868.f

[Bug middle-end/78149] missing warning on strncpy buffer overflow due to an excessive bound

2016-12-07 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78149

--- Comment #3 from Martin Sebor  ---
Author: msebor
Date: Thu Dec  8 00:01:33 2016
New Revision: 243419

URL: https://gcc.gnu.org/viewcvs?rev=243419=gcc=rev
Log:
PR c/53562 - Add -Werror= support for -D_FORTIFY_SOURCE /
__builtin___memcpy_chk
PR middle-end/77784 - duplicate warning for snprintf when n > object size
PR middle-end/78149 - missing warning on strncpy buffer overflow due to an
excessive bound
PR middle-end/78138 - missing warnings on buffer overflow with non-constant
source length

gcc/c-family/ChangeLog:

PR c/53562
PR middle-end/77784
PR middle-end/78149
PR middle-end/78138
* c.opt (-Wstringop-overflow): New option.

gcc/ChangeLog:

PR middle-end/77784
PR middle-end/78149
PR middle-end/78138

* builtins.c (expand_builtin_strcat, expand_builtin_strncat): New
functions.
(compute_dest_size, get_size_range, check_sizes, check_strncat_sizes)
(check_memop_sizes): Same.
(expand_builtin_memcpy): Call check memop_sizes.
(expand_builtin_mempcpy): Same.
(expand_builtin_memset): Same,
(expand_builtin_bzero): Same.
(expand_builtin_memory_chk): Call check_sizes.
(expand_builtin_strcpy): Same.
(expand_builtin_strncpy): Same.
(maybe_emit_sprintf_chk_warning): Same.
(expand_builtin): Handle strcat and strncat.
(fini_object_sizes): Reset pointers.
(compute_object_size): New function.
* gimple-ssa-sprintf.c (pass_sprintf_length::handle_gimple_call):
Avoid issuing warnings also issued during built-in expansion.
* doc/invoke.texi (Warning Options): Document -Wstringop-overflow.

gcc/testsuite/ChangeLog:

PR middle-end/77784
PR middle-end/78149
PR middle-end/78138

* c-c++-common/Wsizeof-pointer-memaccess2.c: Adjust expected
diagnostic.
* g++.dg/ext/builtin-object-size3.C (bar): Same.
* g++.dg/ext/strncpy-chk1.C: Same.
* g++.dg/opt/memcpy1.C: Same.
* g++.dg/torture/Wsizeof-pointer-memaccess1.C: Same.
* gcc.c-torture/compile/pr55569.c: Disable -Wstringop-overflow.
* gcc.dg/Wobjsize-1.c: Adjust expected diagnostic.
* gcc.dg/attr-alloc_size.c: Same.
* gcc.dg/builtin-stringop-chk-1.c: Adjust expected diagnostic.
* gcc.dg/builtin-stringop-chk-2.c: Same.
* gcc.dg/builtin-stringop-chk-4.c: New test.
* gcc.dg/builtin-strncat-chk-1.c: Adjust expected diagnostic.
* gcc.dg/memcpy-2.c: Same.
* gcc.dg/pr40340-1.c: Same.
* gcc.dg/pr40340-2.c (main): Same.
* gcc.dg/pr40340-5.c (main): Same.
* gcc.dg/torture/Wsizeof-pointer-memaccess1.c: Same.
* gcc.dg/torture/pr71132.c: Disable -Wstringop-overflow.
* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Adjust text of expected
warning.
* gfortran.dg/char_length_3.f90: Prune expected warnings.
* gfortran.dg/pr38868.f: Add expected warnings.


Added:
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-4.c
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-5.c
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-6.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c.opt
trunk/gcc/doc/invoke.texi
trunk/gcc/gimple-ssa-sprintf.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess2.c
trunk/gcc/testsuite/g++.dg/ext/builtin-object-size3.C
trunk/gcc/testsuite/g++.dg/ext/strncpy-chk1.C
trunk/gcc/testsuite/g++.dg/opt/memcpy1.C
trunk/gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess1.C
trunk/gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess2.C
trunk/gcc/testsuite/gcc.c-torture/compile/pr55569.c
trunk/gcc/testsuite/gcc.dg/Wobjsize-1.c
trunk/gcc/testsuite/gcc.dg/attr-alloc_size.c
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-1.c
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-2.c
trunk/gcc/testsuite/gcc.dg/builtin-strncat-chk-1.c
trunk/gcc/testsuite/gcc.dg/fstack-protector-strong.c
trunk/gcc/testsuite/gcc.dg/memcpy-2.c
trunk/gcc/testsuite/gcc.dg/pr40340-1.c
trunk/gcc/testsuite/gcc.dg/pr40340-2.c
trunk/gcc/testsuite/gcc.dg/pr40340-5.c
trunk/gcc/testsuite/gcc.dg/torture/Wsizeof-pointer-memaccess1.c
trunk/gcc/testsuite/gcc.dg/torture/pr71132.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c
trunk/gcc/testsuite/gfortran.dg/char_length_3.f90
trunk/gcc/testsuite/gfortran.dg/pr38868.f

[Bug c/53562] Add -Werror= support for -D_FORTIFY_SOURCE / __builtin___memcpy_chk

2016-12-07 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53562

--- Comment #4 from Martin Sebor  ---
Author: msebor
Date: Thu Dec  8 00:01:33 2016
New Revision: 243419

URL: https://gcc.gnu.org/viewcvs?rev=243419=gcc=rev
Log:
PR c/53562 - Add -Werror= support for -D_FORTIFY_SOURCE /
__builtin___memcpy_chk
PR middle-end/77784 - duplicate warning for snprintf when n > object size
PR middle-end/78149 - missing warning on strncpy buffer overflow due to an
excessive bound
PR middle-end/78138 - missing warnings on buffer overflow with non-constant
source length

gcc/c-family/ChangeLog:

PR c/53562
PR middle-end/77784
PR middle-end/78149
PR middle-end/78138
* c.opt (-Wstringop-overflow): New option.

gcc/ChangeLog:

PR middle-end/77784
PR middle-end/78149
PR middle-end/78138

* builtins.c (expand_builtin_strcat, expand_builtin_strncat): New
functions.
(compute_dest_size, get_size_range, check_sizes, check_strncat_sizes)
(check_memop_sizes): Same.
(expand_builtin_memcpy): Call check memop_sizes.
(expand_builtin_mempcpy): Same.
(expand_builtin_memset): Same,
(expand_builtin_bzero): Same.
(expand_builtin_memory_chk): Call check_sizes.
(expand_builtin_strcpy): Same.
(expand_builtin_strncpy): Same.
(maybe_emit_sprintf_chk_warning): Same.
(expand_builtin): Handle strcat and strncat.
(fini_object_sizes): Reset pointers.
(compute_object_size): New function.
* gimple-ssa-sprintf.c (pass_sprintf_length::handle_gimple_call):
Avoid issuing warnings also issued during built-in expansion.
* doc/invoke.texi (Warning Options): Document -Wstringop-overflow.

gcc/testsuite/ChangeLog:

PR middle-end/77784
PR middle-end/78149
PR middle-end/78138

* c-c++-common/Wsizeof-pointer-memaccess2.c: Adjust expected
diagnostic.
* g++.dg/ext/builtin-object-size3.C (bar): Same.
* g++.dg/ext/strncpy-chk1.C: Same.
* g++.dg/opt/memcpy1.C: Same.
* g++.dg/torture/Wsizeof-pointer-memaccess1.C: Same.
* gcc.c-torture/compile/pr55569.c: Disable -Wstringop-overflow.
* gcc.dg/Wobjsize-1.c: Adjust expected diagnostic.
* gcc.dg/attr-alloc_size.c: Same.
* gcc.dg/builtin-stringop-chk-1.c: Adjust expected diagnostic.
* gcc.dg/builtin-stringop-chk-2.c: Same.
* gcc.dg/builtin-stringop-chk-4.c: New test.
* gcc.dg/builtin-strncat-chk-1.c: Adjust expected diagnostic.
* gcc.dg/memcpy-2.c: Same.
* gcc.dg/pr40340-1.c: Same.
* gcc.dg/pr40340-2.c (main): Same.
* gcc.dg/pr40340-5.c (main): Same.
* gcc.dg/torture/Wsizeof-pointer-memaccess1.c: Same.
* gcc.dg/torture/pr71132.c: Disable -Wstringop-overflow.
* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Adjust text of expected
warning.
* gfortran.dg/char_length_3.f90: Prune expected warnings.
* gfortran.dg/pr38868.f: Add expected warnings.


Added:
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-4.c
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-5.c
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-6.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c.opt
trunk/gcc/doc/invoke.texi
trunk/gcc/gimple-ssa-sprintf.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess2.c
trunk/gcc/testsuite/g++.dg/ext/builtin-object-size3.C
trunk/gcc/testsuite/g++.dg/ext/strncpy-chk1.C
trunk/gcc/testsuite/g++.dg/opt/memcpy1.C
trunk/gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess1.C
trunk/gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess2.C
trunk/gcc/testsuite/gcc.c-torture/compile/pr55569.c
trunk/gcc/testsuite/gcc.dg/Wobjsize-1.c
trunk/gcc/testsuite/gcc.dg/attr-alloc_size.c
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-1.c
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-2.c
trunk/gcc/testsuite/gcc.dg/builtin-strncat-chk-1.c
trunk/gcc/testsuite/gcc.dg/fstack-protector-strong.c
trunk/gcc/testsuite/gcc.dg/memcpy-2.c
trunk/gcc/testsuite/gcc.dg/pr40340-1.c
trunk/gcc/testsuite/gcc.dg/pr40340-2.c
trunk/gcc/testsuite/gcc.dg/pr40340-5.c
trunk/gcc/testsuite/gcc.dg/torture/Wsizeof-pointer-memaccess1.c
trunk/gcc/testsuite/gcc.dg/torture/pr71132.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c
trunk/gcc/testsuite/gfortran.dg/char_length_3.f90
trunk/gcc/testsuite/gfortran.dg/pr38868.f

[Bug middle-end/78138] missing warnings on buffer overflow with non-constant source length

2016-12-07 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78138

--- Comment #1 from Martin Sebor  ---
Author: msebor
Date: Thu Dec  8 00:01:33 2016
New Revision: 243419

URL: https://gcc.gnu.org/viewcvs?rev=243419=gcc=rev
Log:
PR c/53562 - Add -Werror= support for -D_FORTIFY_SOURCE /
__builtin___memcpy_chk
PR middle-end/77784 - duplicate warning for snprintf when n > object size
PR middle-end/78149 - missing warning on strncpy buffer overflow due to an
excessive bound
PR middle-end/78138 - missing warnings on buffer overflow with non-constant
source length

gcc/c-family/ChangeLog:

PR c/53562
PR middle-end/77784
PR middle-end/78149
PR middle-end/78138
* c.opt (-Wstringop-overflow): New option.

gcc/ChangeLog:

PR middle-end/77784
PR middle-end/78149
PR middle-end/78138

* builtins.c (expand_builtin_strcat, expand_builtin_strncat): New
functions.
(compute_dest_size, get_size_range, check_sizes, check_strncat_sizes)
(check_memop_sizes): Same.
(expand_builtin_memcpy): Call check memop_sizes.
(expand_builtin_mempcpy): Same.
(expand_builtin_memset): Same,
(expand_builtin_bzero): Same.
(expand_builtin_memory_chk): Call check_sizes.
(expand_builtin_strcpy): Same.
(expand_builtin_strncpy): Same.
(maybe_emit_sprintf_chk_warning): Same.
(expand_builtin): Handle strcat and strncat.
(fini_object_sizes): Reset pointers.
(compute_object_size): New function.
* gimple-ssa-sprintf.c (pass_sprintf_length::handle_gimple_call):
Avoid issuing warnings also issued during built-in expansion.
* doc/invoke.texi (Warning Options): Document -Wstringop-overflow.

gcc/testsuite/ChangeLog:

PR middle-end/77784
PR middle-end/78149
PR middle-end/78138

* c-c++-common/Wsizeof-pointer-memaccess2.c: Adjust expected
diagnostic.
* g++.dg/ext/builtin-object-size3.C (bar): Same.
* g++.dg/ext/strncpy-chk1.C: Same.
* g++.dg/opt/memcpy1.C: Same.
* g++.dg/torture/Wsizeof-pointer-memaccess1.C: Same.
* gcc.c-torture/compile/pr55569.c: Disable -Wstringop-overflow.
* gcc.dg/Wobjsize-1.c: Adjust expected diagnostic.
* gcc.dg/attr-alloc_size.c: Same.
* gcc.dg/builtin-stringop-chk-1.c: Adjust expected diagnostic.
* gcc.dg/builtin-stringop-chk-2.c: Same.
* gcc.dg/builtin-stringop-chk-4.c: New test.
* gcc.dg/builtin-strncat-chk-1.c: Adjust expected diagnostic.
* gcc.dg/memcpy-2.c: Same.
* gcc.dg/pr40340-1.c: Same.
* gcc.dg/pr40340-2.c (main): Same.
* gcc.dg/pr40340-5.c (main): Same.
* gcc.dg/torture/Wsizeof-pointer-memaccess1.c: Same.
* gcc.dg/torture/pr71132.c: Disable -Wstringop-overflow.
* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Adjust text of expected
warning.
* gfortran.dg/char_length_3.f90: Prune expected warnings.
* gfortran.dg/pr38868.f: Add expected warnings.


Added:
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-4.c
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-5.c
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-6.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c.opt
trunk/gcc/doc/invoke.texi
trunk/gcc/gimple-ssa-sprintf.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/c-c++-common/Wsizeof-pointer-memaccess2.c
trunk/gcc/testsuite/g++.dg/ext/builtin-object-size3.C
trunk/gcc/testsuite/g++.dg/ext/strncpy-chk1.C
trunk/gcc/testsuite/g++.dg/opt/memcpy1.C
trunk/gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess1.C
trunk/gcc/testsuite/g++.dg/torture/Wsizeof-pointer-memaccess2.C
trunk/gcc/testsuite/gcc.c-torture/compile/pr55569.c
trunk/gcc/testsuite/gcc.dg/Wobjsize-1.c
trunk/gcc/testsuite/gcc.dg/attr-alloc_size.c
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-1.c
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-2.c
trunk/gcc/testsuite/gcc.dg/builtin-strncat-chk-1.c
trunk/gcc/testsuite/gcc.dg/fstack-protector-strong.c
trunk/gcc/testsuite/gcc.dg/memcpy-2.c
trunk/gcc/testsuite/gcc.dg/pr40340-1.c
trunk/gcc/testsuite/gcc.dg/pr40340-2.c
trunk/gcc/testsuite/gcc.dg/pr40340-5.c
trunk/gcc/testsuite/gcc.dg/torture/Wsizeof-pointer-memaccess1.c
trunk/gcc/testsuite/gcc.dg/torture/pr71132.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c
trunk/gcc/testsuite/gfortran.dg/char_length_3.f90
trunk/gcc/testsuite/gfortran.dg/pr38868.f

[Bug target/72717] [5/6/7 Regression] ICE: in emit_move_insn, at expr.c:3693 with vector shift @ powerpc64le

2016-12-07 Thread meissner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72717

--- Comment #5 from Michael Meissner  ---
Author: meissner
Date: Wed Dec  7 23:52:05 2016
New Revision: 243418

URL: https://gcc.gnu.org/viewcvs?rev=243418=gcc=rev
Log:
[gcc]
2016-12-07  Michael Meissner  

PR target/72717
* config/rs6000/rs6000.c (rs6000_expand_vector_init): If the
V2DImode elements are SUBREG's convert the result into DImode
rather than failing in emit_move_insn.

[gcc/testsuite]
2016-12-07  Michael Meissner  

PR target/72717
* gcc.target/powerpc/pr72717.c: New test.


Added:
trunk/gcc/testsuite/gcc.target/powerpc/pr72717.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/rs6000/rs6000.c
trunk/gcc/testsuite/ChangeLog

[Bug libfortran/19481] libgfortran doesn't build -- configure doesn't handle cabs() well

2016-12-07 Thread amodra at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19481

--- Comment #7 from Alan Modra  ---
Author: amodra
Date: Wed Dec  7 23:16:03 2016
New Revision: 243417

URL: https://gcc.gnu.org/viewcvs?rev=243417=gcc=rev
Log:
sync config/* from binutils

* elf.m4: Revert 2016-06-21 change.
* picflag.m4: Likewise.  Revert 2016-04-30 change too.
* override.m4 (AC_PROG_LEX): Import 2016-01-18 binutils fix
for PR binutils/19481.

Modified:
trunk/config/ChangeLog
trunk/config/elf.m4
trunk/config/override.m4
trunk/config/picflag.m4

[Bug target/77957] [5/6 Regression] Undefined .LCTOC0 with -fstack-protector-strong -mminimal-toc -O0 on ppc64

2016-12-07 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77957

Segher Boessenkool  changed:

   What|Removed |Added

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

--- Comment #10 from Segher Boessenkool  ---
.

[Bug target/77957] [5/6 Regression] Undefined .LCTOC0 with -fstack-protector-strong -mminimal-toc -O0 on ppc64

2016-12-07 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77957

--- Comment #9 from Segher Boessenkool  ---
Fixed on all open branches.

[Bug target/77957] [5/6 Regression] Undefined .LCTOC0 with -fstack-protector-strong -mminimal-toc -O0 on ppc64

2016-12-07 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77957

--- Comment #8 from Segher Boessenkool  ---
Author: segher
Date: Wed Dec  7 23:11:23 2016
New Revision: 243416

URL: https://gcc.gnu.org/viewcvs?rev=243416=gcc=rev
Log:
rs6000: Don't forget to initialize the TOC (PR77957)

The code generating traceback tables mistakenly does an early return
if !optional_tbtab, which causes it to miss the code generating the TOC
section.  This only matters if the TOC will be empty since otherwise
the section is created elsewhere.

This patch fixes it.


PR target/77957
* config/rs6000/rs6000.c (rs6000_output_function_epilogue): Don't
return early if !optional_tbtab.

Modified:
branches/gcc-5-branch/gcc/ChangeLog
branches/gcc-5-branch/gcc/config/rs6000/rs6000.c

[Bug target/77957] [5/6 Regression] Undefined .LCTOC0 with -fstack-protector-strong -mminimal-toc -O0 on ppc64

2016-12-07 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77957

--- Comment #7 from Segher Boessenkool  ---
Author: segher
Date: Wed Dec  7 23:07:58 2016
New Revision: 243415

URL: https://gcc.gnu.org/viewcvs?rev=243415=gcc=rev
Log:
rs6000: Don't forget to initialize the TOC (PR77957)

The code generating traceback tables mistakenly does an early return
if !optional_tbtab, which causes it to miss the code generating the TOC
section.  This only matters if the TOC will be empty since otherwise
the section is created elsewhere.

This patch fixes it.


PR target/77957
* config/rs6000/rs6000.c (rs6000_output_function_epilogue): Don't
return early if !optional_tbtab.

Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/config/rs6000/rs6000.c

[Bug c++/78649] [5/6 Regression] ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in build_value_init_noctor, at

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78649

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 23:01:24 2016
New Revision: 243414

URL: https://gcc.gnu.org/viewcvs?rev=243414=gcc=rev
Log:
Backported from mainline
2016-12-02  Jakub Jelinek  

PR c++/78649
* pt.c (tsubst_init): Don't call build_value_init if decl's type
is error_mark_node.

* g++.dg/cpp0x/pr78649.C: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/cpp0x/pr78649.C
Modified:
branches/gcc-6-branch/gcc/cp/ChangeLog
branches/gcc-6-branch/gcc/cp/pt.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug middle-end/78540] [6 Regression] ICE: in df_refs_verify, at df-scan.c:4062 with -O -march=core2

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78540

--- Comment #6 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 23:00:40 2016
New Revision: 243413

URL: https://gcc.gnu.org/viewcvs?rev=243413=gcc=rev
Log:
Backported from mainline
2016-11-28  Jakub Jelinek  

PR middle-end/78540
* rtl.h (remove_reg_equal_equiv_notes): Return bool instead of void.
* rtlanal.c (remove_reg_equal_equiv_notes): Return true if any
note has been removed.
* postreload.c (reload_combine_recognize_pattern): If
remove_reg_equal_equiv_notes returns true, call df_notes_rescan.

* gcc.dg/pr78540.c: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gcc.dg/pr78540.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/postreload.c
branches/gcc-6-branch/gcc/rtl.h
branches/gcc-6-branch/gcc/rtlanal.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug c++/72808] [6 Regression] ICE on valid c++ code in verify_type (gcc/tree.c:14047)

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72808

--- Comment #10 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:59:28 2016
New Revision: 243412

URL: https://gcc.gnu.org/viewcvs?rev=243412=gcc=rev
Log:
Backported from mainline
2016-11-28  Jakub Jelinek  
Jason Merrill  

PR c++/72808
* decl.c (finish_enum_value_list): Call fixup_type_variants on
current_class_type after
insert_late_enum_def_into_classtype_sorted_fields.

* g++.dg/debug/pr72808.C: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/debug/pr72808.C
Modified:
branches/gcc-6-branch/gcc/cp/ChangeLog
branches/gcc-6-branch/gcc/cp/decl.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug rtl-optimization/78546] [6 Regression] wrong code at -O2 and above

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78546

--- Comment #19 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:58:33 2016
New Revision: 243411

URL: https://gcc.gnu.org/viewcvs?rev=243411=gcc=rev
Log:
Backported from mainline
2016-11-28  Jakub Jelinek  

PR rtl-optimization/78546
* simplify-rtx.c (neg_const_int): When negating most negative
number in mode wider than HOST_BITS_PER_WIDE_INT, use
simplify_const_unary_operation to produce CONST_DOUBLE or
CONST_WIDE_INT.
(simplify_plus_minus): Hanlde the case where neg_const_int
doesn't return a CONST_INT.

* gcc.dg/torture/pr78546-1.c: New test.
* gcc.dg/torture/pr78546-2.c: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr78546-1.c
branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr78546-2.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/simplify-rtx.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug fortran/78298] ICE in lookup_decl_in_outer_ctx, bei omp-low.c:4115

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78298

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:57:39 2016
New Revision: 243410

URL: https://gcc.gnu.org/viewcvs?rev=243410=gcc=rev
Log:
Backported from mainline
2016-11-28  Jakub Jelinek  

PR fortran/78298
* tree-nested.c (convert_local_reference_stmt): After adding
shared (FRAME.NN) clause to omp parallel, task or target,
add it also to all outer omp parallel, task or target constructs.

* gfortran.dg/gomp/pr78298.f90: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gfortran.dg/gomp/pr78298.f90
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/testsuite/ChangeLog
branches/gcc-6-branch/gcc/tree-nested.c

[Bug c++/77591] [6 Regression] decltype(auto) and ternary operator allow returning local reference without a warning

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77591

--- Comment #7 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:56:45 2016
New Revision: 243409

URL: https://gcc.gnu.org/viewcvs?rev=243409=gcc=rev
Log:
Backported from mainline
2016-11-28  Jakub Jelinek  

PR c++/77591
* typeck.c (maybe_warn_about_returning_address_of_local): Optimize
whats_returned through fold_for_warn.

* g++.dg/cpp1y/pr77591.C: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/cpp1y/pr77591.C
Modified:
branches/gcc-6-branch/gcc/cp/ChangeLog
branches/gcc-6-branch/gcc/cp/typeck.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug middle-end/69183] ICE when using OpenMP PRIVATE keyword in OMP DO loop not explicitly encapsulated in OMP PARALLEL region

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69183

--- Comment #7 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:55:55 2016
New Revision: 243408

URL: https://gcc.gnu.org/viewcvs?rev=243408=gcc=rev
Log:
Backported from mainline
2016-11-23  Jakub Jelinek  

PR middle-end/69183
* omp-low.c (build_outer_var_ref): Change lastprivate argument
to code, pass it recursively, adjust uses.  For OMP_CLAUSE_PRIVATE
on worksharing constructs, treat it like clauses on simd construct.
Formatting fix.
(lower_rec_input_clauses): For OMP_CLAUSE_PRIVATE_OUTER_REF pass
OMP_CLAUSE_PRIVATE as last argument to build_outer_var_ref.
(lower_lastprivate_clauses): Pass OMP_CLAUSE_LASTPRIVATE instead
of true as last argument to build_outer_var_ref.

* gfortran.dg/gomp/pr69183.f90: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gfortran.dg/gomp/pr69183.f90
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/omp-low.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug c++/77739] [5/6 Regression] internal compiler error: in create_tmp_var, at gimple-expr.c:524

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77739

--- Comment #8 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:55:04 2016
New Revision: 243407

URL: https://gcc.gnu.org/viewcvs?rev=243407=gcc=rev
Log:
Backported from mainline
2016-11-23  Jakub Jelinek  

PR c++/77739
* cp-gimplify.c (cp_gimplify_tree) : Pass
false as handle_invisiref_parm_p to cp_genericize_tree.
(struct cp_genericize_data): Add handle_invisiref_parm_p field.
(cp_genericize_r): Don't wrap is_invisiref_parm into references
if !wtd->handle_invisiref_parm_p.
(cp_genericize_tree): Add handle_invisiref_parm_p argument,
set wtd.handle_invisiref_parm_p to it.
(cp_genericize): Pass true as handle_invisiref_parm_p to
cp_genericize_tree.  Formatting fix.

* g++.dg/cpp1y/pr77739.C: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/cpp1y/pr77739.C
Modified:
branches/gcc-6-branch/gcc/cp/ChangeLog
branches/gcc-6-branch/gcc/cp/cp-gimplify.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug middle-end/78416] wrong code for division by (u128)~INT64_MAX at -O0

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78416

--- Comment #4 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:54:14 2016
New Revision: 243406

URL: https://gcc.gnu.org/viewcvs?rev=243406=gcc=rev
Log:
Backported from mainline
2016-11-22  Jakub Jelinek  

PR middle-end/78416
* expmed.c (expand_divmod): Use wide_int for computation of
op1_is_pow2.  Don't set it if op1 is 0.  Formatting fixes.
Use size <= HOST_BITS_PER_WIDE_INT instead of
HOST_BITS_PER_WIDE_INT >= size.

* gcc.dg/torture/pr78416.c: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr78416.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/expmed.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug middle-end/67335] [6 Regression] ICE in compiling omp simd function with unused argument

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67335

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:53:28 2016
New Revision: 243405

URL: https://gcc.gnu.org/viewcvs?rev=243405=gcc=rev
Log:
Backported from mainline
2016-11-21  Jakub Jelinek  

PR middle-end/67335
* omp-simd-clone.c (simd_clone_adjust_argument_types): Use NULL prefix
for tmp simd array if DECL_NAME (parm) is NULL.

* g++.dg/vect/simd-clone-7.cc: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/vect/simd-clone-7.cc
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/omp-simd-clone.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug middle-end/78419] ICE with target_clone on invalid target

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78419

--- Comment #6 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:52:39 2016
New Revision: 243404

URL: https://gcc.gnu.org/viewcvs?rev=243404=gcc=rev
Log:
Backported from mainline
2016-11-18  Jakub Jelinek  

PR middle-end/78419
* multiple_target.c (get_attr_len): Start with argnum and increment
argnum on every arg.  Use strchr in a loop instead of counting commas
manually.
(get_attr_str): Increment argnum for every comma in the string.
(separate_attrs): Use for instead of while loop, simplify.
(expand_target_clones): Rename defenition argument to definition.
Free attrs and attr_str even when diagnosing errors.  Temporarily
change input_location around targetm.target_option.valid_attribute_p
calls.  Don't emit warning or errors if that function fails.

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

Added:
branches/gcc-6-branch/gcc/testsuite/gcc.target/i386/pr78419.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/multiple_target.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug c++/77285] [5/6 Regression] extern thread_local linkage

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77285

--- Comment #11 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:51:48 2016
New Revision: 243403

URL: https://gcc.gnu.org/viewcvs?rev=243403=gcc=rev
Log:
Backported from mainline
2016-11-18  Jakub Jelinek  

PR c++/77285
* mangle.c (mangle_tls_init_fn, mangle_tls_wrapper_fn): Call
check_abi_tags.

* g++.dg/tls/pr77285-1.C: New test.
* g++.dg/tls/pr77285-2.C: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/tls/pr77285-1.C
branches/gcc-6-branch/gcc/testsuite/g++.dg/tls/pr77285-2.C
Modified:
branches/gcc-6-branch/gcc/cp/ChangeLog
branches/gcc-6-branch/gcc/cp/mangle.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug rtl-optimization/78378] [5/6 Regression] wrong code when combining shift + mult + zero_extend

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78378

--- Comment #9 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:50:53 2016
New Revision: 243402

URL: https://gcc.gnu.org/viewcvs?rev=243402=gcc=rev
Log:
Backported from mainline
2016-11-16  Jakub Jelinek  

PR rtl-optimization/78378
* combine.c (make_extraction): Use force_to_mode for non-{REG,MEM}
inner only if pos is 0.  Fix up formatting.

* gcc.c-torture/execute/pr78378.c: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gcc.c-torture/execute/pr78378.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/combine.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug fortran/78299] [6 Regression] ICE in expand_omp_for_static_nochunk, at omp-low.c:9622

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78299

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:50:09 2016
New Revision: 243401

URL: https://gcc.gnu.org/viewcvs?rev=243401=gcc=rev
Log:
Backported from mainline
2016-11-16  Jakub Jelinek  

PR fortran/78299
* omp-low.c (expand_omp_for_static_nochunk): Don't assert
that loop->header == body_bb if broken_loop.

* gfortran.dg/gomp/pr78299.f90: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gfortran.dg/gomp/pr78299.f90
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/omp-low.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug target/77834] [7 Regression] ICE: in make_decl_rtl, at varasm.c:1311 with -O -ftree-pre -mstringop-strategy=libcall

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77834

--- Comment #12 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:49:10 2016
New Revision: 243400

URL: https://gcc.gnu.org/viewcvs?rev=243400=gcc=rev
Log:
Backported from mainline
2016-11-07  Jakub Jelinek  

PR target/77834
* dse.c (dse_step5): Call scan_reads even if just
insn_info->frame_read.  Improve and fix dump file messages.

Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/dse.c

[Bug target/78227] ICE: unrecognizable insn: in extract_insn, at recog.c:2311 with -mavx512bw and vector comare

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78227

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:48:38 2016
New Revision: 243399

URL: https://gcc.gnu.org/viewcvs?rev=243399=gcc=rev
Log:
Backported from mainline
2016-11-07  Jakub Jelinek  

PR target/78227
* config/i386/i386.c (ix86_expand_sse_cmp): Force dest into
cmp_mode argument even for -O0 if cmp_mode != mode and maskcmp.

* gcc.target/i386/pr78227-1.c: New test.
* gcc.target/i386/pr78227-2.c: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gcc.target/i386/pr78227-1.c
branches/gcc-6-branch/gcc/testsuite/gcc.target/i386/pr78227-2.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/config/i386/i386.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug target/77834] [7 Regression] ICE: in make_decl_rtl, at varasm.c:1311 with -O -ftree-pre -mstringop-strategy=libcall

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77834

--- Comment #11 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:47:48 2016
New Revision: 243398

URL: https://gcc.gnu.org/viewcvs?rev=243398=gcc=rev
Log:
Backported from mainline
2016-11-04  Jakub Jelinek  

PR target/77834
* alias.c (nonoverlapping_memrefs_p): Return 0 if exprx or expry
doesn't have rtl set.

* gcc.dg/pr77834.c: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gcc.dg/pr77834.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/alias.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug c++/78089] __builtin_shuffle parsing bug

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78089

--- Comment #2 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:46:26 2016
New Revision: 243396

URL: https://gcc.gnu.org/viewcvs?rev=243396=gcc=rev
Log:
Backported from mainline
2016-10-31  Jakub Jelinek  

PR c++/78089
* parser.c (cp_parser_postfix_expression): Replace return statement in
the first switch with setting postfix_expression to the return
expression and break;.

* c-c++-common/builtin-shuffle-1.c: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/c-c++-common/builtin-shuffle-1.c
Modified:
branches/gcc-6-branch/gcc/cp/ChangeLog
branches/gcc-6-branch/gcc/cp/parser.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug rtl-optimization/77919] [5/6 Regression] ICE converting DC to V2DF mode

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77919

--- Comment #11 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:45:33 2016
New Revision: 243395

URL: https://gcc.gnu.org/viewcvs?rev=243395=gcc=rev
Log:
Backported from mainline
2016-10-29  Jakub Jelinek  

PR rtl-optimization/77919
* expr.c (expand_expr_real_1) : Only avoid forcing
into memory if both modes are complex and their inner modes have the
same precision.  If the two modes are different complex modes, convert
each part separately and generate a new CONCAT.

* g++.dg/torture/pr77919-2.C: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/torture/pr77919-2.C
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/expr.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug rtl-optimization/77919] [5/6 Regression] ICE converting DC to V2DF mode

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77919

--- Comment #10 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:43:59 2016
New Revision: 243394

URL: https://gcc.gnu.org/viewcvs?rev=243394=gcc=rev
Log:
Backported from mainline
2016-10-28  Jakub Jelinek  

PR rtl-optimization/77919
* expr.c (expand_expr_real_1) : Force CONCAT into
MEM if mode1 is not a complex mode.

* g++.dg/torture/pr77919.C: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/torture/pr77919.C
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/expr.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug middle-end/78025] [5/6 Regression] ICE in simd_clone_adjust, at omp-simd-clone.c:1126

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78025

--- Comment #6 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:42:47 2016
New Revision: 243393

URL: https://gcc.gnu.org/viewcvs?rev=243393=gcc=rev
Log:
Backported from mainline
2016-10-27  Jakub Jelinek  

PR middle-end/78025
* omp-simd-clone.c (simd_clone_adjust): Handle noreturn declare simd
functions.

* g++.dg/gomp/declare-simd-7.C: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/gomp/declare-simd-7.C
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/omp-simd-clone.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug fortran/77973] [6 Regression] ICE in scan_omp_1_op, at omp-low.c:3841

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77973

--- Comment #7 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:40:40 2016
New Revision: 243392

URL: https://gcc.gnu.org/viewcvs?rev=243392=gcc=rev
Log:
Backported from mainline
2016-10-26  Jakub Jelinek  
Martin Liska  

PR fortran/77973
* gimplify.c (gimplify_adjust_omp_clauses_1): For all added map
clauses with OMP_CLAUSE_SIZE being a decl, call omp_notice_variable
on outer context if any.

* gfortran.dg/gomp/pr77973.f90: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gfortran.dg/gomp/pr77973.f90
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/gimplify.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug tree-optimization/78725] New: wrong code at -O3 on x86_64-linux-gnu (in both 32-bit and 64-bit modes)

2016-12-07 Thread su at cs dot ucdavis.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78725

Bug ID: 78725
   Summary: wrong code at -O3 on x86_64-linux-gnu (in both 32-bit
and 64-bit modes)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161206 (experimental) [trunk revision 243299] (GCC) 
$ 
$ gcc-trunk -O2 small.c; ./a.out
1
$ gcc-6.2 -O3 small.c; ./a.out
1
$ 
$ gcc-trunk -O3 small.c; ./a.out
0
$ 


--


int printf (const char *, ...);

int fn1 (int b, int c)
{
  return c < 0 || c > 31 ? 0 : b >> c;
}

unsigned char d = 255; 
int e, f;

int main ()
{
  for (; f < 2; f++)
e = fn1 (1, d++);
  printf ("%d\n", e); 
  return 0; 
}

[Bug sanitizer/66343] "Error: .Lubsan_type3 already defined" with UBSan and precompiled headers

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66343

--- Comment #15 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:39:29 2016
New Revision: 243391

URL: https://gcc.gnu.org/viewcvs?rev=243391=gcc=rev
Log:
Backported from mainline
2016-10-05  Jakub Jelinek  

PR sanitizer/66343
* ubsan.c (ubsan_ids): New GTY(()) array.
(ubsan_type_descriptor, ubsan_create_data): Use ubsan_ids
instead of static local counters.

* gcc.dg/pch/pr66343-1.c: New test.
* gcc.dg/pch/pr66343-1.hs: New file.
* gcc.dg/pch/pr66343-2.c: New test.
* gcc.dg/pch/pr66343-2.hs: New file.

Added:
branches/gcc-6-branch/gcc/testsuite/gcc.dg/pch/pr66343-1.c
branches/gcc-6-branch/gcc/testsuite/gcc.dg/pch/pr66343-1.hs
branches/gcc-6-branch/gcc/testsuite/gcc.dg/pch/pr66343-2.c
branches/gcc-6-branch/gcc/testsuite/gcc.dg/pch/pr66343-2.hs
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/testsuite/ChangeLog
branches/gcc-6-branch/gcc/ubsan.c

[Bug c++/77467] Segmentation fault with switch statement in constexpr function

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77467

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:37:59 2016
New Revision: 243390

URL: https://gcc.gnu.org/viewcvs?rev=243390=gcc=rev
Log:
Backported from mainline
2016-09-28  Jakub Jelinek  

PR c++/77467
* constexpr.c (enum constexpr_switch_state): New.
(struct constexpr_ctx): Add css_state field.
(label_matches): Add CTX and STMT arguments, remove I and
DEFAULT_LABEL.  For CASE_LABEL_EXPR assert ctx->css_state != NULL,
handle default labels according to css_state.
(cxx_eval_statement_list): Remove statement skipping, label_matches
and default_label handling code.
(cxx_eval_loop_expr): Exit after first iteration even if
switches (jump_target).
(cxx_eval_switch_expr): Set up css_state field in ctx, if default
label has been seen in the body, but no cases matched, evaluate
the body second time.
(cxx_eval_constant_expression): Handle stmt skipping and label_matches
here.  Handle PREDICT_EXPR.  For MODIFY_EXPR or INIT_EXPR, assert
statement is not skipped.  For COND_EXPR during skipping, don't
evaluate condition, just the then block and if still skipping at the
end also the else block.
(cxx_eval_outermost_constant_expr): Adjust constexpr_ctx initializer.
(is_sub_constant_expr): Likewise.

* g++.dg/cpp1y/constexpr-77467.C: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/cpp1y/constexpr-77467.C
Modified:
branches/gcc-6-branch/gcc/cp/ChangeLog
branches/gcc-6-branch/gcc/cp/constexpr.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

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

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77722

--- Comment #3 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:35:29 2016
New Revision: 243389

URL: https://gcc.gnu.org/viewcvs?rev=243389=gcc=rev
Log:
Backported from mainline
2016-09-27  Jakub Jelinek  

PR c++/77722
* cp-gimplify.c (cp_ubsan_maybe_instrument_return): Instrument also
functions that have just a STATEMENT_LIST instead of BIND_EXPR, or
BIND_EXPR with some statement rather than STATEMENT_LIST as body.

* g++.dg/ubsan/return-4.C: New test.
* g++.dg/ubsan/return-5.C: New test.
* g++.dg/ubsan/return-6.C: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/ubsan/return-4.C
branches/gcc-6-branch/gcc/testsuite/g++.dg/ubsan/return-5.C
branches/gcc-6-branch/gcc/testsuite/g++.dg/ubsan/return-6.C
Modified:
branches/gcc-6-branch/gcc/cp/ChangeLog
branches/gcc-6-branch/gcc/cp/cp-gimplify.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug fortran/77666] ICE in gfc_omp_clause_default_ctor, at fortran/trans-openmp.c:471

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77666

--- Comment #4 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:34:05 2016
New Revision: 243388

URL: https://gcc.gnu.org/viewcvs?rev=243388=gcc=rev
Log:
Backported from mainline
2016-09-27  Jakub Jelinek  

PR fortran/77666
* trans-openmp.c (gfc_omp_private_outer_ref): Return true even for
references to allocatable arrays.

* gfortran.dg/gomp/pr77666.f90: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gfortran.dg/gomp/pr77666.f90
Modified:
branches/gcc-6-branch/gcc/fortran/ChangeLog
branches/gcc-6-branch/gcc/fortran/trans-openmp.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug target/69153] --with-advance-toolchain configure option does not correctly set configure variable target_header_dir

2016-12-07 Thread bergner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69153

Peter Bergner  changed:

   What|Removed |Added

 Status|RESOLVED|CLOSED

--- Comment #5 from Peter Bergner  ---
Closing.

[Bug target/69153] --with-advance-toolchain configure option does not correctly set configure variable target_header_dir

2016-12-07 Thread bergner at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69153

Peter Bergner  changed:

   What|Removed |Added

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

--- Comment #4 from Peter Bergner  ---
I'm going to close this bug as WORKSFORME, since this no longer fails due to
the change committed here:

  https://gcc.gnu.org/ml/gcc-patches/2016-11/msg00648.html

as well as we no longer need to modify test_header_dir if we instead use the
--with-glibc-version= configure option.

[Bug tree-optimization/77665] [5/6 Regression] ICE in expand_GOMP_SIMD_VF, at internal-fn.c:172

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77665

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:32:34 2016
New Revision: 243387

URL: https://gcc.gnu.org/viewcvs?rev=243387=gcc=rev
Log:
Backported from mainline
2016-09-22  Jakub Jelinek  

PR fortran/77665
* tree-inline.c (remap_gimple_stmt): Set has_simduid_loops
for all IFN_GOMP_SIMD_* internal fns, not just for
IFN_GOMP_SIMD_ORDERED_*.

* gfortran.dg/gomp/pr77665.f90: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gfortran.dg/gomp/pr77665.f90
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/testsuite/ChangeLog
branches/gcc-6-branch/gcc/tree-inline.c

[Bug c++/77638] [6 Regression] ICE on x86_64-linux-gnu (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘error_mark’ in cp_parser_template_declaration_af

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77638

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:31:33 2016
New Revision: 243386

URL: https://gcc.gnu.org/viewcvs?rev=243386=gcc=rev
Log:
Backported from mainline
2016-09-20  Jakub Jelinek  

PR c++/77638
* parser.c (cp_parser_template_declaration_after_parameter): For 2
argument operator"" template set ok to false for
parm == error_mark_node.

* g++.dg/cpp0x/udlit-tmpl-arg-neg2.C: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/cpp0x/udlit-tmpl-arg-neg2.C
Modified:
branches/gcc-6-branch/gcc/cp/ChangeLog
branches/gcc-6-branch/gcc/cp/parser.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug c++/77637] ICE on x86_64-linux-gnu (Segmentation fault, tree_check, cp_parser_std_attribute_list...)

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77637

--- Comment #8 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:30:42 2016
New Revision: 243385

URL: https://gcc.gnu.org/viewcvs?rev=243385=gcc=rev
Log:
Backported from mainline
2016-09-20  Jakub Jelinek  

PR c++/77637
* parser.c (cp_parser_std_attribute_list): Reject ... without
preceding attribute.

* g++.dg/cpp0x/gen-attrs-62.C: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/cpp0x/gen-attrs-62.C
Modified:
branches/gcc-6-branch/gcc/cp/ChangeLog
branches/gcc-6-branch/gcc/cp/parser.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug middle-end/77624] [5/6 Regression] ICE on x86_64-linux-gnu (internal compiler error: in fold_builtin_atomic_always_lock_free, at builtins.c:5583)

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77624

--- Comment #7 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:29:54 2016
New Revision: 243384

URL: https://gcc.gnu.org/viewcvs?rev=243384=gcc=rev
Log:
Backported from mainline
2016-09-20  Jakub Jelinek  

PR middle-end/77624
* builtins.c (fold_builtin_atomic_always_lock_free): Only look through
cast to void * if the cast is from some other pointer type.

* c-c++-common/pr77624-1.c: New test.
* c-c++-common/pr77624-2.c: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/c-c++-common/pr77624-1.c
branches/gcc-6-branch/gcc/testsuite/c-c++-common/pr77624-2.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/builtins.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug ipa/77587] [5/6 Regression] C compiler produces incorrect stack alignment with __attribute__((weak))

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77587

--- Comment #7 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:29:01 2016
New Revision: 243383

URL: https://gcc.gnu.org/viewcvs?rev=243383=gcc=rev
Log:
Backported from mainline
2016-09-19  Jakub Jelinek  
Jan Hubicka  

PR target/77587
* cgraph.c (cgraph_node::rtl_info): Pass  to
ultimate_alias_target call, return NULL if avail < AVAIL_AVAILABLE.
Call ultimate_alias_target just once, not up to 4 times.

* gcc.dg/pr77587.c: New test.
* gcc.dg/pr77587a.c: New file.

Added:
branches/gcc-6-branch/gcc/testsuite/gcc.dg/pr77587.c
branches/gcc-6-branch/gcc/testsuite/gcc.dg/pr77587a.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/cgraph.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug c++/77482] [6 Regression] Segfault when compiling ill-formed constexpr code

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77482

--- Comment #6 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:27:27 2016
New Revision: 243382

URL: https://gcc.gnu.org/viewcvs?rev=243382=gcc=rev
Log:
Backported from mainline
2016-09-16  Jakub Jelinek  

PR c++/77482
* error.c (dump_simple_decl): Only check DECL_DECLARED_CONCEPT_P
if DECL_LANG_SPECIFIC is non-NULL.  Fix up formatting.

* g++.dg/cpp0x/constexpr-77482.C: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-77482.C
Modified:
branches/gcc-6-branch/gcc/cp/ChangeLog
branches/gcc-6-branch/gcc/cp/error.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug c++/77375] [5/6 Regression] constant object with mutable subobject allocated in read-only memory

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77375

--- Comment #9 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 22:26:26 2016
New Revision: 243381

URL: https://gcc.gnu.org/viewcvs?rev=243381=gcc=rev
Log:
Backported from mainline
2016-09-16  Jakub Jelinek  

PR c++/77375
* class.c (check_bases): Set CLASSTYPE_HAS_MUTABLE if any
TYPE_HAS_MUTABLE_P for any bases.

* g++.dg/cpp0x/mutable1.C: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/cpp0x/mutable1.C
Modified:
branches/gcc-6-branch/gcc/cp/ChangeLog
branches/gcc-6-branch/gcc/cp/class.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug c++/78724] New: Incorrect ambiguous reference error when templace class was forward declarated as a friend

2016-12-07 Thread loic.yhuel at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78724

Bug ID: 78724
   Summary: Incorrect ambiguous reference error when templace
class was forward declarated as a friend
   Product: gcc
   Version: 6.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: loic.yhuel at gmail dot com
  Target Milestone: ---

namespace A {
template
class B {
template friend class C;
};
}

void foo()
{
A::B b;
}

namespace A {
template
class C {
};
}

using namespace A;

void bar()
{
C c;
}

=>
test.cpp: In function ‘void bar()’:
hello.cpp:23:5: error: reference to ‘C’ is ambiguous
 C c;
 ^
test.cpp:4:38: note: candidates are: template class A::C
 template friend class C;
  ^
hello.cpp:15:11: note: template class A::C
 class C {
   ^

Note that the error doesn't happen when using "A::C c".


The bug is seen with libc++ 3.9.0 headers :
#include 
void foo()
{
std::map::iterator it;
}
#include 
using namespace std;
void bar()
{
set s;
}

[Bug middle-end/78468] [7 regression] libgomp.c/reduction-10.c and many more FAIL

2016-12-07 Thread vogt at linux dot vnet.ibm.com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78468

Dominik Vogt  changed:

   What|Removed |Added

 CC||vogt at linux dot vnet.ibm.com

--- Comment #22 from Dominik Vogt  ---
> But these back-ends were not broken before your patch!  It's your patch that
> broke the interface between the middle-end and the back-end without notice.
I disagree with this statement and with marking this bug report as being
middleend related.  The patch has not changed the interface between the two
-ends but simply _uses_ the interface.

--

The facts about the situation, as far as I understand, are:

* The middleend promises that VIRTUAL_STACK_DYNMAIC_REGNUM has at least
STACK_BOUNDARY alignment (emit-rtl.c:init_emit()).
* The 32 bit Aix backend used to break this promise but has already been
changed to honour it.
* The 32 bit Sparc backend breaks this promise.
* Apparently some other backends don't (Power, Aix 64 bit, s390, s390x, x86,
x86_64), yet other backends may or may not break the promise.
* Thus, the middleend and the backends that do not keep this promise (Sparc,
Aix until recently, maybe others) disagree on the interface between backend and
middleend.
* Any user of REGNO_POINTER_ALIGN (VIRTUAL_STACK_DYNMAIC_REGNUM) may generate
bogus results for targets that break the promise.  Grepping through the sources
I didn't find any other user (but there may be still some that cannot be found
using simple "grep"s).
* The interface mismatch is impossible to fix without touching the backends
with non-STACK_BOUNDARY alignment of VIRTUAL_STACK_DYNMAIC_REGNUM.  (Either
these backends need to be changed to keep the promise or at least tell the
middleend that they don't.)
* The interface mismatch is virtually impossible to fix if every change that
tries to fix it is reverted because on some target "it used to work before the
patch".

* The discussed patch introduces a new use of REGNO_POINTER_ALIGN
(VIRTUAL_STACK_DYNMAIC_REGNUM) and therefore leads to bad results on targets
that don't keep the promise.
* The discussed patch _trusts_ REGNO_POINTER_ALIGN
(VIRTUAL_STACK_DYNMAIC_REGNUM) and wouldn't lead to faulty code if that value
were correct (i.e. if the alignment was set to 4 on Sparc instead of 8). 
(Note: Setting the correct pointer alignment on such targets would fix the bad
code generation but not the waste of stack space.)
* As far as it is known, (patched) code generation on targets that keep the
promise is fine.

* Backing out the patch in favour of not having to change the Sparc backend
(and potentially others) not only wastes "some bytes" on Sparc but on every
target.  (Although, Sparc wastes more stack space than other targets, because
of Sparc's peculiar guaranteed "unalignment".)
* Backing out the patch won't fix the disagreement of the middleend and the
Sparc backend about their interface.
* Any other existing and future use of REGNO_POINTER_ALIGN
(VIRTUAL_STACK_DYNMAIC_REGNUM) makes or will also make bogus assumptions, with
unforeseeable consequences, unless the mismatch in the interface is fixed in
some way.

Related to the former over-allocation of dynamic stack memory:

* Off-by-one array accesses to dynamic stack memory in user code often go
unnoticed when Gcc is used as the compiler while other compilers will probably
not have this kind bug and generate failing assembly code right away.
* The patch already helped to identify coding bugs in several Gcc internal
libraries, and Glibc.
* It can be assumed with near certainty that the patch will trigger off-by-one
bugs in applications compiled with Gcc, and that Gcc bug reports will be
created with "Gcc-7 must be broken because it worked with Gcc-6".

--

I'm certainly willing to help fixing any interface mismatch, the Sparc backend,
any other backend with similar problems or identifying library or user code
bugs that are triggered by the fixed middleend.

[Bug target/78516] [7 Regression] ICE in lra_assign for e500v2

2016-12-07 Thread aldyh at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78516

Aldy Hernandez  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-12-07
 CC||aldyh at gcc dot gnu.org,
   ||bergner at gcc dot gnu.org,
   ||meissner at gcc dot gnu.org,
   ||segher at gcc dot gnu.org,
   ||wschmidt at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Aldy Hernandez  ---
Confirmed.

[Bug libstdc++/78723] New: [variant] P0393r3: "Making variant greater equal again" is unimplemented

2016-12-07 Thread eric at efcs dot ca
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78723

Bug ID: 78723
   Summary: [variant] P0393r3: "Making variant greater equal
again" is unimplemented
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: eric at efcs dot ca
  Target Milestone: ---

Link to paper:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0393r3.html

Reproducer:
// g++ -std=c++1z test.cpp
#include 
#include 
#include 

struct MakeEmptyT {
  MakeEmptyT() = default;
  MakeEmptyT(MakeEmptyT &&) { throw 42; }
  MakeEmptyT =(MakeEmptyT &&) { throw 42; }
};
inline bool operator<(const MakeEmptyT &, const MakeEmptyT &) {
  assert(false);
  return false;
}

template  void makeEmpty(Variant ) {
  Variant v2(std::in_place_type);
  try {
v = std::move(v2);
assert(false);
  } catch (...) {
assert(v.valueless_by_exception());
  }
}

int main() {
using V = std::variant;
V v1;
V v2;
makeEmpty(v2);
assert((v1 < v2) == false);
}

[Bug c++/78722] New: noexcept and function pointers

2016-12-07 Thread michele.caini at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78722

Bug ID: 78722
   Summary: noexcept and function pointers
   Product: gcc
   Version: 6.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: michele.caini at gmail dot com
  Target Milestone: ---

Consider the following code:

void f() noexcept {}

void func(void(*ptr)() noexcept) {
static_assert(noexcept(ptr()), "!");
}

int main() {
func();
}

GCC 6.2 wrongly rejects it.
GCC 7 accepts it instead.

[Bug fortran/65173] ICE while compiling wrong code

2016-12-07 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65173

--- Comment #11 from kargl at gcc dot gnu.org ---
(In reply to kargl from comment #10)
> (In reply to Gerhard Steinmetz from comment #9)
> > Another example, together with LANG=de_DE.UTF-8 :
> > 
> > 
> > $ cat zz1.f90
> > program p
> >type t
> >   character, allocatable :: z1(:), z1(:)
> >end type
> > end
> > 
> > 
> > $ gfortran-7-20161204 -m32 zz1.f90
> > zz1.f90:3:37-44:
> > 
> >character, allocatable :: z1(:), z1(:)
> >  2  1
> > Error: Component »z1« at (1) already declared at (2)
> > f951: internal compiler error: Speicherzugriffsfehler
> > 0xc4940f crash_signal
> > ../../gcc/toplev.c:333
> > 0x6f3aea gfc_resolve_expr(gfc_expr*)
> > ../../gcc/fortran/resolve.c:6465
> 
> (gdb) bt
> (gdb) bt
> #0  gfc_is_constant_expr (e=0x837f) at ../../gcc7/gcc/fortran/expr.c:894
> #1  0x0065a320 in resolve_component (c=0x20365f8c0, sym=0x203635f00)
> at ../../gcc7/gcc/fortran/resolve.c:13507
> #2  0x0065a9ab in resolve_fl_derived0 (sym=sym@entry=0x203635f00)
> at ../../gcc7/gcc/fortran/resolve.c:13738
> ...
> (gdb) up
> #1  0x0065a320 in resolve_component (c=0x20365f8c0, sym=0x203635f00)
> at ../../gcc7/gcc/fortran/resolve.c:13507
> 13507|| !gfc_is_constant_expr (c->ts.u.cl->length))
> (gdb) p *c->ts.u.cl
> $5 = {length = 0x837f, next = 0x20362b5d0, length_from_typespec = false, 
>   backend_decl = 0x2039d8040, passed_length = 0x0, resolved = 56844672}
> 
> length=0x837f is an invalid pointer.  So, gfortran ICE's.  This 
> looks similar to the fight that Janus waged this weekend.  For
> some reason, a CHARACTER(LEN=) component in a derived type
> does not set the length correctly.

Well, this is due to reject_statement(), which frees memory associated
with charlen.  It seems we have a tangling pointer that needs to be
explicitly NULLed, but I cannot find it.  If the code is changed to

program p
type t
   character, allocatable :: z1(:)
   character, allocatable :: z1(:)
end type
end

gfortran generates an error message without the ICE because the
charlen from the first statement is not cleared.

[Bug c++/71537] GCC rejects consetxpr boolean conversions and comparisons on the result of pointer arithmetic.

2016-12-07 Thread eric at efcs dot ca
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71537

Eric Fiselier  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #17 from Eric Fiselier  ---
This has not been fixed. As mentioned the original reproducer still fails to
compile when it appears at block scope:

// g++ -std=c++1z test.cpp
constexpr bool foo() {
  constexpr int n[42] = {1};
  constexpr int x = n ? 1 : 0; // Accepted.
  constexpr int xx = n + 1 ? 1 : 0; // Rejected
  constexpr int xxx = "abc" + 1 ? 1 : 0; // Newly accepted.
  return true;
}

int main() { static_assert(foo(), ""); }

[Bug c++/55004] [meta-bug] constexpr issues

2016-12-07 Thread eric at efcs dot ca
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55004
Bug 55004 depends on bug 71537, which changed state.

Bug 71537 Summary: GCC rejects consetxpr boolean conversions and comparisons on 
the result of pointer arithmetic.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71537

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

[Bug middle-end/78720] [7 Regression] Illegal instruction in generated code

2016-12-07 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78720

Markus Trippelsdorf  changed:

   What|Removed |Added

 CC||bonzini at gnu dot org
  Component|target  |middle-end

--- Comment #3 from Markus Trippelsdorf  ---
Started with r243255:

commit 458de25d72182951e17489052becf952f6b63592
Author: bonzini 
Date:   Mon Dec 5 13:19:34 2016 +

gcc:
* match.pd: Simplify X ? C : 0 where C is a power of 2 and
X tests a single bit.

[Bug tree-optimization/78721] New: ICE on valid code at -O2 and -O3 on x86_64-linux-gnu: in set_value_range, at tree-vrp.c:371

2016-12-07 Thread su at cs dot ucdavis.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78721

Bug ID: 78721
   Summary: ICE on valid code at -O2 and -O3 on x86_64-linux-gnu:
in set_value_range, at tree-vrp.c:371
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161206 (experimental) [trunk revision 243299] (GCC)
$
$ gcc-trunk -Os small.c
$ gcc-6.2 -O2 small.c
$
$ gcc-trunk -O2 small.c
small.c:20:1: internal compiler error: in set_value_range, at tree-vrp.c:371
 }
 ^
0xe97c9f set_value_range
../../gcc-source-trunk/gcc/tree-vrp.c:370
0xe99357 vrp_meet_1
../../gcc-source-trunk/gcc/tree-vrp.c:8711
0xe99357 vrp_meet(value_range*, value_range const*)
../../gcc-source-trunk/gcc/tree-vrp.c:8788
0x135f6f5 ipcp_vr_lattice::meet_with_1(value_range const*)
../../gcc-source-trunk/gcc/ipa-cp.c:909
0x136540f ipcp_vr_lattice::meet_with(value_range const*)
../../gcc-source-trunk/gcc/ipa-cp.c:891
0x136540f propagate_vr_accross_jump_function
../../gcc-source-trunk/gcc/ipa-cp.c:1905
0x136540f propagate_constants_accross_call
../../gcc-source-trunk/gcc/ipa-cp.c:2268
0x1366e28 propagate_constants_topo
../../gcc-source-trunk/gcc/ipa-cp.c:3162
0x1366e28 ipcp_propagate_stage
../../gcc-source-trunk/gcc/ipa-cp.c:3272
0x1369496 ipcp_driver
../../gcc-source-trunk/gcc/ipa-cp.c:5002
0x1369496 execute
../../gcc-source-trunk/gcc/ipa-cp.c:5096
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
$





int a, b, c;

int fn1 (char e, char f)
{ 
  return !f || (e && f == 1);
}

void fn2 (char e)
{ 
  while (b)
e = 0;
  a = 128;
  c = fn1 (e, a == e);
}

int main ()
{ 
  fn2 (0);
  return 0;
}

[Bug target/78720] [7 Regression] Illegal instruction in generated code

2016-12-07 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78720

--- Comment #2 from Markus Trippelsdorf  ---
 % cat illegal_inst.cpp
extern signed char var_13;
long int rrr;
void foo() {
  rrr = !0 % ((var_13 < 0) << 21);
}

[Bug target/78720] [7 Regression] Illegal instruction in generated code

2016-12-07 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78720

Markus Trippelsdorf  changed:

   What|Removed |Added

   Keywords||wrong-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-12-07
 CC||trippels at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Markus Trippelsdorf  ---
 g++ -O2 -S illegal_inst.cpp -o - | c++filt

foo():
.LFB12:
.cfi_startproc
ud2
.cfi_endproc

[Bug target/78720] New: [7 Regression] Illegal instruction in generated code

2016-12-07 Thread babokin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78720

Bug ID: 78720
   Summary: [7 Regression] Illegal instruction in generated code
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: babokin at gmail dot com
  Target Milestone: ---

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

> g++ -O2 -march=nehalem -o opt illegal_inst.cpp illegal_inst_const.cpp
> ./opt
Illegal instruction

This is regression, which was introduced in trunk couple days ago.

> gcc --version
gcc (GCC) 7.0.0 20161207 (experimental)

[Bug preprocessor/60723] Line directives with incorrect system header flag

2016-12-07 Thread sje at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60723

Steve Ellcey  changed:

   What|Removed |Added

 CC||sje at gcc dot gnu.org

--- Comment #29 from Steve Ellcey  ---
I posted this question on g...@gcc.gnu.org and got not response so I thought I
would ask here on the bug report.

I am trying to understand the status of this bug and the patch
that fixes it.  It looks like a patch was submitted and checked
in for 5.0 to fix the problem reported and I see the new 
behavior caused by the patch in GCC 5.X compilers.  This behavior
caused a number of issues with configures and scripts that examined
preprocessed output as is mentioned in this bug report.
There was a later bug, 64864, complaining about the behavior and
that was closed as invalid.

But when I look at GCC 6.X or ToT (7.X) compilers I do not see the same
behavior as 5.X.  Was this patch reverted or was a new patch submitted
that undid some of this patches behavior?  I couldn't find any revert or
new patch to replace the original one so I am not sure when or why
the code changed back after the 5.X releases.

Here is a test case that I am preprocessing with g++ -E:

#include 
class foo {
void operator= ( bool bit);
operator bool() const;
};

GCC 5.4 breaks up the operator delcarations with line markers and GCC 6.2
does not.

[Bug tree-optimization/78692] [7 Regression] ICE (segfault)

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78692

Jakub Jelinek  changed:

   What|Removed |Added

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

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

[Bug tree-optimization/78692] [7 Regression] ICE (segfault)

2016-12-07 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78692

--- Comment #4 from Jakub Jelinek  ---
Author: jakub
Date: Wed Dec  7 19:10:50 2016
New Revision: 243377

URL: https://gcc.gnu.org/viewcvs?rev=243377=gcc=rev
Log:
PR c++/78692
* cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Set lhs
var to lhs of new_stmt right before noreturn handling rather than to
lhs of e->call_stmt early.

* g++.dg/torture/pr78692.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/torture/pr78692.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cgraph.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/78719] ICE in gfc_get_symbol_decl, at fortran/trans-decl.c:1438

2016-12-07 Thread gerhard.steinmetz.fort...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78719

--- Comment #2 from Gerhard Steinmetz  
---

Interestingly, following invalid variant with "type(t)"
is silently accepted and gives same results as z0.f90 in comment 1.


$ cat z2.f90
program p
   type t
  integer :: n
   end type
   type(t) :: g   !!
   abstract interface
  subroutine h
  end
   end interface
   procedure(h), pointer :: s
   s => f
   call s
   s => g
   call s
contains
   subroutine f
  print *, 'inside f'
   end
   subroutine g
  print *, 'inside g'
   end
end


$ gfortran-7-20161204 z2.f90
$ a.out
 inside f
 inside g

[Bug fortran/78719] ICE in gfc_get_symbol_decl, at fortran/trans-decl.c:1438

2016-12-07 Thread gerhard.steinmetz.fort...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78719

--- Comment #1 from Gerhard Steinmetz  
---

Detected with type "real" instead of "class(t)" :


$ cat z3.f90
program p
   type t
  integer :: n
   end type
   real :: g   !!
   abstract interface
  subroutine h
  end
   end interface
   procedure(h), pointer :: s
   s => f
   call s
   s => g
   call s
contains
   subroutine f
  print *, 'inside f'
   end
   subroutine g
  print *, 'inside g'
   end
end


$ gfortran-7-20161204 z3.f90
z3.f90:19:15:

z3.f90:5:12:

real :: g   !!
2
z3.f90:19:15:

subroutine g
   1
Error: Procedure 'g' at (1) has an explicit interface and must not have
attributes declared at (2)


---


Deleting that extra line gives a valid and correct program :


$ cat z0.f90
program p
   type t
  integer :: n
   end type
   abstract interface
  subroutine h
  end
   end interface
   procedure(h), pointer :: s
   s => f
   call s
   s => g
   call s
contains
   subroutine f
  print *, 'inside f'
   end
   subroutine g
  print *, 'inside g'
   end
end


$ gfortran-7-20161204 z0.f90
$ a.out
 inside f
 inside g

[Bug fortran/68569] ICE with automatic character object and DATA

2016-12-07 Thread gerhard.steinmetz.fort...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68569

--- Comment #2 from Gerhard Steinmetz  
---
Update, backtrace :


$ gfortran-7-20161204 -c z2a.f90
z2a.f90:4:12:

data x /'a'/
1
Warning: Initialization string at (1) was truncated to fit the variable (0/1)
z2a.f90:1:0:

 subroutine s(n)

internal compiler error: in gfc_get_symbol_decl, at fortran/trans-decl.c:1705
0x75b6f5 gfc_get_symbol_decl(gfc_symbol*)
../../gcc/fortran/trans-decl.c:1705
0x75e5b7 generate_local_decl
../../gcc/fortran/trans-decl.c:5327
0x71825b do_traverse_symtree
../../gcc/fortran/symbol.c:3994
0x75f412 generate_local_vars
../../gcc/fortran/trans-decl.c:5527
0x75f412 gfc_generate_function_code(gfc_namespace*)
../../gcc/fortran/trans-decl.c:6206
0x6e73d0 translate_all_program_units
../../gcc/fortran/parse.c:6038
0x6e73d0 gfc_parse_file()
../../gcc/fortran/parse.c:6238
0x72b182 gfc_be_parse_file
../../gcc/fortran/f95-lang.c:202

[Bug c++/72775] [6/7 Regression] internal compiler error: in finish_expr_stmt, at cp/semantics.c:677

2016-12-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72775

--- Comment #14 from Marek Polacek  ---
I think you're right.  I dropped the check and am regtesting this again. 
Thanks!

[Bug fortran/78719] New: ICE in gfc_get_symbol_decl, at fortran/trans-decl.c:1438

2016-12-07 Thread gerhard.steinmetz.fort...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78719

Bug ID: 78719
   Summary: ICE in gfc_get_symbol_decl, at
fortran/trans-decl.c:1438
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gerhard.steinmetz.fort...@t-online.de
  Target Milestone: ---

With invalid code (due to an extra declaration flagged with "!!"),
down to at least 4.8 :


$ cat z1.f90
program p
   type t
  integer :: n
   end type
   class(t) :: g   !!
   abstract interface
  subroutine h
  end
   end interface
   procedure(h), pointer :: s
   s => f
   call s
   s => g
   call s
contains
   subroutine f
  print *, 'inside f'
   end
   subroutine g
  print *, 'inside g'
   end
end


$ gfortran-7-20161204 z1.f90
z1.f90:13:0:

s => g

internal compiler error: Segmentation fault
0xc4940f crash_signal
../../gcc/toplev.c:333
0x75a0e9 gfc_get_symbol_decl(gfc_symbol*)
../../gcc/fortran/trans-decl.c:1438
0x7731af gfc_conv_variable
../../gcc/fortran/trans-expr.c:2494
0x76ee42 gfc_conv_expr(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-expr.c:7771
0x77bc97 gfc_trans_pointer_assignment(gfc_expr*, gfc_expr*)
../../gcc/fortran/trans-expr.c:8169
0x72e667 trans_code
../../gcc/fortran/trans.c:1798
0x75f708 gfc_generate_function_code(gfc_namespace*)
../../gcc/fortran/trans-decl.c:6271
0x6e73d0 translate_all_program_units
../../gcc/fortran/parse.c:6038
0x6e73d0 gfc_parse_file()
../../gcc/fortran/parse.c:6238
0x72b182 gfc_be_parse_file
../../gcc/fortran/f95-lang.c:202

[Bug fortran/78718] New: ICE in gfc_get_symbol_decl, at fortran/trans-decl.c:1427

2016-12-07 Thread gerhard.steinmetz.fort...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78718

Bug ID: 78718
   Summary: ICE in gfc_get_symbol_decl, at
fortran/trans-decl.c:1427
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gerhard.steinmetz.fort...@t-online.de
  Target Milestone: ---

Affects versions down to at least 4.8 :


$ cat z1.f90
program p
   integer :: n, z
   n = 1
contains
   function f() result(z)
  call s(n, z)
   end
end


$ gfortran-7-20161204 z1.f90
z1.f90:6:0:

   call s(n, z)

internal compiler error: in gfc_get_symbol_decl, at fortran/trans-decl.c:1427
0x75a05e gfc_get_symbol_decl(gfc_symbol*)
../../gcc/fortran/trans-decl.c:1421
0x7731af gfc_conv_variable
../../gcc/fortran/trans-expr.c:2494
0x76ee42 gfc_conv_expr(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-expr.c:7771
0x776f56 gfc_conv_expr_reference(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-expr.c:7871
0x76a420 gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*,
gfc_expr*, vec*)
../../gcc/fortran/trans-expr.c:5169
0x7b4704 gfc_trans_call(gfc_code*, bool, tree_node*, tree_node*, bool)
../../gcc/fortran/trans-stmt.c:407
0x72e6ca trans_code
../../gcc/fortran/trans.c:1858
0x75f708 gfc_generate_function_code(gfc_namespace*)
../../gcc/fortran/trans-decl.c:6271
0x75f557 gfc_generate_contained_functions
../../gcc/fortran/trans-decl.c:5251
0x75f557 gfc_generate_function_code(gfc_namespace*)
../../gcc/fortran/trans-decl.c:6200
0x6e73d0 translate_all_program_units
../../gcc/fortran/parse.c:6038
0x6e73d0 gfc_parse_file()
../../gcc/fortran/parse.c:6238
0x72b182 gfc_be_parse_file
../../gcc/fortran/f95-lang.c:202

[Bug fortran/70149] [F08] Character pointer initialization causes ICE

2016-12-07 Thread gerhard.steinmetz.fort...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70149

Gerhard Steinmetz  changed:

   What|Removed |Added

 CC||gerhard.steinmetz.fortran@t
   ||-online.de

--- Comment #5 from Gerhard Steinmetz  
---
This variant gives the same backtrace as in pr68569 comment 2 :


$ cat z2.f90
program p
   character(16), target :: char_data = 'forty two'
   character(:), pointer :: x => char_data
   print *, len(x), x
end


$ gfortran-7-20161204 z2.f90
z2.f90:1:0:

 program p

internal compiler error: in gfc_get_symbol_decl, at fortran/trans-decl.c:1705
0x75b6f5 gfc_get_symbol_decl(gfc_symbol*)
../../gcc/fortran/trans-decl.c:1705
0x75e5b7 generate_local_decl
../../gcc/fortran/trans-decl.c:5327
0x71825b do_traverse_symtree
../../gcc/fortran/symbol.c:3994
0x75f412 generate_local_vars
../../gcc/fortran/trans-decl.c:5527
0x75f412 gfc_generate_function_code(gfc_namespace*)
../../gcc/fortran/trans-decl.c:6206
0x6e73d0 translate_all_program_units
../../gcc/fortran/parse.c:6038
0x6e73d0 gfc_parse_file()
../../gcc/fortran/parse.c:6238
0x72b182 gfc_be_parse_file
../../gcc/fortran/f95-lang.c:202

[Bug c++/78551] [5/6/7 Regression] Internal compiler error with constexpr initialization of union

2016-12-07 Thread nathan at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78551

Nathan Sidwell  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

  1   2   >