[Bug fortran/78737] [OOP] linking error with deferred, undefined user-defined derived-type I/O

2016-12-12 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78737

--- Comment #15 from Paul Thomas  ---
(In reply to Damian Rouson from comment #14)
> Hi Paul,
> 
> Based on comment #12, I assume you no longer believe that type guarding is
> required.  If I misinterpreted comment #12, please let me know. Otherwise,
> please let me know what in the standard indicates that type guarding is
> required.  I too would be surprised.

Dear Damian and Janus,

What I meant is that we did not implement dynamic dispatch of the dtio
procedures. In the corrected testcase of comments #12 and #13, where the first
argument of write_formatted has declared type 'object', it is necessary to use
type guarding within write_formatted to obtain the appropriate IO.

I have to confess that this "interpretation" is arrived at by the absence of
any mention of the need for dynamic dispatch and by the implementation by other
vendors.

See this further example, which works with the last version of the patch.

module object_interface
  type, abstract :: object
  contains
procedure(write_formatted_interface), deferred :: write_formatted
generic :: write(formatted) => write_formatted
  end type
  abstract interface
subroutine write_formatted_interface(this,unit,iotype,vlist,iostat,iomsg)
  import object
  class(object), intent(in) :: this
  integer, intent(in) :: unit
  character (len=*), intent(in) :: iotype
  integer, intent(in) :: vlist(:)
  integer, intent(out) :: iostat
  character (len=*), intent(inout) :: iomsg
end subroutine
  end interface
  type, extends(object) :: non_abstract_child
integer :: i
  contains
procedure :: write_formatted => write_formatted2
  end type
contains
  subroutine write_formatted(this,unit,iotype,vlist,iostat,iomsg)
class(object), intent(in) :: this
integer, intent(in) :: unit
character (len=*), intent(in) :: iotype
integer, intent(in) :: vlist(:)
integer, intent(out) :: iostat
character (len=*), intent(inout) :: iomsg
select type (this)
  class is (non_abstract_child)
print '(a,i4/)', "write_formatted => ", this%i
print *, this
  class default
print *, "Error"
end select
  end subroutine
  subroutine write_formatted2(this,unit,iotype,vlist,iostat,iomsg)
class(non_abstract_child), intent(in) :: this
integer, intent(in) :: unit
character (len=*), intent(in) :: iotype
integer, intent(in) :: vlist(:)
integer, intent(out) :: iostat
character (len=*), intent(inout) :: iomsg
print '(a,i4/)', "write_formatted2 => ", this%i
  end subroutine
  subroutine assert(a)
class(object):: a
write(*,*) a
  end subroutine
end module

  use object_interface
  class (object), allocatable :: z
  allocate (z, source = non_abstract_child (99))
  call assert (z)
end

Is this now OK?

Paul

[Bug other/78766] GCC Awk scripts use the non-POSIX /^{/ regex

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

Jakub Jelinek  changed:

   What|Removed |Added

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

--- Comment #1 from Jakub Jelinek  ---
Created attachment 40306
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40306&action=edit
gcc7-pr78766.patch

Neither "^\{" nor "^\\{" seem to work correctly, so I'm going to use ^[{]
instead.

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

2016-12-12 Thread stefano.zaghi at cnr dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78682

--- Comment #6 from Stefano Zaghi  ---
Created attachment 40307
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40307&action=edit
MCVE of CAF-DT with allocatable member

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

2016-12-12 Thread stefano.zaghi at cnr dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78682

--- Comment #7 from Stefano Zaghi  ---
Dear all,

I confirm that with gcc 7.0.0 this ICE vanishes.

However, I find a new ICE. I am not sure if it is good to report it here or if
it is better to open a new ticket. In doubt, I start adding some details here.

My current "env" is

+ GNU Fortran (GCC) 7.0.0 20161206 (experimental)
+ MPICH 3.2.0 built with GCC 7.0.0
+ OpenCoarrays built 1.7.5 with GCC 7.0.0 and MPICH 3.2.0
+ Linux 4.8.8-2-ARCH #1 SMP PREEMPT Thu Nov 17 14:51:03 CET 2016 x86_64
GNU/Linux

The MCVE raising the ICE is attached as "MCVE of CAF-DT with allocatable
member". Essentially, there is a "base" DT (named "node") with an allocatable
member, a second DT (named "caf") that has a coarray member of "type(node)".
The last concrete instance of "type(caf)" is a scalar, static variable thus the
code should be valid (while I still think that the other is invalid). 

Compiling this new code with the above env generates the following ICE

stefano@zaghi(09:38 AM Mon Dec 12) desk {opencoarrays-1.7.5-gnu-7.0.0 -
OpenCoarrays 1.7.5 with gcc 7.0.0 environment}
~/fortran/compilers_bug/gfortran_sigsegv_caf_dt_allocatable_member 5 files,
84Kb
→ caf -fcoarray=lib sigsegv_caf_dt.f90
sigsegv_caf_dt.f90:77:0:

 end module caf_module

internal compiler error: Segmentation fault
0xc0db4f crash_signal
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/toplev.c:333
0xeb1764 recompute_tree_invariant_for_addr_expr(tree_node*)
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/tree.c:4317
0xeb1d7c build1_stat(tree_code, tree_node*, tree_node*)
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/tree.c:4414
0x92c76c build1_stat_loc
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/tree.h:3903
0x92c76c fold_build1_stat_loc(unsigned int, tree_code, tree_node*, tree_node*)
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fold-const.c:12139
0x6f204f gfc_build_addr_expr(tree_node*, tree_node*)
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans.c:298
0x70532b structure_alloc_comps
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-array.c:8329
0x7827b3 gfc_trans_deallocate(gfc_code*)
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-stmt.c:6477
0x6f1bf7 trans_code
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans.c:1942
0x7742f3 gfc_trans_if_1
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-stmt.c:1303
0x77c39a gfc_trans_if(gfc_code*)
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-stmt.c:1334
0x6f1ce7 trans_code
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans.c:1878
0x7742f3 gfc_trans_if_1
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-stmt.c:1303
0x77c39a gfc_trans_if(gfc_code*)
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-stmt.c:1334
0x6f1ce7 trans_code
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans.c:1878
0x77e271 gfc_trans_simple_do
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-stmt.c:1924
0x77e271 gfc_trans_do(gfc_code*, tree_node*)
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-stmt.c:2057
0x6f1cba trans_code
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans.c:1890
0x723038 gfc_generate_function_code(gfc_namespace*)
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans-decl.c:6271
0x6f6949 gfc_generate_module_code(gfc_namespace*)
   
/opt/arch/gcc/opencoarrays/prerequisites/downloads/trunk/gcc/fortran/trans.c:2164
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

My best regards.

[Bug middle-end/78689] [7 Regression] ICE (segfault)

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

--- Comment #4 from Jakub Jelinek  ---
From looking at inh-ctor23.C and what GCC and clang++ produce, there are
different cases:
_ZN1VCI21WEi emitted in _ZN1VCI51WEi comdat, with _ZN1VCI11WEi alias to it,
which has the extra argument, callers pass it to it and users use it.
_ZN1XCI21WEi emitted in _ZN1XCI21WEi comdat, without _ZN1XCI11WEi alias, which
has the argument only in GCC (bug?), e.g. as seen with -O0 saves 3 arguments to
stack instead of 2:
movq%rdi, -8(%rbp)
movq%rsi, -16(%rbp)
movl%edx, -20(%rbp)
but callers actually provide 2:
  X::X (_2, _3);
I bet we want that extra argument (those extra arguments) to be there for
mangling, but then we should likely remove them both from DECL_ARGUMENTS and
from TYPE_ARG_TYPES (in that case it means probably replace the whole
METHOD_TYPE).  Otherwise I think the middle-end must be confused (callers pass
fewer args than the method really has), and at -O0 it also has to save
arguments it doesn't have that contain garbage etc.

[Bug tree-optimization/18438] vectorizer failed for vector matrix multiplication

2016-12-12 Thread mkuvyrkov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18438

Maxim Kuvyrkov  changed:

   What|Removed |Added

 CC||mkuvyrkov at gcc dot gnu.org

--- Comment #9 from Maxim Kuvyrkov  ---
I've looked into another case where inability to handle stores with gaps
generates sub-optimal code.  I'm interested in spending some time on fixing
this, provided some guidance in the vectorizer.

Is it substantially more difficult to handle stores with gaps compared to loads
with gaps?

The following is [minimally] reduced from 462.libquantum:quantum_sigma_x(),
which is #2 function in 462.libquantum profile.  This cycle accounts for about
25% of total 462.libquantum time.

===struct node_struct
{
  float _Complex gap;
  unsigned long long state;
};

struct reg_struct
{
  int size;
  struct node_struct *node;
};

void
func(int target, struct reg_struct *reg)
{
  int i;

  for(i=0; isize; i++)
reg->node[i].state ^= ((unsigned long long) 1 << target);
}
===

This loop vectorizes into
  :
  # vectp.8_39 = PHI 
  vect_array.10 = LOAD_LANES (MEM[(long long unsigned int *)vectp.8_39]);
  vect__5.11_41 = vect_array.10[0];
  vect__5.12_42 = vect_array.10[1];
  vect__7.13_44 = vect__5.11_41 ^ vect_cst__43;
  _48 = BIT_FIELD_REF ;
  MEM[(long long unsigned int *)ivtmp_45] = _48;
  ivtmp_50 = ivtmp_45 + 16;
  _51 = BIT_FIELD_REF ;
  MEM[(long long unsigned int *)ivtmp_50] = _51;

which then becomes for aarch64:
.L4:
ld2 {v0.2d - v1.2d}, [x1]
add w2, w2, 1
cmp w2, w7
eor v0.16b, v2.16b, v0.16b
umovx4, v0.d[1]
st1 {v0.d}[0], [x1]
add x1, x1, 32
str x4, [x1, -16]
bcc .L4

[Bug tree-optimization/18438] vectorizer failed for vector matrix multiplication

2016-12-12 Thread mkuvyrkov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18438

--- Comment #10 from Maxim Kuvyrkov  ---
(In reply to Maxim Kuvyrkov from comment #9)
> which then becomes for aarch64:
> .L4:
>   ld2 {v0.2d - v1.2d}, [x1]
>   add w2, w2, 1
>   cmp w2, w7
>   eor v0.16b, v2.16b, v0.16b
>   umovx4, v0.d[1]
>   st1 {v0.d}[0], [x1]
>   add x1, x1, 32
>   str x4, [x1, -16]
>   bcc .L4

IIUC,
umovx4, v0.d[1]
st1 {v0.d}[0], [x1]
str x4, [x1, -16]
could become just
st2 {v0.d - v1.2d}, [x1]

[Bug tree-optimization/18438] vectorizer failed for vector matrix multiplication

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

--- Comment #11 from Andrew Pinski  ---
(In reply to Maxim Kuvyrkov from comment #9)
> I've looked into another case where inability to handle stores with gaps
> generates sub-optimal code.  I'm interested in spending some time on fixing
> this, provided some guidance in the vectorizer.
> 
> Is it substantially more difficult to handle stores with gaps compared to
> loads with gaps?
> 
> The following is [minimally] reduced from 462.libquantum:quantum_sigma_x(),
> which is #2 function in 462.libquantum profile.  This cycle accounts for
> about 25% of total 462.libquantum time.
> 
> ===struct node_struct
> {
>   float _Complex gap;
>   unsigned long long state;
> };
> 
> struct reg_struct
> {
>   int size;
>   struct node_struct *node;
> };
> 
> void
> func(int target, struct reg_struct *reg)
> {
>   int i;
> 
>   for(i=0; isize; i++)
> reg->node[i].state ^= ((unsigned long long) 1 << target);
> }
> ===
> 
> This loop vectorizes into
>   :
>   # vectp.8_39 = PHI 
>   vect_array.10 = LOAD_LANES (MEM[(long long unsigned int *)vectp.8_39]);
>   vect__5.11_41 = vect_array.10[0];
>   vect__5.12_42 = vect_array.10[1];
>   vect__7.13_44 = vect__5.11_41 ^ vect_cst__43;
>   _48 = BIT_FIELD_REF ;
>   MEM[(long long unsigned int *)ivtmp_45] = _48;
>   ivtmp_50 = ivtmp_45 + 16;
>   _51 = BIT_FIELD_REF ;
>   MEM[(long long unsigned int *)ivtmp_50] = _51;
> 
> which then becomes for aarch64:
> .L4:
>   ld2 {v0.2d - v1.2d}, [x1]
>   add w2, w2, 1
>   cmp w2, w7
>   eor v0.16b, v2.16b, v0.16b
>   umovx4, v0.d[1]
>   st1 {v0.d}[0], [x1]
>   add x1, x1, 32
>   str x4, [x1, -16]
>   bcc .L4


What I did for thunderx was create a vector cost model which caused this loop
not be vectorized to get the regression from happening.  Not this might
actually be better code for some micro arch. I need to check with the new
processor we have in house but that is next week or so.  I don't know how much
I can share next week though.

[Bug c++/78771] Internal compiler error when using inherited constructors

2016-12-12 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78771

Martin Liška  changed:

   What|Removed |Added

   Keywords||ice-on-invalid-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-12-12
 CC||marxin at gcc dot gnu.org
  Known to work||4.7.4
 Ever confirmed|0   |1
  Known to fail||4.8.5, 4.9.4, 5.4.0, 6.2.0

--- Comment #1 from Martin Liška  ---
Started to ICE with -std=c++11 from 4.8.0, 4.7.x looks fine.

[Bug driver/78772] New: -fstrict-aliasing should turn on Wstrict-aliasing automaticly

2016-12-12 Thread ma.jiang at zte dot com.cn
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78772

Bug ID: 78772
   Summary: -fstrict-aliasing should turn on Wstrict-aliasing
automaticly
   Product: gcc
   Version: 6.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: driver
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ma.jiang at zte dot com.cn
  Target Milestone: ---

Hi all,
  "-fstrict-aliasing" which is turned on at O2 level, May create wrong codes.
But, GCC does not give a warning for it by default. IMO, we should  turn on
Wstrict-aliasing  when strict-aliasing is enabled.

[Bug c++/72786] Odd spelling suggestion with later defined macro: Suggestion is identical to unknown identifier

2016-12-12 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72786

Martin Liška  changed:

   What|Removed |Added

 CC||safinaskar at mail dot ru

--- Comment #4 from Martin Liška  ---
*** Bug 78770 has been marked as a duplicate of this bug. ***

[Bug c++/78770] error: 'bar' was not declared in this scope. note: suggested alternative: 'bar'

2016-12-12 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78770

Martin Liška  changed:

   What|Removed |Added

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

--- Comment #1 from Martin Liška  ---
Fixed by r242965, I'm marking that as duplicate of one of PRs fixed by the
commit.

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

[Bug driver/78772] -fstrict-aliasing should turn on Wstrict-aliasing automaticly

2016-12-12 Thread ma.jiang at zte dot com.cn
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78772

--- Comment #1 from ma.jiang at zte dot com.cn ---
Created attachment 40308
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40308&action=edit
proposed patch

[Bug c++/78767] [7 Regression] ICE when inheriting constructor of base class

2016-12-12 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78767

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
  Known to work||6.2.0
   Keywords||ice-on-valid-code
   Last reconfirmed||2016-12-12
 CC||jason at gcc dot gnu.org,
   ||marxin at gcc dot gnu.org
 Ever confirmed|0   |1
Summary|ICE when inheriting |[7 Regression] ICE when
   |constructor of base class   |inheriting constructor of
   ||base class
   Target Milestone|--- |7.0
  Known to fail||7.0

--- Comment #1 from Martin Liška  ---
I can see following ICE with current trunk (started with r241843):

pr78767.cpp: In instantiation of ‘static Tree Tree::Create(Iter, Iter) [with
Iter = __gnu_cxx::__normal_iterator
>]’:
pr78767.cpp:28:58:   required from here
pr78767.cpp:16:59: internal compiler error: in push_access_scope, at
cp/pt.c:228
   static Tree Create(Iter first, Iter last) { return Leaf{}; }

However GCC 6.2 works fine:
$ g++ --version
g++ (SUSE Linux) 6.2.1 20160830 [gcc-6-branch revision 239856]

$ g++ -std=c++14 pr78767.cpp
(no output)

[Bug target/71270] [7 Regression] fortran regression after fix SLP PR58135

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

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org,
   ||ramana at gcc dot gnu.org,
   ||rearnsha at gcc dot gnu.org

--- Comment #7 from Jakub Jelinek  ---
Any progress on this from the ARM backend side?

[Bug target/78748] [7 Regression] ICE in extract_insn, at recog.c:2311 (s390x-linux-gnu)

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

--- Comment #4 from Dominik Vogt  ---
Regression test of a polished version of the patch is running.

[Bug driver/78772] -fstrict-aliasing should turn on Wstrict-aliasing automaticly

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

--- Comment #2 from Andrew Pinski  ---
-Wstrict-aliasing is already included in -Wall which most people turn on. -W
(-Wextra) is the other most turn on too. Strict-overflow cause issues too if
not careful or not understand the language you are writing in. So should that
turn on -Wstrict-overflow too?  Note -Wstrict-overflow is included in -Wall
too.

[Bug c++/78773] New: "Empty" const only class not optimized away

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

Bug ID: 78773
   Summary: "Empty" const only class not optimized away
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Keywords: missed-optimization
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jpakkane at gmail dot com
  Target Milestone: ---

Suppose we have the following very simple class for accessing a memory mapped
register:

class MemoryMappedRegister {
  public:
  MemoryMappedRegister(const int value) : 
ptr{reinterpret_cast(value)} {}
  void write(char v) const { *ptr = v; }

  private:
  volatile char* const ptr;
};

const MemoryMappedRegister MyReg(12345);

void set_value(char v) {
  MyReg.write(v);
}

That is, the only reason for this class to exist is to provide a nicer UI to
register poking than C macros. When compiled with GCC (up to the version of 7
in gcc.godbolt.org as of this writing) using -O2 -std=c++14 the output is this:

set_value(char):
mov rax, QWORD PTR MyReg[rip]
mov BYTE PTR [rax], dil
ret
mov QWORD PTR MyReg[rip], 12345
ret

That is, it reserves space for the object to store the always constant pointer
value and loads it indirectly. When compiled with Clang 3.9 the output is this:

set_value(char):  # @set_value(char)
mov byte ptr [12345], dil
ret

Here no space is reserved for the object and the write is using immediate mode.

[Bug driver/78772] -fstrict-aliasing should turn on Wstrict-aliasing automaticly

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

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||trippels at gcc dot gnu.org
 Resolution|--- |WONTFIX

--- Comment #3 from Markus Trippelsdorf  ---
Please no. 
There are many other cases where optimizations could introduce issues that you
will not notice when you compile without warnings.
Just use -Wall.

[Bug c++/78773] "Empty" const only class not optimized away

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

--- Comment #1 from Andrew Pinski  ---
Since you already use some c++11 features why don't use constexpr too. Note
there is a duplicate of this bug already.

[Bug c++/78773] "Empty" const only class not optimized away

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

--- Comment #2 from jpakkane at gmail dot com ---
I tried constexpr and it did not have any effect so I just left it out for
simplicity. Sorry for the dupe. I tried searching but could not come up with a
suitable search term to find it.

[Bug tree-optimization/18438] vectorizer failed for vector matrix multiplication

2016-12-12 Thread mkuvyrkov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18438

--- Comment #12 from Maxim Kuvyrkov  ---
(In reply to Andrew Pinski from comment #11)
> (In reply to Maxim Kuvyrkov from comment #9)
> > which then becomes for aarch64:
> > .L4:
> > ld2 {v0.2d - v1.2d}, [x1]
> > add w2, w2, 1
> > cmp w2, w7
> > eor v0.16b, v2.16b, v0.16b
> > umovx4, v0.d[1]
> > st1 {v0.d}[0], [x1]
> > add x1, x1, 32
> > str x4, [x1, -16]
> > bcc .L4
> 
> 
> What I did for thunderx was create a vector cost model which caused this
> loop not be vectorized to get the regression from happening.  Not this might
> actually be better code for some micro arch. I need to check with the new
> processor we have in house but that is next week or so.  I don't know how
> much I can share next week though.

You are making an orthogonal point to this bug report: whether or not to
vectorize such a loop.  But if loop is vectorized, then on any
microarchitecture it is better to have "st2" vs "umov; st1; str".

[Bug c++/78701] [6/7 Regression] ICE: unexpected expression N of kind template_parm_index

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

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek  ---
Somehow convert_template_argument is called with TEMPLATE_PARM_INDEX, even when
processing_template_decl is 0, which results in it not to be considered
dependent, while the constexpr.c code doesn't expect it to appear.

[Bug go/78763] go1: internal compiler error: in do_get_backend, at go/gofrontend/expressions.cc:8352

2016-12-12 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78763

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org

--- Comment #2 from Martin Liška  ---
Hi. I can confirm that the docker command triggers ICE. However manually
cloning the repository and building with GCC 6.2 works fine.

Can you please investigate which version of compiler is used during docker
build? Is there any option to 'chroot' to build env in docker to run the
command manually?

[Bug fortran/78757] [7 Regression] ICE with function returning a pointer to a character

2016-12-12 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78757

Martin Liška  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-12-12
 CC||marxin at gcc dot gnu.org,
   ||rguenth at gcc dot gnu.org
   Target Milestone|--- |7.0
Summary|ICE with function returning |[7 Regression] ICE with
   |a pointer to a character|function returning a
   ||pointer to a character
 Ever confirmed|0   |1

--- Comment #1 from Martin Liška  ---
Confirmed, both started with r235817.

[Bug go/78763] go1: internal compiler error: in do_get_backend, at go/gofrontend/expressions.cc:8352

2016-12-12 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78763

Martin Liška  changed:

   What|Removed |Added

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

[Bug driver/78772] -fstrict-aliasing should turn on Wstrict-aliasing automaticly

2016-12-12 Thread ma.jiang at zte dot com.cn
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78772

--- Comment #4 from ma.jiang at zte dot com.cn ---
(In reply to Markus Trippelsdorf from comment #3)
> Please no. 
> There are many other cases where optimizations could introduce issues that
> you will not notice when you compile without warnings.
> Just use -Wall.

Hi, Markus 
  Thanks for your quick reply. I know the existence of both "Wall" and
"Wextra", And I  did use them when compiling my codes. But, there are many guys
do not know them. Moreover, As I see many open source projects does not use
them either. It is that OK to assume all gcc users know "Wall"?
  On the other side, creating a new mechanism to open warnings for dangerous
optimizations is not a hard work as I think. We just need to create a  table
which connect the optimization and corresponding warning.

[Bug target/78762] Regression: Splitting unaligned AVX loads also when AVX2 is enabled

2016-12-12 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78762

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-12-12
 CC||glisse at gcc dot gnu.org,
   ||marxin at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #4 from Martin Liška  ---
I'm not much familiar with the vector instructions, however the change started
with r239889.

[Bug target/78762] Regression: Splitting unaligned AVX loads also when AVX2 is enabled

2016-12-12 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78762

--- Comment #5 from Marc Glisse  ---
(In reply to Martin Liška from comment #4)
> I'm not much familiar with the vector instructions, however the change
> started with r239889.

Arguably r239889 fixed a bug where the tuning was ignored. Now this makes it
more visible when tuning choices are sub-optimal...

[Bug driver/78772] -fstrict-aliasing should turn on Wstrict-aliasing automaticly

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

--- Comment #5 from Markus Trippelsdorf  ---
(In reply to ma.jiang from comment #4)
> (In reply to Markus Trippelsdorf from comment #3)
> > Please no. 
> > There are many other cases where optimizations could introduce issues that
> > you will not notice when you compile without warnings.
> > Just use -Wall.

>   Thanks for your quick reply. I know the existence of both "Wall" and
> "Wextra", And I  did use them when compiling my codes. But, there are many
> guys do not know them. Moreover, As I see many open source projects does not
> use them either. It is that OK to assume all gcc users know "Wall"?
>   On the other side, creating a new mechanism to open warnings for dangerous
> optimizations is not a hard work as I think. We just need to create a  table
> which connect the optimization and corresponding warning.

These optimizations are not dangerous if you use standard conforming code.

We could have a discussion if it might be better to enable some -Wall warnings
by default like Clang. But I'm not sure if this gives huge benefits to users.

[Bug ipa/77905] [5/6/7 Regression] ICE at -Os and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: in ipa_comdats, at ipa-comdats.c:352)

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

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek  ---
So, what happens is that
#0  set_const_flag_1 (node=,
set_const=true, looping=false, changed=0x7fffdd5f)
at ../../gcc/cgraph.c:2469
#1  0x00ba53ef in cgraph_node::set_const_flag (this=, set_const=true, looping=false)
at ../../gcc/cgraph.c:2575
#2  0x01b25d6b in propagate_pure_const () at
../../gcc/ipa-pure-const.c:1499
#3  0x01b26355 in (anonymous namespace)::pass_ipa_pure_const::execute
(this=0x29b9650) at ../../gcc/ipa-pure-const.c:1678
clears DECL_STATIC_CONSTRUCTOR flag on a artificial static ctor
_GLOBAL__sub_I_A,
because the ctor isn't actually needed.
And then we hit:
  tree *val = map.get (symbol);

  /* A NULL here means that SYMBOL is unreachable in the definition
 of ipa-comdats. Either ipa-comdats is wrong about this or someone
 forgot to cleanup and remove unreachable functions earlier.  */
  gcc_assert (val);
clearly it is the second case, "someone forgot to cleanup and remove
unreachable functions earlier".

[Bug ipa/77905] [5/6/7 Regression] ICE at -Os and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (internal compiler error: in ipa_comdats, at ipa-comdats.c:352)

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

Jakub Jelinek  changed:

   What|Removed |Added

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

--- Comment #4 from Jakub Jelinek  ---
Created attachment 40309
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40309&action=edit
gcc7-pr77905.patch

Untested fix.  The problem is that during local pure/const pass, it is
determined to be const, but looping, so DECL_STATIC_CONSTRUCTOR is not removed
from it.  Only during the ipa pure/const pass it is determined not looping,
which removes DECL_STATIC_CONSTRUCTOR, but has_cdtor is not set because it is
already const (but looping), so we don't do TODO_remove_functions.

[Bug target/77904] [ARM Cortex-M0] Frame pointer thrashes registers if assembly statements with "sp" clobber are used

2016-12-12 Thread thopre01 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77904

--- Comment #10 from Thomas Preud'homme  ---
Author: thopre01
Date: Mon Dec 12 10:58:17 2016
New Revision: 243543

URL: https://gcc.gnu.org/viewcvs?rev=243543&root=gcc&view=rev
Log:
Fix PR77904: callee-saved register trashed when clobbering sp

2016-12-12 Thomas Preud'homme 

Backport from mainline
2016-11-22  Thomas Preud'homme  

gcc/
PR target/77904
* config/arm/arm.c (thumb1_compute_save_reg_mask): Mark frame pointer
in save register mask if it is needed.

gcc/testsuite/
PR target/77904
* gcc.target/arm/pr77904.c: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gcc.target/arm/pr77904.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/config/arm/arm.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug tree-optimization/78319] [7 Regression] PASS->FAIL: gcc.dg/uninit-pred-8_a.c bogus warning (test for bogus messages, line 20)

2016-12-12 Thread jgreenhalgh at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78319

James Greenhalgh  changed:

   What|Removed |Added

 CC||jgreenhalgh at gcc dot gnu.org

--- Comment #12 from James Greenhalgh  ---
Probably the easiest thing to do would be to force the dg-options to something
we know has the correct costs on ARM. Like most cost-based transformations in
GCC there is probably no good answer to make the transform apply across all
targets.

[Bug fortran/78238] [7 Regression] [OOP] ICE: verify_gimple failed, with -fdefault-integer-8

2016-12-12 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78238

janus at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
 CC||janus at gcc dot gnu.org
Summary|[7 Regression] ICE: |[7 Regression] [OOP] ICE:
   |verify_gimple failed, with  |verify_gimple failed, with
   |-fdefault-integer-8 |-fdefault-integer-8

--- Comment #6 from janus at gcc dot gnu.org ---
I can also confirm this. Stripping away the parts necessary at runtime, I
arrived at this minimal test case to reproduce the ICE:

class(*), allocatable :: q
select type (x => q)
type is (real)
end select
end

[Bug fortran/78238] [7 Regression] [OOP] ICE: verify_gimple failed, with -fdefault-integer-8

2016-12-12 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78238

--- Comment #7 from janus at gcc dot gnu.org ---
There were some "select type"-related commits by Paul and Jakub in October
which could potentially be the culprit here:

* r241403 (PR 69566)
* r241450 (PR 69834)
* r241630 (PR 78026)

[Bug fortran/69834] [OOP] Collision in derived type hashes

2016-12-12 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69834

janus at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords||rejects-valid
 CC||janus at gcc dot gnu.org
   Target Milestone|--- |7.0
Summary|Collision in derived type   |[OOP] Collision in derived
   |hashes  |type hashes

[Bug c/78736] enum warnings in GCC

2016-12-12 Thread erika.molnar at cyberthorstudios dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78736

ErikaMolnar  changed:

   What|Removed |Added

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

--- Comment #4 from ErikaMolnar  ---
Thank you for your fast reply! I knew about the options. I would like some
warnings for the two assignments, please.

[Bug go/78763] go1: internal compiler error: in do_get_backend, at go/gofrontend/expressions.cc:8352

2016-12-12 Thread jdanek at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78763

--- Comment #3 from Jiri Danek  ---
On Mon, Dec 12, 2016 at 11:14 AM, marxin at gcc dot gnu.org <
gcc-bugzi...@gcc.gnu.org> wrote:

> --- Comment #2 from Martin Liška  ---
> Hi. I can confirm that the docker command triggers ICE. However manually
> cloning the repository and building with GCC 6.2 works fine.
>
> Can you please investigate which version of compiler is used during docker
> build? Is there any option to 'chroot' to build env in docker to run the
> command manually?
>

You can run

docker run --rm -it jdanekrh/gcc-78763 bash

which will give you Bash terminal inside the container. You can then run
make (as in the original reproduction steps), or do something else. You are
the roor user and the container is based on debian jessie. You can use
apt-get to install things.

You can also run

docker run --rm -it -v `pwd`:/mnt jdanekrh/gcc-78763 bash


which does the same as before, but in addition mounts current directory as
/mnt inside the container, so you can use it to move files to and from the
container.


I am not really expert on docker, so this may not be the smartest way to do
this.

[Bug target/78762] Regression: Splitting unaligned AVX loads also when AVX2 is enabled

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

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org,
   ||uros at gcc dot gnu.org,
   ||vekumar at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek  ---
Sure, the question is (raised several times over the last couple of years) is
if the generic tuning should not adjust slightly based on the selected ISAs.
AVX2 is right now only supported by Intel CPUs and bdver4/znver1 from the AMD
CPUs.  The Intel CPUs don't want this kind of tuning, dunno if bdver4/znver1
prefers such splitting or not.  If not and it is limited only to older AMD
chips, the question is whether it shouldn't be removed from the generic tuning,
or if narrowing the set of CPUs (by adding further ISAs) can't change some
properties of the generic tuning (say define generic+avx2 and generic+avx512f
tunings that would be enabled for generic tuning if MASK_AVX2 or MASK_AVX512F
is set).

[Bug tree-optimization/77309] [5/6 Regression] wrong code at -Os and above on x86_64-linux-gnu (in the 64-bit mode)

2016-12-12 Thread bernds at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77309

--- Comment #5 from Bernd Schmidt  ---
Author: bernds
Date: Mon Dec 12 13:00:53 2016
New Revision: 243549

URL: https://gcc.gnu.org/viewcvs?rev=243549&root=gcc&view=rev
Log:
Backport from mainline
2016-11-07  Bernd Schmidt  

PR rtl-optimization/77309
* combine.c (make_compound_operation): Allow EQ for IN_CODE, and
don't assume an equality comparison for plain COMPARE.
(simplify_comparison): Pass a more accurate code to
make_compound_operation.

PR rtl-optimization/77309
* gcc.dg/torture/pr77309.c: New test.


Added:
branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr77309.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/combine.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug tree-optimization/77309] [5/6 Regression] wrong code at -Os and above on x86_64-linux-gnu (in the 64-bit mode)

2016-12-12 Thread bernds at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77309

--- Comment #6 from Bernd Schmidt  ---
Author: bernds
Date: Mon Dec 12 13:01:28 2016
New Revision: 243550

URL: https://gcc.gnu.org/viewcvs?rev=243550&root=gcc&view=rev
Log:
Backport from mainline
2016-11-07  Bernd Schmidt  

PR rtl-optimization/77309
* combine.c (make_compound_operation): Allow EQ for IN_CODE, and
don't assume an equality comparison for plain COMPARE.
(simplify_comparison): Pass a more accurate code to
make_compound_operation.

PR rtl-optimization/77309
* gcc.dg/torture/pr77309.c: New test.

Added:
branches/gcc-5-branch/gcc/testsuite/gcc.dg/torture/pr77309.c
Modified:
branches/gcc-5-branch/gcc/ChangeLog
branches/gcc-5-branch/gcc/combine.c
branches/gcc-5-branch/gcc/testsuite/ChangeLog

[Bug target/78762] Regression: Splitting unaligned AVX loads also when AVX2 is enabled

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

Jakub Jelinek  changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com

--- Comment #7 from Jakub Jelinek  ---
Actually, it seems the unaligned load splitting is there because of
sandybridge?
DEF_TUNE (X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL, "256_unaligned_load_optimal",
  ~(m_NEHALEM | m_SANDYBRIDGE | m_GENERIC))
Though the Nehalem in there is weird, there weren't any Nehalem CPUs with AVX
support, right?  And if it is just something for Sandybridge which doesn't
support AVX2, then either for AVX2 we should use a different tuning parameter
(which might be set for all CPUs?), or do the ISA specific generic tuning.

[Bug rtl-optimization/78669] [7 Regression]: ICE: in combine_and_move_insns, at ira.c:3665 with -Os -fno-tree-ter -mavx512bw

2016-12-12 Thread bernds at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78669

--- Comment #5 from Bernd Schmidt  ---
Author: bernds
Date: Mon Dec 12 13:29:48 2016
New Revision: 243551

URL: https://gcc.gnu.org/viewcvs?rev=243551&root=gcc&view=rev
Log:

PR rtl-optimization/78669
* ira.c (combine_and_move_insns): When deleting an insn, clear the
replace flag for all used regs in that insn.

PR rtl-optimization/78669
* gcc.target/i386/pr78669.c: New test.


Added:
trunk/gcc/testsuite/gcc.target/i386/pr78669.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/ira.c
trunk/gcc/testsuite/ChangeLog

[Bug rtl-optimization/77844] [5/7 Regression] Compilation of simple C++ example exhaust memory

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

--- Comment #8 from Jakub Jelinek  ---
For a single bb function I don't see how there could be a problem with
converging during var-tracking.
I think the problem is elsewhere, during combine.
E.g. we have:
(debug_insn 3303 3302 3304 2 (var_location:QI __x (ne:QI (ne:QI (and:DI (reg:DI
118 [ cstore_186 ])
(const_int 262144 [0x4]))
(const_int 0 [0]))
(ne:QI (and:DI (reg:DI 118 [ cstore_186 ])
(const_int 8388608 [0x80]))
(const_int 0 [0] -1
 (nil))
and combine calls propagate_for_debug that includes this and replaces
(reg:DI 118 [ cstore_186 ])
with
(if_then_else:DI (eq (reg:CCZ 17 flags)
(const_int 0 [0]))
(and:DI (reg:DI 109 [ _133 ])
(const_int -4194305 [0xffbf]))
(reg:DI 320))
so it has 4 pseudo references instead of 2.
After a while it is called again replacing
(reg:DI 109 [ _133 ])
with
(if_then_else:DI (eq (reg:CCZ 17 flags)
(const_int 0 [0]))
(and:DI (reg:DI 104 [ _103 ])
(const_int -2097153 [0xffdf]))
(reg:DI 356))
shortly it becomes:
(debug_insn 3303 3302 3304 2 (var_location:QI __x (ne:QI (ne:QI (and:DI
(if_then_else:DI (eq (reg:CCZ 17 flags)
(const_int 0 [0]))
(and:DI (if_then_else:DI (eq (reg:CCZ 17 flags)
(const_int 0 [0]))
(and:DI (reg:DI 104 [ _103 ])
(const_int -2097153 [0xffdf]))
(reg:DI 356))
(const_int -4194305 [0xffbf]))
(ior:DI (if_then_else:DI (eq (reg:CCZ 17 flags)
(const_int 0 [0]))
(and:DI (reg:DI 104 [ _103 ])
(const_int -2097153 [0xffdf]))
(reg:DI 356))
(const_int 4194304 [0x40])))
(const_int 262144 [0x4]))
(const_int 0 [0]))
(ne:QI (and:DI (if_then_else:DI (eq (reg:CCZ 17 flags)
(const_int 0 [0]))
(and:DI (if_then_else:DI (eq (reg:CCZ 17 flags)
(const_int 0 [0]))
(and:DI (reg:DI 104 [ _103 ])
(const_int -2097153 [0xffdf]))
(reg:DI 356))
(const_int -4194305 [0xffbf]))
(ior:DI (if_then_else:DI (eq (reg:CCZ 17 flags)
(const_int 0 [0]))
(and:DI (reg:DI 104 [ _103 ])
(const_int -2097153 [0xffdf]))
(reg:DI 356))
(const_int 4194304 [0x40])))
(const_int 8388608 [0x80]))
(const_int 0 [0] -1
 (nil))
and that grows further and further into a huge expression that is very
expensive to handle e.g. in nonzero_bits, etc.
So, I wonder if we don't want something in propagate_for_debug if
simplify_replace_fn_rtx returns already too complex expression to split it
apart using debug temporaries into smaller parts (or another alternative is to
reset the debug insn if it grows into a too complex expression).
In var-tracking.c we have also params that punt over certain expression
complexity (--param max-vartrack-expr-depth=12), which is kind of an example
that very complex expressions can be thrown away.
Or in cfgexpand.c avoid_deep_ter_for_debug is an example of function that
splits too complex debug expressions (over hardcoded depth of TER).

[Bug target/78762] Regression: Splitting unaligned AVX loads also when AVX2 is enabled

2016-12-12 Thread venkataramanan.kumar at amd dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78762

Venkataramanan  changed:

   What|Removed |Added

 CC||venkataramanan.kumar at amd 
dot co
   ||m

--- Comment #8 from Venkataramanan  ---
(In reply to Jakub Jelinek from comment #7)
> Actually, it seems the unaligned load splitting is there because of
> sandybridge?
> DEF_TUNE (X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL,
> "256_unaligned_load_optimal",
>   ~(m_NEHALEM | m_SANDYBRIDGE | m_GENERIC))
> Though the Nehalem in there is weird, there weren't any Nehalem CPUs with
> AVX support, right?  And if it is just something for Sandybridge which
> doesn't support AVX2, then either for AVX2 we should use a different tuning
> parameter (which might be set for all CPUs?), or do the ISA specific generic
> tuning.

My understanding is that avx256 unaligned loads are good for all the processors
other than NEHALEM, SANDYBRIDGE and GENERIC. In other words splitting is set
for only these targets. 

Before I can comment on whether AMD targets needs this tuning (or) what is the
behavior we want to see for generic, allow me to benchmark and get back.

[Bug c++/78774] New: Internal compiler error segmentation fault: constexpr string literals and templates

2016-12-12 Thread rush at rushbase dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78774

Bug ID: 78774
   Summary: Internal compiler error segmentation fault: constexpr
string literals and templates
   Product: gcc
   Version: 6.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: rush at rushbase dot net
  Target Milestone: ---

Created attachment 40310
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40310&action=edit
Breaking code

The sample code works well in GCC 4 and 5. It breaks at least in 6.2.0 and
6.2.1 and both in openSUSE and Ubuntu. I would appreciate some workaround tips
until the issue is fixed.

rush@rushpod: ~/c/cortex [master] » g++-6 -v
Using built-in specs.
COLLECT_GCC=g++-6
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/6/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada,go
--enable-offload-targets=hsa --enable-checking=release
--with-gxx-include-dir=/usr/include/c++/6 --enable-ssp --disable-libssp
--disable-libvtv --disable-libcc1 --enable-plugin
--with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
--disable-libgcj --with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --disable-libstdcxx-pch
--enable-version-specific-runtime-libs --enable-linker-build-id
--enable-linux-futex --enable-gnu-indirect-function --program-suffix=-6
--without-system-libunwind --enable-multilib --with-arch-32=x86-64
--with-tune=generic --build=x86_64-suse-linux --host=x86_64-suse-linux
Thread model: posix
gcc version 6.2.1 20160830 [gcc-6-branch revision 239856] (SUSE Linux) 

rush@rushpod: ~/c/cortex [master] » g++-6 -std=c++11 -Wall -Wextra test.ii
test.hpp: In substitution of ‘template
template using explode = typename impl::ops::explode_<(* * Ptr), 0, Ptr>::list [with const char* const* Ptr = (&
format_m::fmt); char ENDING = '\000'; char ...Args = {}]’:
test.hpp:25:54:   required from here
test.hpp:14:56: internal compiler error: Segmentation fault
  using explode = typename explode_<**Ptr, 0, Ptr>::list;
^
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

[Bug c++/78621] lambda mangling not ABI compliant

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

Nathan Sidwell  changed:

   What|Removed |Added

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

--- Comment #2 from Nathan Sidwell  ---
following ABI discussion, this is determined to be not a bug.

[Bug middle-end/78716] [7 Regression] ICE in gimplify_va_arg_expr, at gimplify.c:12650 (i686-linux-gnu)

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

--- Comment #3 from Marek Polacek  ---
Author: mpolacek
Date: Mon Dec 12 13:57:32 2016
New Revision: 243553

URL: https://gcc.gnu.org/viewcvs?rev=243553&root=gcc&view=rev
Log:
PR middle-end/78716
* gimplify.c (gimplify_va_arg_expr): Don't require ADDR_EXPR for
Case 1; check POINTER_TYPE_P instead.

* g++.dg/other/vararg-5.C: New.

Added:
trunk/gcc/testsuite/g++.dg/other/vararg-5.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/gimplify.c
trunk/gcc/testsuite/ChangeLog

[Bug tree-optimization/78775] New: [7 Regression] ICE in maybe_warn_alloc_args_overflow

2016-12-12 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78775

Bug ID: 78775
   Summary: [7 Regression] ICE in maybe_warn_alloc_args_overflow
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: marxin at gcc dot gnu.org
CC: msebor at gcc dot gnu.org
  Target Milestone: ---

Starting with Martin's commit r243470, we ICE for following code:

$ cat ice.i
int a, b, *c;
int main ()
{
  unsigned long d = 0;
  while (1)
{
  switch (b)
  case 'S':
  d = a;
  c = __builtin_malloc (d);
}
}

$ gcc -O2 -c ice.i

#11 0x009646e1 in operand_signed_p (op=0x768907e0) at
../../gcc/calls.c:1277
#12 0x009646e1 in operand_signed_p (op=0x76890798) at
../../gcc/calls.c:1277
#13 0x009646e1 in operand_signed_p (op=0x768907e0) at
../../gcc/calls.c:1277
#14 0x009646e1 in operand_signed_p (op=0x76890798) at
../../gcc/calls.c:1277
#15 0x009646e1 in operand_signed_p (op=0x768907e0) at
../../gcc/calls.c:1277
#16 0x009646e1 in operand_signed_p (op=0x76890798) at
../../gcc/calls.c:1277
#17 0x009646e1 in operand_signed_p (op=0x768907e0) at
../../gcc/calls.c:1277
#18 0x009646e1 in operand_signed_p (op=0x76890798) at
../../gcc/calls.c:1277
#19 0x009646e1 in operand_signed_p (op=0x768907e0) at
../../gcc/calls.c:1277
#20 0x009646e1 in operand_signed_p (op=0x76890798) at
../../gcc/calls.c:1277
#21 0x009646e1 in operand_signed_p (op=0x768907e0) at
../../gcc/calls.c:1277
#22 0x00964ea4 in maybe_warn_alloc_args_overflow (fn=0x76944200,
exp=0x76892bd0, args=0x7fffc470, idx=0x7fffc480) at
../../gcc/calls.c:1385
#23 0x009677a6 in initialize_argument_information (num_actuals=1,
args=0x7fffc570, args_size=0x7fffc7f0, n_named_args=2,
exp=0x76892bd0, struct_value_addr_value=0x0, fndecl=0x76944200,
fntype=0x76930498, args_so_far=..., 
reg_parm_stack_space=0, old_stack_level=0x7fffc748,
old_pending_adj=0x7fffc744, must_preallocate=0x7fffc768,
ecf_flags=0x7fffc760, may_tailcall=0x7fffc82f, call_from_thunk_p=false)
at ../../gcc/calls.c:1936
#24 0x0096b844 in expand_call (exp=0x76892bd0,
target=0x769c26c0, ignore=0) at ../../gcc/calls.c:3272
#25 0x0094f0d0 in expand_builtin (exp=0x76892bd0,
target=0x769c26c0, subtarget=0x0, mode=DImode, ignore=0) at
../../gcc/builtins.c:7485
#26 0x00af23cc in expand_expr_real_1 (exp=0x76892bd0,
target=0x769c26c0, tmode=DImode, modifier=EXPAND_NORMAL,
alt_rtl=0x7fffd110, inner_reference_p=false) at ../../gcc/expr.c:10772
#27 0x00ae636e in expand_expr_real (exp=0x76892bd0,
target=0x769c26c0, tmode=DImode, modifier=EXPAND_NORMAL,
alt_rtl=0x7fffd110, inner_reference_p=false) at ../../gcc/expr.c:8087
#28 0x00add259 in store_expr_with_bounds (exp=0x76892bd0,
target=0x769c26c0, call_param_p=0, nontemporal=false, reverse=false,
btarget=0x76890708) at ../../gcc/expr.c:5551
#29 0x00adbcae in expand_assignment (to=0x76890708,
from=0x76892bd0, nontemporal=false) at ../../gcc/expr.c:5320
#30 0x009847d3 in expand_call_stmt (stmt=0x77fedcf0) at
../../gcc/cfgexpand.c:2656
#31 0x00987a03 in expand_gimple_stmt_1 (stmt=0x77fedcf0) at
../../gcc/cfgexpand.c:3571
#32 0x009880f9 in expand_gimple_stmt (stmt=0x77fedcf0) at
../../gcc/cfgexpand.c:3737
#33 0x0098f959 in expand_gimple_basic_block (bb=0x768913a8,
disable_tail_calls=false) at ../../gcc/cfgexpand.c:5744
#34 0x009913e1 in (anonymous namespace)::pass_expand::execute
(this=0x2886100, fun=0x769b7000) at ../../gcc/cfgexpand.c:6355
#35 0x00df7273 in execute_one_pass (pass=0x2886100) at
../../gcc/passes.c:2370
#36 0x00df75c4 in execute_pass_list_1 (pass=0x2886100) at
../../gcc/passes.c:2459
#37 0x00df764d in execute_pass_list (fn=0x769b7000, pass=0x2882730)
at ../../gcc/passes.c:2470
#38 0x009d829e in cgraph_node::expand (this=0x769bb000) at
../../gcc/cgraphunit.c:2001
#39 0x009d88d7 in expand_all_functions () at
../../gcc/cgraphunit.c:2137
#40 0x009d946d in symbol_table::compile (this=0x7688a100) at
../../gcc/cgraphunit.c:2494
#41 0x009d96ac in symbol_table::finalize_compilation_unit
(this=0x7688a100) at ../../gcc/cgraphunit.c:2584
#42 0x00f1cb89 in compile_file () at ../../gcc/toplev.c:488
#43 0x00f1f062 in do_compile () at ../../gcc/toplev.c:1983
#44 0x00f1f33e in toplev::main (this=0x7fffd9f0, argc=13,
argv=0x7fffdaf8) at ../../gcc/toplev.c:2117
#45 0x01a262e0 in main (argc=13, argv=0x7fffdaf8) at
../../gcc/main.c:39

There's an infinite recursion.

[Bug target/77904] [ARM Cortex-M0] Frame pointer thrashes registers if assembly statements with "sp" clobber are used

2016-12-12 Thread thopre01 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77904

Thomas Preud'homme  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
  Known to work||6.2.1
 Resolution|--- |FIXED
  Known to fail|6.2.1   |6.2.0

--- Comment #11 from Thomas Preud'homme  ---
Fixed in all supported version of GCC (GCC 5 does not seem affected).

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

2016-12-12 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78775

Martin Liška  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
   Last reconfirmed||2016-12-12
   Target Milestone|--- |7.0

[Bug fortran/78737] [OOP] linking error with deferred, undefined user-defined derived-type I/O

2016-12-12 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78737

--- Comment #16 from Paul Thomas  ---
(In reply to Paul Thomas from comment #15)
> (In reply to Damian Rouson from comment #14)
> > Hi Paul,
> > 
> > Based on comment #12, I assume you no longer believe that type guarding is
> > required.  If I misinterpreted comment #12, please let me know. Otherwise,
> > please let me know what in the standard indicates that type guarding is
> > required.  I too would be surprised.
> 
> Dear Damian and Janus,
> 
> What I meant is that we did not implement dynamic dispatch of the dtio
> procedures. In the corrected testcase of comments #12 and #13, where the
> first argument of write_formatted has declared type 'object', it is
> necessary to use type guarding within write_formatted to obtain the
> appropriate IO.
> 
> I have to confess that this "interpretation" is arrived at by the absence of
> any mention of the need for dynamic dispatch and by the implementation by
> other vendors.
> 
> See this further example, which works with the last version of the patch.
> 
> module object_interface
>   type, abstract :: object
>   contains
> procedure(write_formatted_interface), deferred :: write_formatted
> generic :: write(formatted) => write_formatted
>   end type
>   abstract interface
> subroutine write_formatted_interface(this,unit,iotype,vlist,iostat,iomsg)
>   import object
>   class(object), intent(in) :: this
>   integer, intent(in) :: unit
>   character (len=*), intent(in) :: iotype
>   integer, intent(in) :: vlist(:)
>   integer, intent(out) :: iostat
>   character (len=*), intent(inout) :: iomsg
> end subroutine
>   end interface
>   type, extends(object) :: non_abstract_child
> integer :: i
>   contains
> procedure :: write_formatted => write_formatted2
>   end type
> contains
>   subroutine write_formatted(this,unit,iotype,vlist,iostat,iomsg)
> class(object), intent(in) :: this
> integer, intent(in) :: unit
> character (len=*), intent(in) :: iotype
> integer, intent(in) :: vlist(:)
> integer, intent(out) :: iostat
> character (len=*), intent(inout) :: iomsg
> select type (this)
>   class is (non_abstract_child)
> print '(a,i4/)', "write_formatted => ", this%i
> print *, this
>   class default
> print *, "Error"
> end select
>   end subroutine
>   subroutine write_formatted2(this,unit,iotype,vlist,iostat,iomsg)
> class(non_abstract_child), intent(in) :: this
> integer, intent(in) :: unit
> character (len=*), intent(in) :: iotype
> integer, intent(in) :: vlist(:)
> integer, intent(out) :: iostat
> character (len=*), intent(inout) :: iomsg
> print '(a,i4/)', "write_formatted2 => ", this%i
>   end subroutine
>   subroutine assert(a)
> class(object):: a
> write(*,*) a
>   end subroutine
> end module
> 
>   use object_interface
>   class (object), allocatable :: z
>   allocate (z, source = non_abstract_child (99))
>   call assert (z)
> end
> 
> Is this now OK?
> 
> Paul

On thinking about it, is the specific instance of write_formatted allowed? it
is easily forbidden, if not.

Cheers

Paul

[Bug c++/78774] [6 Regression] ICE in constexpr string literals and templates

2016-12-12 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78774

Martin Liška  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-12-12
 CC||jason at gcc dot gnu.org,
   ||marxin at gcc dot gnu.org
   Target Milestone|--- |6.3
Summary|Internal compiler error |[6 Regression] ICE in
   |segmentation fault: |constexpr string literals
   |constexpr string literals   |and templates
   |and templates   |
 Ever confirmed|0   |1

--- Comment #1 from Martin Liška  ---
Confirmed, it's just 6 branch regression. On trunk fixed by Jason's commit
r241425.

[Bug middle-end/78716] [7 Regression] ICE in gimplify_va_arg_expr, at gimplify.c:12650 (i686-linux-gnu)

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

Marek Polacek  changed:

   What|Removed |Added

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

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

[Bug c/78736] enum warnings in GCC

2016-12-12 Thread prathamesh3492 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78736

prathamesh3492 at gcc dot gnu.org changed:

   What|Removed |Added

 CC||prathamesh3492 at gcc dot 
gnu.org

--- Comment #5 from prathamesh3492 at gcc dot gnu.org ---
clang emits a similar diagnostic with -Wenum-conversion.
I suppose we could also add a similar option that warns when
an enum is implicitly converted from one enum type to other ?

With the following untested patch:

diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index f0917ed..2a6e656 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -6255,6 +6255,19 @@ convert_for_assignment (location_t location, location_t
expr_loc, tree type,
}
 }

+  {
+tree checktype = origtype != NULL_TREE ? origtype : rhstype;
+if (checktype != error_mark_node
+   && TREE_CODE (checktype) == ENUMERAL_TYPE
+   && TREE_CODE (type) == ENUMERAL_TYPE
+   && TYPE_MAIN_VARIANT (checktype) != TYPE_MAIN_VARIANT (type))
+  {
+gcc_rich_location loc (location);
+   warning_at_rich_loc (&loc, 0, "implicit conversion from"
+   " enum type %qT to %qT", checktype, type);
+  }
+  }
+
   if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (rhstype))
 return rhs;

gcc emits the diagnostic:
78736.c:5:16: warning: implicit conversion from enum
type ‘enum ’ to ‘name2_t {aka enum }’
 name2_t name = brandon;
^~~

Is this patch in the right direction ?
Working on a fair patch.

Thanks,
Prathamesh

[Bug libstdc++/70975] experimental/filesystem/operations/copy.cc FAILs on Solaris 12

2016-12-12 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70975

--- Comment #8 from Jonathan Wakely  ---
Author: redi
Date: Mon Dec 12 14:09:39 2016
New Revision: 243554

URL: https://gcc.gnu.org/viewcvs?rev=243554&root=gcc&view=rev
Log:
Backport all Filesystem library fixes from trunk

This implements the following LWG DRs:
2681 2682 2683 2706 2707 2712 2720 2723

Backport from mainline
PR libstdc++/70975
PR libstdc++/71337
PR libstdc++/78111
* include/experimental/bits/fs_dir.h (recursive_directory_iterator):
Overload pop (LWG 2706).
* include/experimental/bits/fs_fwd.h (perms::resolve_symlinks):
Replace with symlink_nofollow (LWG 2720).
* include/experimental/bits/fs_ops.h
(exists(const path&, error_code&)): Clear error if status is known
(LWG 2725).
* include/experimental/bits/fs_path.h (__is_path_src)
(_S_range_begin, _S_range_end): Overload to treat string_view as a
Source object.
(path::operator+=, path::compare): Overload for basic_string_view.
(path::path(string_type&&))
(path::operator=(string&&), path::assign(string_type&&)): Define
construction and assignment from string_type rvalues (LWG 2707).
(path::_S_convert<_Iter>(_Iter, _Iter)): Remove cv-qualifiers from
iterator's value_type.
(path::_S_convert<_Iter>(_Iter __first, __null_terminated)): Likewise.
Do not use operation not supported by input iterators.
(path::__is_path_iter_src): Add partial specialization for const
encoded character types.
* src/filesystem/dir.cc (open_dir): Return same value for errors
whether ignored or not.
(_Dir::advance(error_code*, directory_options)): Return false on
error.
(directory_iterator(const path&, directory_options, error_code*)):
Create end iterator on error (LWG 2723).
(recursive_directory_iterator(const path&, directory_options,
error_code*)): Likewise.
(recursive_directory_iterator::increment): Reset state on error.
(recursive_directory_iterator::pop): Define new overload.
* src/filesystem/ops.cc (canonical): Set error for non-existent path.
(file_time): Take error_code parameter and check for overflow.
(close_fd): Remove.
(do_copy_file): Report an error if source or destination is not a
regular file (LWG 2712). Pass error_code in file_time calls.  Just
use close(3) instead of close_fd, to prevent retrying on error.
Check if _GLIBCXX_USE_FCHMODAT is defined.
[_GLIBCXX_USE_SENDFILE]: Fallback to read/write operations in case
sendfile fails with ENOSYS or EINVAL. Pass non-null pointer to
sendfile for offset argument.
(copy): Update comment to refer to LWG 2681. Implement 2682 and 2683
resolutions.
(equivalent): Fix error handling and result when only one file exists.
(is_empty): Fix error handling.
(last_write_time(const path&, error_code&)): Pass error_code in
file_time calls.
(last_write_time(const path&, file_time_type, error_code&)): Handle
negative times correctly.
(permissions(const path&, perms, error_code&)): Handle
symlink_nofollow.
(read_symlink): Add missing ec.clear().
(status(const path&, error_code&)): Handle EOVERFLOW.
(temp_directory_path): Pass error_code argument to other filesystem
operations.
* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
Update expected behaviour on error.
* testsuite/experimental/filesystem/iterators/pop.cc: New.
* testsuite/experimental/filesystem/iterators/
recursive_directory_iterator.cc: Update expected behaviour on error.
* testsuite/experimental/filesystem/operations/copy.cc: Update
expected behaviour for copying directories with create_symlinks.
Verify that error_code arguments are cleared if there's no error.
Remove files created by tests. Test copying directories.
* testsuite/experimental/filesystem/operations/copy_file.cc: Remove
files created by tests.
* testsuite/experimental/filesystem/operations/create_symlink.cc: New.
* testsuite/experimental/filesystem/operations/equivalent.cc: New.
* testsuite/experimental/filesystem/operations/exists.cc: Test
overload taking an error_code.
* testsuite/experimental/filesystem/operations/is_empty.cc: New.
* testsuite/experimental/filesystem/operations/last_write_time.cc:
New.
* testsuite/experimental/filesystem/operations/permissions.cc: Test
overload taking error_code. Test symlink_nofollow on non-symlinks.
* testsuite/experimental/filesystem/operations/read_symlink.cc: New.
* testsuite/experimental/filesystem/operations/remove_all.cc: New.
* testsuite/experimental/files

[Bug libstdc++/71337] temp_directory_path(error_code&) shouldn't throw from !exists(p) || !is_directory(p)

2016-12-12 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71337

--- Comment #4 from Jonathan Wakely  ---
Author: redi
Date: Mon Dec 12 14:09:39 2016
New Revision: 243554

URL: https://gcc.gnu.org/viewcvs?rev=243554&root=gcc&view=rev
Log:
Backport all Filesystem library fixes from trunk

This implements the following LWG DRs:
2681 2682 2683 2706 2707 2712 2720 2723

Backport from mainline
PR libstdc++/70975
PR libstdc++/71337
PR libstdc++/78111
* include/experimental/bits/fs_dir.h (recursive_directory_iterator):
Overload pop (LWG 2706).
* include/experimental/bits/fs_fwd.h (perms::resolve_symlinks):
Replace with symlink_nofollow (LWG 2720).
* include/experimental/bits/fs_ops.h
(exists(const path&, error_code&)): Clear error if status is known
(LWG 2725).
* include/experimental/bits/fs_path.h (__is_path_src)
(_S_range_begin, _S_range_end): Overload to treat string_view as a
Source object.
(path::operator+=, path::compare): Overload for basic_string_view.
(path::path(string_type&&))
(path::operator=(string&&), path::assign(string_type&&)): Define
construction and assignment from string_type rvalues (LWG 2707).
(path::_S_convert<_Iter>(_Iter, _Iter)): Remove cv-qualifiers from
iterator's value_type.
(path::_S_convert<_Iter>(_Iter __first, __null_terminated)): Likewise.
Do not use operation not supported by input iterators.
(path::__is_path_iter_src): Add partial specialization for const
encoded character types.
* src/filesystem/dir.cc (open_dir): Return same value for errors
whether ignored or not.
(_Dir::advance(error_code*, directory_options)): Return false on
error.
(directory_iterator(const path&, directory_options, error_code*)):
Create end iterator on error (LWG 2723).
(recursive_directory_iterator(const path&, directory_options,
error_code*)): Likewise.
(recursive_directory_iterator::increment): Reset state on error.
(recursive_directory_iterator::pop): Define new overload.
* src/filesystem/ops.cc (canonical): Set error for non-existent path.
(file_time): Take error_code parameter and check for overflow.
(close_fd): Remove.
(do_copy_file): Report an error if source or destination is not a
regular file (LWG 2712). Pass error_code in file_time calls.  Just
use close(3) instead of close_fd, to prevent retrying on error.
Check if _GLIBCXX_USE_FCHMODAT is defined.
[_GLIBCXX_USE_SENDFILE]: Fallback to read/write operations in case
sendfile fails with ENOSYS or EINVAL. Pass non-null pointer to
sendfile for offset argument.
(copy): Update comment to refer to LWG 2681. Implement 2682 and 2683
resolutions.
(equivalent): Fix error handling and result when only one file exists.
(is_empty): Fix error handling.
(last_write_time(const path&, error_code&)): Pass error_code in
file_time calls.
(last_write_time(const path&, file_time_type, error_code&)): Handle
negative times correctly.
(permissions(const path&, perms, error_code&)): Handle
symlink_nofollow.
(read_symlink): Add missing ec.clear().
(status(const path&, error_code&)): Handle EOVERFLOW.
(temp_directory_path): Pass error_code argument to other filesystem
operations.
* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
Update expected behaviour on error.
* testsuite/experimental/filesystem/iterators/pop.cc: New.
* testsuite/experimental/filesystem/iterators/
recursive_directory_iterator.cc: Update expected behaviour on error.
* testsuite/experimental/filesystem/operations/copy.cc: Update
expected behaviour for copying directories with create_symlinks.
Verify that error_code arguments are cleared if there's no error.
Remove files created by tests. Test copying directories.
* testsuite/experimental/filesystem/operations/copy_file.cc: Remove
files created by tests.
* testsuite/experimental/filesystem/operations/create_symlink.cc: New.
* testsuite/experimental/filesystem/operations/equivalent.cc: New.
* testsuite/experimental/filesystem/operations/exists.cc: Test
overload taking an error_code.
* testsuite/experimental/filesystem/operations/is_empty.cc: New.
* testsuite/experimental/filesystem/operations/last_write_time.cc:
New.
* testsuite/experimental/filesystem/operations/permissions.cc: Test
overload taking error_code. Test symlink_nofollow on non-symlinks.
* testsuite/experimental/filesystem/operations/read_symlink.cc: New.
* testsuite/experimental/filesystem/operations/remove_all.cc: New.
* testsuite/experimental/files

[Bug go/78763] go1: internal compiler error: in do_get_backend, at go/gofrontend/expressions.cc:8352

2016-12-12 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78763

--- Comment #4 from Martin Liška  ---
I was able to run bash in the container, however I can't isolate the issue as
it executes an python script with some ENV variables. Can you please test it
with openSUSE?

[Bug libstdc++/78111] [7 regression] experimental/filesystem/operations/canonical.cc FAILs

2016-12-12 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78111

--- Comment #8 from Jonathan Wakely  ---
Author: redi
Date: Mon Dec 12 14:09:39 2016
New Revision: 243554

URL: https://gcc.gnu.org/viewcvs?rev=243554&root=gcc&view=rev
Log:
Backport all Filesystem library fixes from trunk

This implements the following LWG DRs:
2681 2682 2683 2706 2707 2712 2720 2723

Backport from mainline
PR libstdc++/70975
PR libstdc++/71337
PR libstdc++/78111
* include/experimental/bits/fs_dir.h (recursive_directory_iterator):
Overload pop (LWG 2706).
* include/experimental/bits/fs_fwd.h (perms::resolve_symlinks):
Replace with symlink_nofollow (LWG 2720).
* include/experimental/bits/fs_ops.h
(exists(const path&, error_code&)): Clear error if status is known
(LWG 2725).
* include/experimental/bits/fs_path.h (__is_path_src)
(_S_range_begin, _S_range_end): Overload to treat string_view as a
Source object.
(path::operator+=, path::compare): Overload for basic_string_view.
(path::path(string_type&&))
(path::operator=(string&&), path::assign(string_type&&)): Define
construction and assignment from string_type rvalues (LWG 2707).
(path::_S_convert<_Iter>(_Iter, _Iter)): Remove cv-qualifiers from
iterator's value_type.
(path::_S_convert<_Iter>(_Iter __first, __null_terminated)): Likewise.
Do not use operation not supported by input iterators.
(path::__is_path_iter_src): Add partial specialization for const
encoded character types.
* src/filesystem/dir.cc (open_dir): Return same value for errors
whether ignored or not.
(_Dir::advance(error_code*, directory_options)): Return false on
error.
(directory_iterator(const path&, directory_options, error_code*)):
Create end iterator on error (LWG 2723).
(recursive_directory_iterator(const path&, directory_options,
error_code*)): Likewise.
(recursive_directory_iterator::increment): Reset state on error.
(recursive_directory_iterator::pop): Define new overload.
* src/filesystem/ops.cc (canonical): Set error for non-existent path.
(file_time): Take error_code parameter and check for overflow.
(close_fd): Remove.
(do_copy_file): Report an error if source or destination is not a
regular file (LWG 2712). Pass error_code in file_time calls.  Just
use close(3) instead of close_fd, to prevent retrying on error.
Check if _GLIBCXX_USE_FCHMODAT is defined.
[_GLIBCXX_USE_SENDFILE]: Fallback to read/write operations in case
sendfile fails with ENOSYS or EINVAL. Pass non-null pointer to
sendfile for offset argument.
(copy): Update comment to refer to LWG 2681. Implement 2682 and 2683
resolutions.
(equivalent): Fix error handling and result when only one file exists.
(is_empty): Fix error handling.
(last_write_time(const path&, error_code&)): Pass error_code in
file_time calls.
(last_write_time(const path&, file_time_type, error_code&)): Handle
negative times correctly.
(permissions(const path&, perms, error_code&)): Handle
symlink_nofollow.
(read_symlink): Add missing ec.clear().
(status(const path&, error_code&)): Handle EOVERFLOW.
(temp_directory_path): Pass error_code argument to other filesystem
operations.
* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
Update expected behaviour on error.
* testsuite/experimental/filesystem/iterators/pop.cc: New.
* testsuite/experimental/filesystem/iterators/
recursive_directory_iterator.cc: Update expected behaviour on error.
* testsuite/experimental/filesystem/operations/copy.cc: Update
expected behaviour for copying directories with create_symlinks.
Verify that error_code arguments are cleared if there's no error.
Remove files created by tests. Test copying directories.
* testsuite/experimental/filesystem/operations/copy_file.cc: Remove
files created by tests.
* testsuite/experimental/filesystem/operations/create_symlink.cc: New.
* testsuite/experimental/filesystem/operations/equivalent.cc: New.
* testsuite/experimental/filesystem/operations/exists.cc: Test
overload taking an error_code.
* testsuite/experimental/filesystem/operations/is_empty.cc: New.
* testsuite/experimental/filesystem/operations/last_write_time.cc:
New.
* testsuite/experimental/filesystem/operations/permissions.cc: Test
overload taking error_code. Test symlink_nofollow on non-symlinks.
* testsuite/experimental/filesystem/operations/read_symlink.cc: New.
* testsuite/experimental/filesystem/operations/remove_all.cc: New.
* testsuite/experimental/files

[Bug c++/78774] [6 Regression] ICE in constexpr string literals and templates

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

Markus Trippelsdorf  changed:

   What|Removed |Added

 CC||trippels at gcc dot gnu.org

--- Comment #2 from Markus Trippelsdorf  ---
This variant also ICEs on trunk:

 % cat cr.ii
template  struct ops {
  template  struct A;
  template  using explode = typename A<*Ptr>::join;
};
template  ops<'\0'>::explode a;

 % g++ -c cr.ii
cr.ii: In substitution of ‘template > template using
explode = typename ops< >::A<(* Ptr)>::join [with int* Ptr = Ts::
join; int  = 0]’:
cr.ii:5:51:   required from here
cr.ii:3:61: internal compiler error: Segmentation fault
   template  using explode = typename A<*Ptr>::join;
 ^
0xd5c0ef crash_signal
/home/markus/gcc/gcc/toplev.c:333
0x7f0b4d78f12f ???
   
/home/markus/glibc/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x687912 convert_template_argument
/home/markus/gcc/gcc/cp/pt.c:7382
0x68959b coerce_template_parms
/home/markus/gcc/gcc/cp/pt.c:7821
0x68acb3 coerce_innermost_template_parms
/home/markus/gcc/gcc/cp/pt.c:7912
0x68b67a lookup_template_class_1
/home/markus/gcc/gcc/cp/pt.c:8393
0x68b67a lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
/home/markus/gcc/gcc/cp/pt.c:8738
0x68f1d1 tsubst_aggr_type
/home/markus/gcc/gcc/cp/pt.c:11619
0x67a02e tsubst(tree_node*, tree_node*, int, tree_node*)
/home/markus/gcc/gcc/cp/pt.c:13633
0x674f60 tsubst_decl
/home/markus/gcc/gcc/cp/pt.c:12506
0x67a807 tsubst(tree_node*, tree_node*, int, tree_node*)
/home/markus/gcc/gcc/cp/pt.c:13011
0x69b50f instantiate_template_1
/home/markus/gcc/gcc/cp/pt.c:17806
0x69b50f instantiate_template(tree_node*, tree_node*, int)
/home/markus/gcc/gcc/cp/pt.c:17862
0x67ab7c instantiate_alias_template
/home/markus/gcc/gcc/cp/pt.c:17892
0x67ab7c tsubst(tree_node*, tree_node*, int, tree_node*)
/home/markus/gcc/gcc/cp/pt.c:13038
0x68c489 lookup_template_class_1
/home/markus/gcc/gcc/cp/pt.c:8487
0x68c489 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
/home/markus/gcc/gcc/cp/pt.c:8738
0x7aa96d finish_template_type(tree_node*, tree_node*, int)
/home/markus/gcc/gcc/cp/semantics.c:3144
0x72455d cp_parser_template_id
/home/markus/gcc/gcc/cp/parser.c:15464
0x7247dd cp_parser_class_name
/home/markus/gcc/gcc/cp/parser.c:21876

[Bug c++/78774] [6/7 Regression] ICE in constexpr string literals and templates

2016-12-12 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78774

Martin Liška  changed:

   What|Removed |Added

 CC||msebor at gcc dot gnu.org
Summary|[6 Regression] ICE in   |[6/7 Regression] ICE in
   |constexpr string literals   |constexpr string literals
   |and templates   |and templates

--- Comment #3 from Martin Liška  ---
(In reply to Markus Trippelsdorf from comment #2)
> This variant also ICEs on trunk:
> 
>  % cat cr.ii
> template  struct ops {
>   template  struct A;
>   template  using explode = typename A<*Ptr>::join;
> };
> template  ops<'\0'>::explode a;
> 
>  % g++ -c cr.ii
> cr.ii: In substitution of ‘template > template
> using explode = typename ops< >::A<(* Ptr)>::join [with int* Ptr
> = Ts:: join; int  = 0]’:
> cr.ii:5:51:   required from here
> cr.ii:3:61: internal compiler error: Segmentation fault
>template  using explode = typename A<*Ptr>::join;
>  ^
> 0xd5c0ef crash_signal
> /home/markus/gcc/gcc/toplev.c:333
> 0x7f0b4d78f12f ???
>
> /home/markus/glibc/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
> 0x687912 convert_template_argument
> /home/markus/gcc/gcc/cp/pt.c:7382
> 0x68959b coerce_template_parms
> /home/markus/gcc/gcc/cp/pt.c:7821
> 0x68acb3 coerce_innermost_template_parms
> /home/markus/gcc/gcc/cp/pt.c:7912
> 0x68b67a lookup_template_class_1
> /home/markus/gcc/gcc/cp/pt.c:8393
> 0x68b67a lookup_template_class(tree_node*, tree_node*, tree_node*,
> tree_node*, int, int)
> /home/markus/gcc/gcc/cp/pt.c:8738
> 0x68f1d1 tsubst_aggr_type
> /home/markus/gcc/gcc/cp/pt.c:11619
> 0x67a02e tsubst(tree_node*, tree_node*, int, tree_node*)
> /home/markus/gcc/gcc/cp/pt.c:13633
> 0x674f60 tsubst_decl
> /home/markus/gcc/gcc/cp/pt.c:12506
> 0x67a807 tsubst(tree_node*, tree_node*, int, tree_node*)
> /home/markus/gcc/gcc/cp/pt.c:13011
> 0x69b50f instantiate_template_1
> /home/markus/gcc/gcc/cp/pt.c:17806
> 0x69b50f instantiate_template(tree_node*, tree_node*, int)
> /home/markus/gcc/gcc/cp/pt.c:17862
> 0x67ab7c instantiate_alias_template
> /home/markus/gcc/gcc/cp/pt.c:17892
> 0x67ab7c tsubst(tree_node*, tree_node*, int, tree_node*)
> /home/markus/gcc/gcc/cp/pt.c:13038
> 0x68c489 lookup_template_class_1
> /home/markus/gcc/gcc/cp/pt.c:8487
> 0x68c489 lookup_template_class(tree_node*, tree_node*, tree_node*,
> tree_node*, int, int)
> /home/markus/gcc/gcc/cp/pt.c:8738
> 0x7aa96d finish_template_type(tree_node*, tree_node*, int)
> /home/markus/gcc/gcc/cp/semantics.c:3144
> 0x72455d cp_parser_template_id
> /home/markus/gcc/gcc/cp/parser.c:15464
> 0x7247dd cp_parser_class_name
> /home/markus/gcc/gcc/cp/parser.c:21876

Which started with r227458.

[Bug rtl-optimization/78669] [7 Regression]: ICE: in combine_and_move_insns, at ira.c:3665 with -Os -fno-tree-ter -mavx512bw

2016-12-12 Thread bernds at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78669

Bernd Schmidt  changed:

   What|Removed |Added

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

--- Comment #6 from Bernd Schmidt  ---
Fixed.

[Bug c++/78776] New: member using declaration with typename ICEs

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

Bug ID: 78776
   Summary: member using declaration with typename ICEs
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: nathan at gcc dot gnu.org
  Target Milestone: ---

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

the attached case ICES due to differing types sharing a canonical type.  (Not
sure if the types are actually the same)

compiles w/o error on gcc 6

[Bug c++/78776] member using declaration with typename ICEs

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

Nathan Sidwell  changed:

   What|Removed |Added

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

[Bug c++/70909] Libiberty Demangler segfaults (4)

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

--- Comment #39 from Markus Trippelsdorf  ---
Mark, could you please post your path to gcc-patches?
Then there might be a chance to get it into binutils before 2.28 gets released.

[Bug target/78748] [7 Regression] ICE in extract_insn, at recog.c:2311 (s390x-linux-gnu)

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

--- Comment #5 from Dominik Vogt  ---
Updated and tested patch posted to gcc-patches:
https://gcc.gnu.org/ml/gcc-patches/2016-12/msg01033.html

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

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

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Confirmed.

[Bug c/78736] enum warnings in GCC

2016-12-12 Thread erika.molnar at cyberthorstudios dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78736

--- Comment #6 from ErikaMolnar  ---
Thank you for your help! Looking forward to this new feature.

[Bug tree-optimization/78777] New: [7 Regression] ICE in mark_reachable_handlers, at tree-eh.c:3823 (aarch64-linux-gnu)

2016-12-12 Thread doko at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78777

Bug ID: 78777
   Summary: [7 Regression] ICE in mark_reachable_handlers, at
tree-eh.c:3823 (aarch64-linux-gnu)
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: doko at gcc dot gnu.org
  Target Milestone: ---

seen with r243430 on aarch64-linux-gnu, works with -O0, fails with -O1, -O2:

$ cat server.ii
void i(...);
typedef struct { char b; } c;
typedef struct {
  char d[5];
  int e;
  c *f[4];
  int g[];
} h;
void k(c *, unsigned char *, int);
unsigned char j[1];
void l(h *o, int p, unsigned char *q, int r) {
  int m = 0;
  for (; m < o->e; m++) {
if (o->f[m] || o->g[m])
  continue;
try {
  k(o->f[m], j, 5);
  if (p)
k(o->f[m], q, r);
} catch (int) {
  c a = *o->f[m];
  h *b;
  if (b) {
char n;
i(n & a.b);
  }
}
  }
}

$ g++ -c -O1 -std=c++11 server.ii
server.ii: In function 'void l(h*, int, unsigned char*, int)':
server.ii:11:6: internal compiler error: in mark_reachable_handlers, at
tree-eh.c:3823
 void l(h *o, int p, unsigned char *q, int r) {
  ^
0xb2fb4f mark_reachable_handlers
../../src/gcc/tree-eh.c:3823
0xb2fbab remove_unreachable_handlers
../../src/gcc/tree-eh.c:3870
0xb31753 execute_cleanup_eh_1
../../src/gcc/tree-eh.c:4541
0xb31753 execute
../../src/gcc/tree-eh.c:4608
Please submit a full bug report,
with preprocessed source if appropriate.

[Bug tree-optimization/78777] [7 Regression] ICE in mark_reachable_handlers, at tree-eh.c:3823 (aarch64-linux-gnu)

2016-12-12 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78777

ktkachov at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-12-12
 CC||ktkachov at gcc dot gnu.org
   Target Milestone|--- |7.0
 Ever confirmed|0   |1

--- Comment #1 from ktkachov at gcc dot gnu.org ---
Confirmed

[Bug fortran/78737] [OOP] linking error with deferred, undefined user-defined derived-type I/O

2016-12-12 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78737

--- Comment #17 from janus at gcc dot gnu.org ---
(In reply to Paul Thomas from comment #15)
> Dear Damian and Janus,
> 
> What I meant is that we did not implement dynamic dispatch of the dtio
> procedures. In the corrected testcase of comments #12 and #13, where the
> first argument of write_formatted has declared type 'object', it is
> necessary to use type guarding within write_formatted to obtain the
> appropriate IO.
> 
> I have to confess that this "interpretation" is arrived at by the absence of
> any mention of the need for dynamic dispatch and by the implementation by
> other vendors.

Huh, but I still don't see that the standars would forbid polymorphic uses of
DTIO. To the contrary, the F03 standard says explicitly in section 9.5.2:

"A list item shall not be polymorphic unless it is processed by a user-defined
derived-type input/output
procedure (9.5.3.7)."

I don't see any useful interpretation of code like

class(object):: a
write(*,*) a

except making a polymorphic call to the DTIO procedure corresponding to the
dynamic type (i.e. taken from the vtable). That should not be very hard to
implement in gfortran technically (with all our exisiting machinery for classes
and polymorphism) and I don't see anything that would impose a different
interpretation in the standard. If I'm missing anything, please let me know.


> See this further example, which works with the last version of the patch.
> 
> [...]
> 
> Is this now OK?

Your last patch seems to produce the expected results for this particular case,
but only due to the introduction of the awkward SELECT TYPE workaround.
Actually no polymorphic invocation of the DTIO procedures is performed here.

Also your patch now rejects comment 0 with:

 write(*,*) a
 1
Error: Data transfer element at (1) cannot be polymorphic unless it is
processed by a defined input/output procedure

Is that intentional? AFAICS the code in comment 0 should be valid, right?

[Bug tree-optimization/78777] [7 Regression] ICE in mark_reachable_handlers, at tree-eh.c:3823 (aarch64-linux-gnu)

2016-12-12 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78777

--- Comment #2 from ktkachov at gcc dot gnu.org ---
The ICE I'm getting is:
ice.c: In function 'void l(h*, int, unsigned char*, int)':
ice.c:11:6: error: statement marked for throw in middle of block
 void l(h *o, int p, unsigned char *q, int r) {
  ^
# .MEM_17 = VDEF <.MEM_35>
k (0B, &j, 5);
ice.c:11:6: internal compiler error: verify_gimple failed
0xda3a92 verify_gimple_in_cfg(function*, bool)
$SRC/gcc/tree-cfg.c:5265
0xc85613 execute_function_todo
$SRC/gcc/passes.c:1965
0xc8581e do_per_function
$SRC/gcc/passes.c:1649
0xc85950 execute_todo
$SRC/gcc/passes.c:2015
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

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

--- Comment #2 from Marek Polacek  ---
We're in operand_signed_p, checking whether an SSA_NAME d_4 is signed or not. 
We look at its SSA_NAME_DEF_STMT which is 
d_4 = PHI <0(2), d_5(5)>
and we walk these phi arguments, and we call operand_signed_p (d_5), but its
SSA_NAME_DEF_STMT is
d_5 = PHI 
so we call operand_signed_p (d_4) again -> loop.

[Bug libstdc++/70975] experimental/filesystem/operations/copy.cc FAILs on Solaris 12

2016-12-12 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70975

--- Comment #9 from Jonathan Wakely  ---
Author: redi
Date: Mon Dec 12 15:00:43 2016
New Revision: 243557

URL: https://gcc.gnu.org/viewcvs?rev=243557&root=gcc&view=rev
Log:
Backport all Filesystem library fixes from trunk

This implements the following LWG DRs:
2681 2682 2683 2706 2707 2712 2720 2723

Backport from mainline
PR libstdc++/70975
PR libstdc++/71337
PR libstdc++/78111
* include/experimental/bits/fs_dir.h (recursive_directory_iterator):
Overload pop (LWG 2706).
* include/experimental/bits/fs_fwd.h (perms::resolve_symlinks):
Replace with symlink_nofollow (LWG 2720).
* include/experimental/bits/fs_ops.h
(exists(const path&, error_code&)): Clear error if status is known
(LWG 2725).
* include/experimental/bits/fs_path.h (__is_path_src)
(_S_range_begin, _S_range_end): Overload to treat string_view as a
Source object.
(path::operator+=, path::compare): Overload for basic_string_view.
(path::path(string_type&&))
(path::operator=(string&&), path::assign(string_type&&)): Define
construction and assignment from string_type rvalues (LWG 2707).
(path::_S_convert<_Iter>(_Iter, _Iter)): Remove cv-qualifiers from
iterator's value_type.
(path::_S_convert<_Iter>(_Iter __first, __null_terminated)): Likewise.
Do not use operation not supported by input iterators.
(path::__is_path_iter_src): Add partial specialization for const
encoded character types.
* src/filesystem/dir.cc (open_dir): Return same value for errors
whether ignored or not.
(_Dir::advance(error_code*, directory_options)): Return false on
error.
(directory_iterator(const path&, directory_options, error_code*)):
Create end iterator on error (LWG 2723).
(recursive_directory_iterator(const path&, directory_options,
error_code*)): Likewise.
(recursive_directory_iterator::increment): Reset state on error.
(recursive_directory_iterator::pop): Define new overload.
* src/filesystem/ops.cc (canonical): Set error for non-existent path.
(file_time): Take error_code parameter and check for overflow.
(close_fd): Remove.
(do_copy_file): Report an error if source or destination is not a
regular file (LWG 2712). Pass error_code in file_time calls.  Just
use close(3) instead of close_fd, to prevent retrying on error.
Check if _GLIBCXX_USE_FCHMODAT is defined.
[_GLIBCXX_USE_SENDFILE]: Fallback to read/write operations in case
sendfile fails with ENOSYS or EINVAL. Pass non-null pointer to
sendfile for offset argument.
(copy): Update comment to refer to LWG 2681. Implement 2682 and 2683
resolutions.
(equivalent): Fix error handling and result when only one file exists.
(is_empty): Fix error handling.
(last_write_time(const path&, error_code&)): Pass error_code in
file_time calls.
(last_write_time(const path&, file_time_type, error_code&)): Handle
negative times correctly.
(permissions(const path&, perms, error_code&)): Handle
symlink_nofollow.
(read_symlink): Add missing ec.clear().
(status(const path&, error_code&)): Handle EOVERFLOW.
(temp_directory_path): Pass error_code argument to other filesystem
operations.
* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
Update expected behaviour on error.
* testsuite/experimental/filesystem/iterators/pop.cc: New.
* testsuite/experimental/filesystem/iterators/
recursive_directory_iterator.cc: Update expected behaviour on error.
* testsuite/experimental/filesystem/operations/copy.cc: Update
expected behaviour for copying directories with create_symlinks.
Verify that error_code arguments are cleared if there's no error.
Remove files created by tests. Test copying directories.
* testsuite/experimental/filesystem/operations/copy_file.cc: Remove
files created by tests.
* testsuite/experimental/filesystem/operations/create_symlink.cc: New.
* testsuite/experimental/filesystem/operations/equivalent.cc: New.
* testsuite/experimental/filesystem/operations/exists.cc: Test
overload taking an error_code.
* testsuite/experimental/filesystem/operations/is_empty.cc: New.
* testsuite/experimental/filesystem/operations/last_write_time.cc:
New.
* testsuite/experimental/filesystem/operations/permissions.cc: Test
overload taking error_code. Test symlink_nofollow on non-symlinks.
* testsuite/experimental/filesystem/operations/read_symlink.cc: New.
* testsuite/experimental/filesystem/operations/remove_all.cc: New.
* testsuite/experimental/files

[Bug fortran/78737] [OOP] linking error with deferred, undefined user-defined derived-type I/O

2016-12-12 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78737

--- Comment #18 from janus at gcc dot gnu.org ---
(In reply to Paul Thomas from comment #15)
> See this further example, which works with the last version of the patch.

Here is another runtime example, which in contrast to comment #15 does not
utilize any SELECT TYPE workaround:


module object_interface
  type :: object
  contains
procedure :: write_formatted => write_formatted1
generic :: write(formatted) => write_formatted
  end type
  type, extends(object) :: child
integer :: i
  contains
procedure :: write_formatted => write_formatted2
  end type
contains
  subroutine write_formatted1(this,unit,iotype,vlist,iostat,iomsg)
class(object), intent(in) :: this
integer, intent(in) :: unit
character (len=*), intent(in) :: iotype
integer, intent(in) :: vlist(:)
integer, intent(out) :: iostat
character (len=*), intent(inout) :: iomsg
print '(a)', "write_formatted1"
  end subroutine
  subroutine write_formatted2(this,unit,iotype,vlist,iostat,iomsg)
class(child), intent(in) :: this
integer, intent(in) :: unit
character (len=*), intent(in) :: iotype
integer, intent(in) :: vlist(:)
integer, intent(out) :: iostat
character (len=*), intent(inout) :: iomsg
print '(a,i4/)', "write_formatted2 => ", this%i
  end subroutine
  subroutine assert(a)
class(object):: a
write(*,*) a
  end subroutine
end module

  use object_interface
  call assert (object ())
  call assert (child (99))
end


It currently prints (i.e. with Paul's latest patch and probably also with a
clean trunk):

 write_formatted1
 write_formatted1

I.e. both calls to assert result in the same DTIO procedure, although the type
of the argument differs (and the extended type overrides the DTIO procedure).
In my opinion the output should be:

 write_formatted1
 write_formatted2 =>   99

When looking at the dump of the generated code for the assert routine, one
currently sees:

assert (struct __class_object_interface_Object_t & restrict a)
{
  [...]
_gfortran_transfer_derived (&dt_parm.0, (struct
__class_object_interface_Object_t *) a, write_formatted1);
  [...]
}

That is, we always call the DTIO procedure of the base type (write_formatted1).
IMHO this is wrong and the second argument of  _gfortran_transfer_derived
should rather be "a->_vptr->write_formatted", in order to call the correct DTIO
procedure of the dynamic type.

[Bug tree-optimization/78777] [7 Regression] ICE in mark_reachable_handlers, at tree-eh.c:3823 (aarch64-linux-gnu)

2016-12-12 Thread doko at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78777

--- Comment #3 from Matthias Klose  ---
Created attachment 40312
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40312&action=edit
unreduced test case

[Bug libstdc++/78111] [7 regression] experimental/filesystem/operations/canonical.cc FAILs

2016-12-12 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78111

--- Comment #9 from Jonathan Wakely  ---
Author: redi
Date: Mon Dec 12 15:00:43 2016
New Revision: 243557

URL: https://gcc.gnu.org/viewcvs?rev=243557&root=gcc&view=rev
Log:
Backport all Filesystem library fixes from trunk

This implements the following LWG DRs:
2681 2682 2683 2706 2707 2712 2720 2723

Backport from mainline
PR libstdc++/70975
PR libstdc++/71337
PR libstdc++/78111
* include/experimental/bits/fs_dir.h (recursive_directory_iterator):
Overload pop (LWG 2706).
* include/experimental/bits/fs_fwd.h (perms::resolve_symlinks):
Replace with symlink_nofollow (LWG 2720).
* include/experimental/bits/fs_ops.h
(exists(const path&, error_code&)): Clear error if status is known
(LWG 2725).
* include/experimental/bits/fs_path.h (__is_path_src)
(_S_range_begin, _S_range_end): Overload to treat string_view as a
Source object.
(path::operator+=, path::compare): Overload for basic_string_view.
(path::path(string_type&&))
(path::operator=(string&&), path::assign(string_type&&)): Define
construction and assignment from string_type rvalues (LWG 2707).
(path::_S_convert<_Iter>(_Iter, _Iter)): Remove cv-qualifiers from
iterator's value_type.
(path::_S_convert<_Iter>(_Iter __first, __null_terminated)): Likewise.
Do not use operation not supported by input iterators.
(path::__is_path_iter_src): Add partial specialization for const
encoded character types.
* src/filesystem/dir.cc (open_dir): Return same value for errors
whether ignored or not.
(_Dir::advance(error_code*, directory_options)): Return false on
error.
(directory_iterator(const path&, directory_options, error_code*)):
Create end iterator on error (LWG 2723).
(recursive_directory_iterator(const path&, directory_options,
error_code*)): Likewise.
(recursive_directory_iterator::increment): Reset state on error.
(recursive_directory_iterator::pop): Define new overload.
* src/filesystem/ops.cc (canonical): Set error for non-existent path.
(file_time): Take error_code parameter and check for overflow.
(close_fd): Remove.
(do_copy_file): Report an error if source or destination is not a
regular file (LWG 2712). Pass error_code in file_time calls.  Just
use close(3) instead of close_fd, to prevent retrying on error.
Check if _GLIBCXX_USE_FCHMODAT is defined.
[_GLIBCXX_USE_SENDFILE]: Fallback to read/write operations in case
sendfile fails with ENOSYS or EINVAL. Pass non-null pointer to
sendfile for offset argument.
(copy): Update comment to refer to LWG 2681. Implement 2682 and 2683
resolutions.
(equivalent): Fix error handling and result when only one file exists.
(is_empty): Fix error handling.
(last_write_time(const path&, error_code&)): Pass error_code in
file_time calls.
(last_write_time(const path&, file_time_type, error_code&)): Handle
negative times correctly.
(permissions(const path&, perms, error_code&)): Handle
symlink_nofollow.
(read_symlink): Add missing ec.clear().
(status(const path&, error_code&)): Handle EOVERFLOW.
(temp_directory_path): Pass error_code argument to other filesystem
operations.
* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
Update expected behaviour on error.
* testsuite/experimental/filesystem/iterators/pop.cc: New.
* testsuite/experimental/filesystem/iterators/
recursive_directory_iterator.cc: Update expected behaviour on error.
* testsuite/experimental/filesystem/operations/copy.cc: Update
expected behaviour for copying directories with create_symlinks.
Verify that error_code arguments are cleared if there's no error.
Remove files created by tests. Test copying directories.
* testsuite/experimental/filesystem/operations/copy_file.cc: Remove
files created by tests.
* testsuite/experimental/filesystem/operations/create_symlink.cc: New.
* testsuite/experimental/filesystem/operations/equivalent.cc: New.
* testsuite/experimental/filesystem/operations/exists.cc: Test
overload taking an error_code.
* testsuite/experimental/filesystem/operations/is_empty.cc: New.
* testsuite/experimental/filesystem/operations/last_write_time.cc:
New.
* testsuite/experimental/filesystem/operations/permissions.cc: Test
overload taking error_code. Test symlink_nofollow on non-symlinks.
* testsuite/experimental/filesystem/operations/read_symlink.cc: New.
* testsuite/experimental/filesystem/operations/remove_all.cc: New.
* testsuite/experimental/files

[Bug libstdc++/71337] temp_directory_path(error_code&) shouldn't throw from !exists(p) || !is_directory(p)

2016-12-12 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71337

Jonathan Wakely  changed:

   What|Removed |Added

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

--- Comment #6 from Jonathan Wakely  ---
Fixed for 5.5, 6.3 and 7.1

[Bug libstdc++/78111] [7 regression] experimental/filesystem/operations/canonical.cc FAILs

2016-12-12 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78111

Jonathan Wakely  changed:

   What|Removed |Added

   Target Milestone|7.0 |5.5

--- Comment #10 from Jonathan Wakely  ---
Also fixed for 5.5 and 6.3

[Bug libstdc++/70975] experimental/filesystem/operations/copy.cc FAILs on Solaris 12

2016-12-12 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70975

--- Comment #10 from Jonathan Wakely  ---
Also fixed for 5.5 and 6.3

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

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

--- Comment #3 from Marek Polacek  ---
So either some games with TREE_VISITED, or keep some hash_set of visited
SSA_NAMEs, or when scanning the PHI arguments, check whether its argument's
definition is also a PHI and has OP in it?

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

2016-12-12 Thread matz at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78725

--- Comment #4 from Michael Matz  ---
Thanks for the second testcase as well.  It's not quite the same miscompilation
(the induction vars don't overflow), but a related one (the value of d
considered in the conditional statement is the final one after the d-loop
finishes, not the value at the use itself).  Fixed with v2 of the patch,
at https://gcc.gnu.org/ml/gcc-patches/2016-12/msg01035.html .

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

2016-12-12 Thread matz at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78725

--- Comment #5 from Michael Matz  ---
(In reply to Michael Matz from comment #4)
> Thanks for the second testcase as well.  It's not quite the same
> miscompilation
> (the induction vars don't overflow), but a related one (the value of d
> considered in the conditional statement is the final one after the d-loop
> finishes, not the value at the use itself).  Fixed with v2 of the patch,
> at https://gcc.gnu.org/ml/gcc-patches/2016-12/msg01035.html .

(Btw: nice testcases, I assume they are generated somehow by a code generator
that knows a bit about semantics?)

[Bug fortran/78737] [OOP] linking error with deferred, undefined user-defined derived-type I/O

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

--- Comment #19 from Damian Rouson  ---
(In reply to Paul Thomas from comment #16)
> (In reply to Paul Thomas from comment #15)
> > (In reply to Damian Rouson from comment #14)
> > > Hi Paul,
> > > 
> > > Based on comment #12, I assume you no longer believe that type guarding is
> > > required.  If I misinterpreted comment #12, please let me know.

FWIW, I now realize I did misread comment #12.  I focused in on "assert" and
didn't notice the type-guarding in write_formatted above it.


> > 
> > I have to confess that this "interpretation" is arrived at by the absence of
> > any mention of the need for dynamic dispatch and by the implementation by
> > other vendors.

The Cray and PGI compilers accept the in the original bug report.  The Intel
compiler rejects, but I've noticed a lot of problems with UDDTIO in the Intel
compiler over the years so I'll submit a bug report to Intel.

> 
> On thinking about it, is the specific instance of write_formatted allowed?

I believe not.  Note 7.50 of the 31 August 2016 draft Fortran 2015 standard
includes the following:

"The dynamic type of an object cannot be abstract; therefore, a deferred
type-bound procedure cannot be invoked."

I interpret the above quote to mean that write_formatted as written in comment
#15 cannot be invoked.  Presumably that also means it is invalid code. 

Damian

[Bug tree-optimization/78777] [7 Regression] ICE in mark_reachable_handlers, at tree-eh.c:3823 (aarch64-linux-gnu)

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

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek  ---
This is SLSR appending
slsr_44 = ivtmp.6_13 * 4;
after a possibly throwing call (which means it must be last in its bb).

[Bug c++/78774] [6/7 Regression] ICE in constexpr string literals and templates

2016-12-12 Thread rush at rushbase dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78774

--- Comment #4 from Damian Kaczmarek  ---
Thanks for a prompt reply. Are there any known workarounds?

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

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

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #4 from Martin Sebor  ---
I've made this mistake before and should have known better.  Let me fix it.

[Bug middle-end/78738] [7 Regression] ICE in extract_insn, at recog.c:2311

2016-12-12 Thread uros at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78738

--- Comment #5 from uros at gcc dot gnu.org ---
Author: uros
Date: Mon Dec 12 16:02:28 2016
New Revision: 243559

URL: https://gcc.gnu.org/viewcvs?rev=243559&root=gcc&view=rev
Log:
PR target/78738
* config/i386/i386.h (X87_ENABLE_ARITH): Also enable for
flag_unsafe_math_optimizations.
(X87_ENABLE_FLOAT): Ditto.

testsuite/ChangeLog:

PR target/78738
* gcc.target/i386/pr78738.c: New test.


Added:
trunk/gcc/testsuite/gcc.target/i386/pr78738.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.h
trunk/gcc/testsuite/ChangeLog

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

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

Uroš Bizjak  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
  Component|middle-end  |target
 Resolution|--- |FIXED

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

[Bug libstdc++/71337] temp_directory_path(error_code&) shouldn't throw from !exists(p) || !is_directory(p)

2016-12-12 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71337

--- Comment #5 from Jonathan Wakely  ---
Author: redi
Date: Mon Dec 12 15:00:43 2016
New Revision: 243557

URL: https://gcc.gnu.org/viewcvs?rev=243557&root=gcc&view=rev
Log:
Backport all Filesystem library fixes from trunk

This implements the following LWG DRs:
2681 2682 2683 2706 2707 2712 2720 2723

Backport from mainline
PR libstdc++/70975
PR libstdc++/71337
PR libstdc++/78111
* include/experimental/bits/fs_dir.h (recursive_directory_iterator):
Overload pop (LWG 2706).
* include/experimental/bits/fs_fwd.h (perms::resolve_symlinks):
Replace with symlink_nofollow (LWG 2720).
* include/experimental/bits/fs_ops.h
(exists(const path&, error_code&)): Clear error if status is known
(LWG 2725).
* include/experimental/bits/fs_path.h (__is_path_src)
(_S_range_begin, _S_range_end): Overload to treat string_view as a
Source object.
(path::operator+=, path::compare): Overload for basic_string_view.
(path::path(string_type&&))
(path::operator=(string&&), path::assign(string_type&&)): Define
construction and assignment from string_type rvalues (LWG 2707).
(path::_S_convert<_Iter>(_Iter, _Iter)): Remove cv-qualifiers from
iterator's value_type.
(path::_S_convert<_Iter>(_Iter __first, __null_terminated)): Likewise.
Do not use operation not supported by input iterators.
(path::__is_path_iter_src): Add partial specialization for const
encoded character types.
* src/filesystem/dir.cc (open_dir): Return same value for errors
whether ignored or not.
(_Dir::advance(error_code*, directory_options)): Return false on
error.
(directory_iterator(const path&, directory_options, error_code*)):
Create end iterator on error (LWG 2723).
(recursive_directory_iterator(const path&, directory_options,
error_code*)): Likewise.
(recursive_directory_iterator::increment): Reset state on error.
(recursive_directory_iterator::pop): Define new overload.
* src/filesystem/ops.cc (canonical): Set error for non-existent path.
(file_time): Take error_code parameter and check for overflow.
(close_fd): Remove.
(do_copy_file): Report an error if source or destination is not a
regular file (LWG 2712). Pass error_code in file_time calls.  Just
use close(3) instead of close_fd, to prevent retrying on error.
Check if _GLIBCXX_USE_FCHMODAT is defined.
[_GLIBCXX_USE_SENDFILE]: Fallback to read/write operations in case
sendfile fails with ENOSYS or EINVAL. Pass non-null pointer to
sendfile for offset argument.
(copy): Update comment to refer to LWG 2681. Implement 2682 and 2683
resolutions.
(equivalent): Fix error handling and result when only one file exists.
(is_empty): Fix error handling.
(last_write_time(const path&, error_code&)): Pass error_code in
file_time calls.
(last_write_time(const path&, file_time_type, error_code&)): Handle
negative times correctly.
(permissions(const path&, perms, error_code&)): Handle
symlink_nofollow.
(read_symlink): Add missing ec.clear().
(status(const path&, error_code&)): Handle EOVERFLOW.
(temp_directory_path): Pass error_code argument to other filesystem
operations.
* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
Update expected behaviour on error.
* testsuite/experimental/filesystem/iterators/pop.cc: New.
* testsuite/experimental/filesystem/iterators/
recursive_directory_iterator.cc: Update expected behaviour on error.
* testsuite/experimental/filesystem/operations/copy.cc: Update
expected behaviour for copying directories with create_symlinks.
Verify that error_code arguments are cleared if there's no error.
Remove files created by tests. Test copying directories.
* testsuite/experimental/filesystem/operations/copy_file.cc: Remove
files created by tests.
* testsuite/experimental/filesystem/operations/create_symlink.cc: New.
* testsuite/experimental/filesystem/operations/equivalent.cc: New.
* testsuite/experimental/filesystem/operations/exists.cc: Test
overload taking an error_code.
* testsuite/experimental/filesystem/operations/is_empty.cc: New.
* testsuite/experimental/filesystem/operations/last_write_time.cc:
New.
* testsuite/experimental/filesystem/operations/permissions.cc: Test
overload taking error_code. Test symlink_nofollow on non-symlinks.
* testsuite/experimental/filesystem/operations/read_symlink.cc: New.
* testsuite/experimental/filesystem/operations/remove_all.cc: New.
* testsuite/experimental/files

[Bug fortran/78737] [OOP] linking error with deferred, undefined user-defined derived-type I/O

2016-12-12 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78737

--- Comment #20 from janus at gcc dot gnu.org ---
(In reply to Damian Rouson from comment #19)
> > On thinking about it, is the specific instance of write_formatted allowed?
> 
> I believe not.  Note 7.50 of the 31 August 2016 draft Fortran 2015 standard
> includes the following:
> 
> "The dynamic type of an object cannot be abstract; therefore, a deferred
> type-bound procedure cannot be invoked."
> 
> I interpret the above quote to mean that write_formatted as written in
> comment #15 cannot be invoked.  Presumably that also means it is invalid
> code. 

I'm not so sure here. Actually I tend to believe that comment 15 as such is
valid. It just has two different things that (incidentally) share the same name
(which is not forbidden in this context):
1) The deferred TBP 'write_formatted' of the type 'object'. As it is deferred,
it has no implementation in that type and can only be invoked polymorphically.
2) The subroutine 'write_formatted' in the module 'object_interface'. I don't
see anything that would prevent you from defining a subroutine in this way, but
it simply cannot be interpreted as the implementation of the deferred TBP.

But then gfortran's runtime-interpretation of this code is wrong. It prints
(with Paul's patch)

 write_formatted =>   99
 write_formatted2 =>   99

since it calls 'write_formatted' as a DTIO procedure of the type 'object',
which it is not! I think the correct output would only consist of the second
line:

 write_formatted2 =>   99

[Bug libstdc++/78465] [7 regression] 29_atomics/headers/atomic/macros.cc FAILs

2016-12-12 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78465

--- Comment #4 from Jonathan Wakely  ---
Author: redi
Date: Mon Dec 12 16:20:49 2016
New Revision: 243561

URL: https://gcc.gnu.org/viewcvs?rev=243561&root=gcc&view=rev
Log:
PR78465 Remove runtime tests for  macros

PR libstdc++/78465
* testsuite/29_atomics/headers/atomic/macros.cc: Replace runtime tests
with preprocessor conditions.

Modified:
branches/gcc-6-branch/libstdc++-v3/ChangeLog
   
branches/gcc-6-branch/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc

[Bug tree-optimization/78777] [7 Regression] ICE in mark_reachable_handlers, at tree-eh.c:3823 (aarch64-linux-gnu)

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

Jakub Jelinek  changed:

   What|Removed |Added

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

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

Untested fix.

[Bug c++/78774] [6/7 Regression] ICE in constexpr string literals and templates

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

Martin Sebor  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org
  Known to fail||6.2.1, 7.0

--- Comment #5 from Martin Sebor  ---
The ICE can be avoided by using a struct instead of a template alias:

template  struct ops {
  template  struct A;
  template  struct explode {
typedef typename A<*Ptr>::join type;
  };
};
template  typename ops<'\0'>::explode::type a;

[Bug debug/77844] [5/7 Regression] Compilation of simple C++ example exhaust memory

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

Jakub Jelinek  changed:

   What|Removed |Added

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

--- Comment #9 from Jakub Jelinek  ---
Created attachment 40314
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40314&action=edit
gcc7-pr77844.patch

Untested fix.

[Bug libstdc++/78465] [7 regression] 29_atomics/headers/atomic/macros.cc FAILs

2016-12-12 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78465

--- Comment #5 from Jonathan Wakely  ---
Author: redi
Date: Mon Dec 12 16:36:25 2016
New Revision: 243564

URL: https://gcc.gnu.org/viewcvs?rev=243564&root=gcc&view=rev
Log:
PR78465 Remove runtime tests for  macros

PR libstdc++/78465
* testsuite/29_atomics/headers/atomic/macros.cc: Replace runtime tests
with preprocessor conditions.

Modified:
branches/gcc-5-branch/libstdc++-v3/ChangeLog
   
branches/gcc-5-branch/libstdc++-v3/testsuite/29_atomics/headers/atomic/macros.cc

[Bug c++/78778] New: non-atomic load moved to before atomic load with std::memory_order_acquire

2016-12-12 Thread erik at rigtorp dot se
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78778

Bug ID: 78778
   Summary: non-atomic load moved to before atomic load with
std::memory_order_acquire
   Product: gcc
   Version: 5.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: erik at rigtorp dot se
  Target Milestone: ---

Compiling this with GCC 5.1 and up with -O2 or higher for x86_64:

#include 
#include 

int seqlock_load(std::atomic &seq, double &value) {
  double copy;
  std::size_t seq0, seq1;
  do {
seq0 = seq.load(std::memory_order_acquire);
copy = value;
seq1 = seq.load(std::memory_order_acquire);
  } while (seq0 != seq1 || seq0 & 1);
  return copy;
}

Yields the following assembly:

seqlock_load(std::atomic&, double&):
movsd   xmm0, QWORD PTR [rsi] // copy = value;
.L3:
mov rdx, QWORD PTR [rdi] // seq0 = seq.load(...)
mov rax, QWORD PTR [rdi] // seq1 = seq.load(...)
cmp rax, rdx
jne .L3
testal, 1
jne .L3
cvttsd2si   eax, xmm0
ret


In GCC Explorer: https://godbolt.org/g/0X8nUC

As I understand this operation:

copy = value;

Is guaranteed to happen after:

seq0 = seq.load(std::memory_order_acquire);

But it's moved to before the loop. A valid optimization would be to move it
after the loop, but not before. This came up when I was implementing seqlocks:
https://github.com/rigtorp/Seqlock

[Bug tree-optimization/77309] [5/6 Regression] wrong code at -Os and above on x86_64-linux-gnu (in the 64-bit mode)

2016-12-12 Thread bernds at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77309

Bernd Schmidt  changed:

   What|Removed |Added

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

--- Comment #7 from Bernd Schmidt  ---
Fixed.

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

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

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org
Summary|[5/6/7 Regression] ICE: in  |[5/6 Regression] ICE: in
   |emit_move_insn, at  |emit_move_insn, at
   |expr.c:3693 with vector |expr.c:3693 with vector
   |shift @ powerpc64le |shift @ powerpc64le

--- Comment #6 from Jakub Jelinek  ---
Assuming this is fixed on the trunk now.

  1   2   >