[Bug tree-optimization/71775] New: Redundant move instruction for sign extension

2016-07-05 Thread wmhkebe at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71775

Bug ID: 71775
   Summary: Redundant move instruction for sign extension
   Product: gcc
   Version: 6.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: wmhkebe at gmail dot com
  Target Milestone: ---

Created attachment 38838
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38838=edit
preprocessed file for the test program

Compiling the following program with g++ -O3 -S:

#include 

unsigned long long f(std::uint64_t x) {
  std::uint64_t ans = 0;
  for (; x != 0; x &= (x - 1)) {
ans ^= __builtin_ctzll(x);
  }
  return ans;
}

yields the following assembly code:

.text
.align 4,0x90
.globl __Z1fy
__Z1fy:
LFB0:
xorl%eax, %eax
testq   %rdi, %rdi
je  L4
.align 4,0x90
L3:
bsfq%rdi, %rdx
movslq  %edx, %rdx
xorq%rdx, %rax
leaq-1(%rdi), %rdx
andq%rdx, %rdi
jne L3
ret
L4:
ret

Note that the movslq instruction inside the loop is redundant. Clang is able to
generate code without this move. Benchmark shows, this represents a 5%-10%
difference in the running time of this function.


Version info:
Using built-in specs.
COLLECT_GCC=gcc-6
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc6/6.1.0/libexec/gcc/x86_64-apple-darwin15.5.0/6.1.0/lto-wrapper
Target: x86_64-apple-darwin15.5.0
Configured with: ../configure --build=x86_64-apple-darwin15.5.0
--prefix=/usr/local/Cellar/gcc6/6.1.0
--libdir=/usr/local/Cellar/gcc6/6.1.0/lib/gcc/6
--enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-6
--with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr
--with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl014
--with-system-zlib --enable-libstdcxx-time=yes --enable-stage1-checking
--enable-checking=release --enable-lto --with-build-config=bootstrap-debug
--disable-werror --with-pkgversion='Homebrew gcc6 6.1.0'
--with-bugurl=https://github.com/Homebrew/homebrew-versions/issues
--enable-plugin --disable-nls --enable-multilib
--with-native-system-header-dir=/usr/include
--with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
Thread model: posix
gcc version 6.1.0 (Homebrew gcc6 6.1.0)

[Bug c++/71774] New: Bogus "is protected" error when list-initializing a base class with a defaulted protected constructor and a virtual function

2016-07-05 Thread rs2740 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71774

Bug ID: 71774
   Summary: Bogus "is protected" error when list-initializing a
base class with a defaulted protected constructor and
a virtual function
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: rs2740 at gmail dot com
  Target Milestone: ---

Reduced from http://stackoverflow.com/q/38213809/2756719. Repro:

class Meow
{
  protected:
Meow() =default;
virtual void f() {}
};

class Purr : public Meow
{
  public:
Purr()
  : Meow{}
{}  
};

prog.cc: In constructor 'Purr::Purr()':
prog.cc:12:14: error: 'constexpr Meow::Meow()' is protected within this context
   : Meow{}
  ^
prog.cc:4:5: note: declared protected here
 Meow() =default;
 ^~~~

Possibly related to PR63151, however this example reproduces in GCC 4.7.3 and
4.8.5 (on Wandbox), while that PR is known to work in 4.8.2.

[Bug c++/71773] New: [7 Regression] bogus? error: invalid use of incomplete type

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

Bug ID: 71773
   Summary: [7 Regression] bogus? error: invalid use of incomplete
type
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: trippels at gcc dot gnu.org
  Target Milestone: ---

markus@x4 /tmp % cat scopes.ii
namespace std {
template  struct conditional;
template  struct A;
template 
struct A<_B1, _B2> : conditional<_B1::value> {};
template  struct B;
template  struct F : B<_Tp> {};
template  struct C;
template  typename C, _Tp>::value>::type swap(_Tp, _Tp);
template  struct D {
  int _M_fill_init;
  void m_fn1(D p1) { std::swap(0, p1._M_fill_init); }
};
}

markus@x4 /tmp % icpc -Wall -Wextra -std=c++14 -c scopes.ii
markus@x4 /tmp % clang++ -Wall -Wextra -std=c++14 -c scopes.ii
markus@x4 /tmp % g++ -Wall -Wextra -c scopes.ii # gcc-6
markus@x4 /tmp % /var/tmp/gcc_test/usr/local/bin/g++ -c scopes.ii # trunk
scopes.ii: In instantiation of ‘struct std::F’:
scopes.ii:5:8:   required from ‘struct std::A’
scopes.ii:9:65:   required by substitution of ‘template typename
std::C, _Tp>::value>::type std::swap(_Tp, _Tp) [with _Tp =
int]’
scopes.ii:12:50:   required from here
scopes.ii:7:32: error: invalid use of incomplete type ‘struct std::B’
 template  struct F : B<_Tp> {};
^
scopes.ii:6:28: note: declaration of ‘struct std::B’
 template  struct B;
^
scopes.ii: In instantiation of ‘struct std::A’:
scopes.ii:9:65:   required by substitution of ‘template typename
std::C, _Tp>::value>::type std::swap(_Tp, _Tp) [with _Tp =
int]’
scopes.ii:12:50:   required from here
scopes.ii:5:8: error: ‘value’ is not a member of ‘std::F’
 struct A<_B1, _B2> : conditional<_B1::value> {};
^~~
scopes.ii: In member function ‘void std::D< 
>::m_fn1(std::D<  >)’:
scopes.ii:12:50: error: no matching function for call to ‘swap(int, int&)’
   void m_fn1(D p1) { std::swap(0, p1._M_fill_init); }
  ^
scopes.ii:9:65: note: candidate: template typename
std::C, _Tp>::value>::type std::swap(_Tp, _Tp)
 template  typename C, _Tp>::value>::type swap(_Tp,
_Tp);
 ^~~~
scopes.ii:9:65: note:   substitution of deduced template arguments resulted in
errors seen above

[Bug middle-end/71762] [4.9/5/6/7 Regression] ifcombine exposes wrong codegen with uninitialized bools

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

Andrew Pinski  changed:

   What|Removed |Added

Summary|[4.9/5/6/7 Regression]  |[4.9/5/6/7 Regression]
   |ifcombine wrong codegen |ifcombine exposes wrong
   |with uninitialized data |codegen with uninitialized
   ||bools

--- Comment #3 from Andrew Pinski  ---
So in this case, ifcombine can combine:
  if (!__cond60)
{
  if (__cond59)
{

Into:

(!__cond60) & __cond59

Yes the rhs will be unitialized but if __cond60 is true but that should not
cause wrong code.  There is something else going wrong here than my patch.

[Bug rtl-optimization/71768] Missed trivial rematerialiation oppurtunity

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

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization, ra
 CC||pinskia at gcc dot gnu.org

--- Comment #3 from Andrew Pinski  ---
I see this on aarch64-linux-gnu also.
t:
stp x29, x30, [sp, -32]!
add x29, sp, 0
moviv0.4s, 0xa
#APP
// 6 "t.c" 1
#v0
// 0 "" 2
#NO_APP
str q0, [x29, 16]
bl  e
ldr q0, [x29, 16]
#APP
// 8 "t.c" 1
#v0
// 0 "" 2
#NO_APP
ldp x29, x30, [sp], 32
ret


So it is even worse for AARCH64 since it is not even a load, it is a move.

[Bug fortran/71770] gfortran: internal compiler error: Segmentation fault (program f951)

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

--- Comment #4 from kargl at gcc dot gnu.org ---
(In reply to Isabelle from comment #3)
> All of this was working before I upgraded Cygwin, and tried to compile again
> ecgpuwave.

Did you read the initial error message and follow 
the direction?  This parts seems very important
(and you're possibly wasting gfortran maintainer's
time).

*** fatal error - cygheap base mismatch detected - 0x6131F408/0x6131F400.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version.  The most recent version *should*
reside in x:\cygwin\bin, where 'x' is the drive on which you have
installed the cygwin distribution.  Rebooting is also suggested if you
are unable to find another cygwin DLL.

[Bug fortran/71770] gfortran: internal compiler error: Segmentation fault (program f951)

2016-07-05 Thread ibichind at oswego dot edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71770

--- Comment #3 from Isabelle  ---
All of this was working before I upgraded Cygwin, and tried to compile again
ecgpuwave.

[Bug fortran/71770] gfortran: internal compiler error: Segmentation fault (program f951)

2016-07-05 Thread ibichind at oswego dot edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71770

--- Comment #2 from Isabelle  ---
It is installed with wfdb package from Physionet:

https://www.physionet.org/physiotools/wfdb-windows-quick-start.shtml#c32s

The whole package can hte downloaded from:

http://physionet.org/physiotools/wfdb.tar.gz

The wfdb.h contains the following information:

#ifndef wfdb_WFDB_H /* avoid multiple definitions */
#define wfdb_WFDB_H

/* WFDB library version. */
#define WFDB_MAJOR   10
#define WFDB_MINOR   5
#define WFDB_RELEASE 24
#define WFDB_NETFILES 1 /* if 1, library includes code for HTTP, FTP clients */
#define WFDB_NETFILES_LIBCURL 1

/* Determine what type of compiler is being used. */
#ifdef __STDC__ /* true for ANSI C compilers only */
#define wfdb_PROTO  /* function prototypes will be needed */
#undef _WINDOWS /* we don't want MS-Windows API in this case */
#endif

#ifdef __cplusplus  /* true for some C++ compilers */
#define wfdb_CPP
#define wfdb_PROTO
#endif

#ifdef c_plusplus   /* true for some other C++ compilers */
#define wfdb_CPP
#define wfdb_PROTO
#endif

#ifdef _WIN32   /* true when compiling for 32-bit MS Windows */
#ifndef _WINDOWS
#define _WINDOWS
#endif
#endif

#ifdef _WINDOWS /* true when compiling for MS Windows */
#define wfdb_PROTO
#endif

#ifndef wfdb_PROTO  /* should be true for K C compilers only */
#define wfdb_KRC
#define signed
#endif

/* Simple data types */
typedef int  WFDB_Sample;   /* units are adus */
typedef long WFDB_Time; /* units are sample intervals */
typedef long WFDB_Date; /* units are days */
typedef double   WFDB_Frequency;/* units are Hz (samples/second/signal) */
typedef double   WFDB_Gain; /* units are adus per physical unit */
typedef unsigned int WFDB_Group;/* signal group number */
typedef unsigned int WFDB_Signal;   /* signal number */
typedef unsigned int WFDB_Annotator;/* annotator number */

/* getvec and getframe return a sample with a value of WFDB_INVALID_SAMPLE
   when the amplitude of a signal is undefined (e.g., the input is clipped or
   the signal is not available) and padding is disabled (see WFDB_GVPAD,
below).
   WFDB_INVALID_SAMPLE is the minimum value for a 16-bit WFDB_Sample.  In
   a format 24 or 32 signal, this value will be near mid-range, but it should
   occur only rarely in such cases;  if this is a concern, WFDB_INVALID_SAMPLE
   can be redefined and the WFDB library can be recompiled. */
#define WFDB_INVALID_SAMPLE (-32768)

/* Array sizes
   Many older applications use the values of WFDB_MAXANN, WFDB_MAXSIG, and
   WFDB_MAXSPF to determine array sizes, but (since WFDB library version 10.2)
   there are no longer any fixed limits imposed by the WFDB library.
*/
#define WFDB_MAXANN2   /* maximum number of input or output annotators */
#define WFDB_MAXSIG   32   /* maximum number of input or output signals */
#define WFDB_MAXSPF4   /* maximum number of samples per signal per frame */
#define WFDB_MAXRNL   50   /* maximum length of record name */
#define WFDB_MAXUSL   50   /* maximum length of WFDB_siginfo `.units' string */
#define WFDB_MAXDSL  100   /* maximum length of WFDB_siginfo `.desc' string */

/* wfdb_fopen mode values (WFDB_anninfo '.stat' values) */
#define WFDB_READ  0   /* standard input annotation file */
#define WFDB_WRITE 1   /* standard output annotation file */
#define WFDB_AHA_READ  2   /* AHA-format input annotation file */
#define WFDB_AHA_WRITE 3   /* AHA-format output annotation file */
#define WFDB_APPEND4   /* for output info files */

/* WFDB_siginfo '.fmt' values
FMT_LIST is suitable as an initializer for a static array; it lists all of
the legal values for the format field in a WFDB_siginfo structure.
 fmtmeaning
   0null signal (nothing read or written)
   88-bit first differences
  1616-bit 2's complement amplitudes, low byte first
  6116-bit 2's complement amplitudes, high byte first
  808-bit offset binary amplitudes
 16016-bit offset binary amplitudes
 2122 12-bit amplitudes bit-packed in 3 bytes
 3103 10-bit amplitudes bit-packed in 4 bytes
 3113 10-bit amplitudes bit-packed in 4 bytes
  2424-bit 2's complement amplitudes, low byte first
  3232-bit 2's complement amplitudes, low byte first
*/
#define WFDB_FMT_LIST {0, 8, 16, 61, 80, 160, 212, 310, 311, 24, 32}
#define WFDB_NFMTS11/* number of items in WFDB_FMT_LIST */

/* Default signal specifications */
#define WFDB_DEFFREQ250.0  /* default sampling frequency (Hz) */
#define WFDB_DEFGAIN200.0  /* default value for gain (adu/physical unit) */
#define WFDB_DEFRES 12 /* default value for ADC resolution (bits) */

/* getvec operating modes */
#define WFDB_LOWRES 0   /* return one sample per signal per frame */
#define WFDB_HIGHRES1   /* return each sample of oversampled signals,
   duplicating samples of other signals */

[Bug tree-optimization/71144] [6/7 Regression] isl_aff.c:1001: position out of bounds

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

Arseny Solokha  changed:

   What|Removed |Added

 CC||asolokha at gmx dot com

--- Comment #2 from Arseny Solokha  ---
I cannot reproduce this ICE w/ testcase from #c0, compiling it w/ current gcc 7
snapshot for both x86_64 and 32-bit powerpc. Note that I have ISL 0.17.1
installed. However, I see a similar ICE on both archs w/ the following
testcase:

int j6, u6, ip;
int vi[2], sx[3];

void
i0 (void)
{
  for (ip = 0; ip < 2; ++ip)
{
  static int xj[2] = { 0 };

  for (j6 = 0; j6 < 2; ++j6)
u6 = xj[j6];
  if (xj[ip] != 0)
u6 = sx[ip + 1];
  for (j6 = 0; j6 < 2; ++j6)
vi[j6] = 0;
}
}

% x86_64-pc-linux-gnu-gcc-7.0.0-alpha20160703 -c -O2 -floop-nest-optimize
uagtztry.c
isl-0.17.1/work/isl-0.17.1/isl_aff.c:1019: position out of bounds
uagtztry.c: In function 'i0':
uagtztry.c:5:1: internal compiler error: Aborted
 i0 (void)
 ^~

[Bug fortran/71770] gfortran: internal compiler error: Segmentation fault (program f951)

2016-07-05 Thread jvdelisle at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71770

Jerry DeLisle  changed:

   What|Removed |Added

 CC||jvdelisle at gcc dot gnu.org

--- Comment #1 from Jerry DeLisle  ---
wfdbf.c:59:23: fatal error: wfdb/wfdb.h: No such file or directory
compilation terminated.

What is this wfdb.h?

[Bug c++/71772] temmplates broken.

2016-07-05 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71772

Marc Glisse  changed:

   What|Removed |Added

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

--- Comment #2 from Marc Glisse  ---
That's not how C++ templates are used, and the error message is in the right
location.

[Bug fortran/71764] compiler internal error: segmentation fault

2016-07-05 Thread jvdelisle at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71764

Jerry DeLisle  changed:

   What|Removed |Added

 CC||jvdelisle at gcc dot gnu.org

--- Comment #6 from Jerry DeLisle  ---
Commenting out the assert at trans-expr.c:7361 seems to fix this.  I do not
know if the result is correct code.

[Bug c++/71772] temmplates broken.

2016-07-05 Thread jmichae3 at yahoo dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71772

--- Comment #1 from Jim Michaels  ---
Created attachment 38837
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38837=edit
.s file

[Bug c++/71772] New: temmplates broken.

2016-07-05 Thread jmichae3 at yahoo dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71772

Bug ID: 71772
   Summary: temmplates broken.
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jmichae3 at yahoo dot com
  Target Milestone: ---

Created attachment 38836
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38836=edit
.ii file

templateI func(I n) {
return n+2;
}

template
I func2(I n) {
return n-2;
}

int main(void) {
int i=func(12);
int b=func(14);
return i;
}



Tue 07/05/2016 18:24:48.75|C:\Users\Kristina\Desktop\prj\test|>g++ -v
-save-temps -static -o gcc-template-bug.exe gcc-template-bug.cpp
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/gcc-7-win32/bin/../libexec/gcc/i686-w64-mingw32/7.0.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: /home/cauchy/vcs/svn/gcc/trunk/configure
--prefix=/home/cauchy/native/gcc-7-win32
--with-sysroot=/home/cauchy/native/gcc-7-win32 --build=x
86_64-unknown-linux-gnu --host=i686-w64-mingw32 --target=i686-w64-mingw32
--disable-multilib --disable-nls --disable-win32-registry --disable-gcov-tool
--e
nable-checking=release --enable-languages=c,c++,fortran
--enable-fully-dynamic-string --with-arch=core2 --with-tune=generic
Thread model: win32
gcc version 7.0.0 20160609 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-static' '-o' 'gcc-template-bug.exe'
'-mtune=generic' '-march=core2'
 c:/gcc-7-win32/bin/../libexec/gcc/i686-w64-mingw32/7.0.0/cc1plus.exe -E -quiet
-v -iprefix c:\gcc-7-win32\bin\../lib/gcc/i686-w64-mingw32/7.0.0/ -isysroot
 c:\gcc-7-win32\bin\../../gcc-7-win32 -U_REENTRANT gcc-template-bug.cpp
-mtune=generic -march=core2 -fpch-preprocess -o gcc-template-bug.ii
ignoring duplicate directory
"c:/gcc-7-win32/lib/gcc/../../lib/gcc/i686-w64-mingw32/7.0.0/../../../../include/c++/7.0.0"
ignoring duplicate directory
"c:/gcc-7-win32/lib/gcc/../../lib/gcc/i686-w64-mingw32/7.0.0/../../../../include/c++/7.0.0/i686-w64-mingw32"
ignoring duplicate directory
"c:/gcc-7-win32/lib/gcc/../../lib/gcc/i686-w64-mingw32/7.0.0/../../../../include/c++/7.0.0/backward"
ignoring duplicate directory
"c:/gcc-7-win32/lib/gcc/../../lib/gcc/i686-w64-mingw32/7.0.0/include"
ignoring nonexistent directory
"c:\gcc-7-win32\bin\../../gcc-7-win32/home/cauchy/native/gcc-7-win32/lib/gcc/i686-w64-mingw32/7.0.0/../../../../include"
ignoring duplicate directory
"c:/gcc-7-win32/lib/gcc/../../lib/gcc/i686-w64-mingw32/7.0.0/include-fixed"
ignoring duplicate directory
"c:/gcc-7-win32/lib/gcc/../../lib/gcc/i686-w64-mingw32/7.0.0/../../../../i686-w64-mingw32/include"
ignoring nonexistent directory
"c:\gcc-7-win32\bin\../../gcc-7-win32/mingw/include"
#include "..." search starts here:
#include <...> search starts here:

c:\gcc-7-win32\bin\../lib/gcc/i686-w64-mingw32/7.0.0/../../../../include/c++/7.0.0

c:\gcc-7-win32\bin\../lib/gcc/i686-w64-mingw32/7.0.0/../../../../include/c++/7.0.0/i686-w64-mingw32

c:\gcc-7-win32\bin\../lib/gcc/i686-w64-mingw32/7.0.0/../../../../include/c++/7.0.0/backward
 c:\gcc-7-win32\bin\../lib/gcc/i686-w64-mingw32/7.0.0/include
 c:\gcc-7-win32\bin\../lib/gcc/i686-w64-mingw32/7.0.0/include-fixed

c:\gcc-7-win32\bin\../lib/gcc/i686-w64-mingw32/7.0.0/../../../../i686-w64-mingw32/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-static' '-o' 'gcc-template-bug.exe'
'-mtune=generic' '-march=core2'
 c:/gcc-7-win32/bin/../libexec/gcc/i686-w64-mingw32/7.0.0/cc1plus.exe
-fpreprocessed gcc-template-bug.ii -quiet -dumpbase gcc-template-bug.cpp
-mtune=gener
ic -march=core2 -auxbase gcc-template-bug -version -o gcc-template-bug.s
GNU C++14 (GCC) version 7.0.0 20160609 (experimental) (i686-w64-mingw32)
compiled by GNU C version 7.0.0 20160609 (experimental), GMP version
6.1.0, MPFR version 3.1.4-p2, MPC version 1.0.3, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++14 (GCC) version 7.0.0 20160609 (experimental) (i686-w64-mingw32)
compiled by GNU C version 7.0.0 20160609 (experimental), GMP version
6.1.0, MPFR version 3.1.4-p2, MPC version 1.0.3, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 85f4626b884448f9672ebbd3379aa3ed
gcc-template-bug.cpp: In function 'int main()':
gcc-template-bug.cpp:11:8: error: expected primary-expression before '<' token
  int i=func(12);
^
gcc-template-bug.cpp:11:9: error: expected primary-expression before 'int'
  int i=func(12);
 ^~~
gcc-template-bug.cpp:12:8: error: expected primary-expression before '<' token
  int b=func(14);
^
gcc-template-bug.cpp:12:9: error: expected primary-expression before 'int'
  int b=func(14);
 ^~~

Tue 07/05/2016 18:24:55.24|C:\Users\Kristina\Desktop\prj\test|>

[Bug c++/71771] New: DR 685 applied incorrectly

2016-07-05 Thread Casey at Carter dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71771

Bug ID: 71771
   Summary: DR 685 applied incorrectly
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: Casey at Carter dot net
  Target Milestone: ---

The resolution of LWG DR 685
(http://cplusplus.github.io/LWG/lwg-defects.html#685) *replaces* the non-member
operator- of reverse_iterator and move_iterator with a cross-type overload
constrained via expression SFINAE on the return type.

libstdc++ trunk adds the cross-type overload for reverse_iterator, but *leaves
the old single-type overload in place*, so operator- does not properly SFINAE
for two reverse_iterators with the same (non-differentiable) base type.

move_iterator also has the new cross-type overload, its old single-type
overload has been left in place but constrained similarly. While technically
conforming, the result is that for a move_iterator i, "i - {}" and "{} - i"
will match this old single-type overload instead of being ill-formed.

[Bug fortran/71770] New: gfortran: internal compiler error: Segmentation fault (program f951)

2016-07-05 Thread ibichind at oswego dot edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71770

Bug ID: 71770
   Summary: gfortran: internal compiler error: Segmentation fault
(program f951)
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ibichind at oswego dot edu
  Target Milestone: ---

Created attachment 38835
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38835=edit
ecgpuwave program to compile

the exact version: GNU Fortran (GCC) 5.4.0
the system type: Cygwin latest version on Windows 7 32 bits
the options given when GCC was configured/built: I used the setup-x86.exe
the complete command line that triggers the bug; make install
the compiler output (error messages, warnings, etc.); 

bichinda@CSC-023013 ~/ecgpuwave-1.3.3
$ make install
gfortran -std=legacy -ffixed-line-length-none -fno-automatic -g -O -Wextra -c
-o ecgpuwave.o ecgpuwave.f
  6 [main] f951 (3936) C:\cygwin\lib\gcc\i686-pc-cygwin\5.4.0\f951.exe: ***
fatal error - cygheap base mismatch detected - 0x6131F408/0x6131F400.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version.  The most recent version *should*
reside in x:\cygwin\bin, where 'x' is the drive on which you have
installed the cygwin distribution.  Rebooting is also suggested if you
are unable to find another cygwin DLL.
gfortran: internal compiler error: Segmentation fault (program f951)
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
make: *** [Makefile:88: ecgpuwave.o] Error 4

the preprocessed file: I attach the complete ecgpuwave-1,3,3 archive; just
unzip and in run 'make install' in the ecgpuwave-1.3.3 filder

[Bug fortran/71764] compiler internal error: segmentation fault

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

--- Comment #5 from Gerhard Steinmetz  
---
Some other variants :


$ cat zz1.f90
program p
   use iso_c_binding, only: c_ptr, c_null_ptr, c_ptr
   type(c_ptr) :: c
   c = c_null_ptr
end


$ cat zz3.f90
program p
   use iso_c_binding, only: c_ptr
   use iso_c_binding, only: c_null_ptr
   use iso_c_binding, only: c_ptr
   type(c_ptr) :: c
   c = c_null_ptr
end


$ cat zz4.f90   # OK
program p
   use iso_c_binding, only: c_null_ptr
   use iso_c_binding, only: c_ptr
   type(c_ptr) :: c
   c = c_null_ptr
end


$ gfortran-7 zz1.f90
zz1.f90:4:0:

c = c_null_ptr

internal compiler error: Segmentation fault
0xc0dd2f crash_signal
../../gcc/toplev.c:335
0x75e442 gfc_trans_structure_assign(tree_node*, gfc_expr*, bool)
../../gcc/fortran/trans-expr.c:7361
#...

[Bug fortran/71764] compiler internal error: segmentation fault

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

Gerhard Steinmetz  changed:

   What|Removed |Added

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

--- Comment #4 from Gerhard Steinmetz  
---
Multiple usage of iso_c_binding rings a bell - if one item is repeatedly
included via use only in a module chain or in one program unit alone.


$ cat z1.f90
module m
   use iso_c_binding, only: c_funptr
   use iso_c_binding, only: c_null_funptr, c_funptr
contains
   subroutine s
  type(c_funptr) :: to_cb
  to_cb = c_null_funptr
   end subroutine
end module


$ cat z2.f90
program p
   use iso_c_binding, only: c_funptr
   use iso_c_binding, only: c_null_funptr, c_funptr
contains
   subroutine s
  type(c_funptr) :: to_cb
  to_cb = c_null_funptr
   end subroutine
end program


$ cat z3.f90
program p
   use iso_c_binding, only: c_funptr
   use iso_c_binding, only: c_null_funptr, c_funptr
   type(c_funptr) :: to_cb
   to_cb = c_null_funptr
end program


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

   to_cb = c_null_funptr

internal compiler error: Segmentation fault
0xc0dd2f crash_signal
../../gcc/toplev.c:335
0x75e442 gfc_trans_structure_assign(tree_node*, gfc_expr*, bool)
../../gcc/fortran/trans-expr.c:7361
0x7601a2 gfc_conv_structure(gfc_se*, gfc_expr*, int)
../../gcc/fortran/trans-expr.c:7420
0x75977c gfc_conv_expr(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-expr.c:7603
0x7616d6 gfc_trans_assignment_1
../../gcc/fortran/trans-expr.c:9317
0x71b551 trans_code
../../gcc/fortran/trans.c:1678
0x749f98 gfc_generate_function_code(gfc_namespace*)
../../gcc/fortran/trans-decl.c:6171
0x749de7 gfc_generate_contained_functions
../../gcc/fortran/trans-decl.c:5161
0x749de7 gfc_generate_function_code(gfc_namespace*)
../../gcc/fortran/trans-decl.c:6100
0x6d5d10 translate_all_program_units
../../gcc/fortran/parse.c:5886
0x6d5d10 gfc_parse_file()
../../gcc/fortran/parse.c:6092
0x718022 gfc_be_parse_file
../../gcc/fortran/f95-lang.c:198

[Bug c/71769] New: Invalid warning from -Wunsafe-loop-optimizations for a finite loop

2016-07-05 Thread nightstrike at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71769

Bug ID: 71769
   Summary: Invalid warning from -Wunsafe-loop-optimizations for a
finite loop
   Product: gcc
   Version: 6.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: nightstrike at gmail dot com
  Target Milestone: ---

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

In the attached testcase, function f compiles without warning for -O[023], but
function g warns for -O[0123].  The warning is "warning: cannot optimize
possibly infinite loops [-Wunsafe-loop-optimizations]".  The functions are very
similar, and I don't think it should warn in either case, as the conditionals
verify that the loop isn't infinite.

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/gcc6/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-6.1.0/configure --prefix=/gcc6
--enable-libstdcxx-time=rt --disable-multilib
--enable-languages=all,ada,obj-c++ --enable-plugins --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 6.1.0 (GCC)

$ gcc -c -std=gnu99 a.c -Wunsafe-loop-optimizations -O3

a.c: In function ‘g’:
a.c:18:2: warning: cannot optimize possibly infinite loops
[-Wunsafe-loop-optimizations]
  for(int i = a; i <= b; ++i)
  ^~~

$ cat a.c
// Warning with -Wunsafe-loop-optimizations and -O1 only
void f(int * x, int a, int b) {
if (b < a) b = a;
if (a < 1) return;

for (int i = a; i <= b; ++i)
x[i] += 1;
}

struct S {
unsigned int * data;
unsigned int * d2;
};

// Warning with -Wunsafe-loop-optimizations and -O1 or above
void g(struct S * x, int a, int b) {
if (b < a) b = a;
if (a < 1) return;

for(int i = a; i <= b; ++i)
__builtin_memcpy(x->data, x->d2, 5);
}

[Bug rtl-optimization/71768] Missed trivial rematerialiation oppurtunity

2016-07-05 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71768

--- Comment #2 from Jan Hubicka  ---
Also the cost model seems wrong.  If the register can be rematerialized (i.e.
it has REG_EQUIV), the memory_cost of the actual initialization insn should not
be accounted IMO.

[Bug target/71767] Endless stream of warnings when using GCC with -Wa,-q and Clang Integrated Assembler

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

--- Comment #3 from Andrew Pinski  ---
http://llvm.org/viewvc/llvm-project?view=revision=250349

[Bug target/71767] Endless stream of warnings when using GCC with -Wa,-q and Clang Integrated Assembler

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

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||assemble-failure
 Target||x86_64-apple-darwin12.6.0

--- Comment #2 from Andrew Pinski  ---
Note darwin GCC emits them for weak symbols still:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/darwin.c;h=0055d8054415ffa229bc69b22e02b9678ecc2c56;hb=HEAD

3616   /* Otherwise, default to the 'normal' non-reordered sections.  */
3617 default_function_sections:
3618   return (weak) ? darwin_sections[text_coal_section]
3619 : text_section;

If the coal section is deprecated, what is the replacement ones?

[Bug rtl-optimization/71768] Missed trivial rematerialiation oppurtunity

2016-07-05 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71768

Jan Hubicka  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-07-05
 CC||vmakarov at redhat dot com
 Ever confirmed|0   |1

--- Comment #1 from Jan Hubicka  ---
I looked into this a bit as it seemed to be easy to fix, but i don't see how
exactly rematerialization triggers here.
The following testcase:
const float cst=1;
int t()
{
  float val = cst;
  asm("#%0"::"x"(val));
  e();
  asm("#%0"::"x"(val));
}
looks almost identical pre-ira and is optimized as expected. The difference in
reloading seems to start here:
@@ -78,17 +78,14 @@
 Hard reg set forest:
   0:( 0-6 8-15 21-52)@0
 1:( 0-6 37-44)@12000
-2:( 21-28 45-52)@16000
+  Spill a1(r88,l0)

The reason here is that allocno's class_cost is not greater than memory_cost in
the vector case.  I guess either class_cost or memory_cost is not computed
correctly which seems to be done by record_reg_classes that does quite some
guesswork.

Later LRA misses the equivalence in the second case:

@@ -10,12 +10,55 @@
 Can eliminate 16 to 6 (offset=8, prev_offset=0)
 Can eliminate 20 to 7 (offset=0, prev_offset=0)
 Can eliminate 20 to 6 (offset=-8, prev_offset=0)
-alt=0: Bad operand -- refuse
-alt=1: Bad operand -- refuse
-  alt=2,overall=0,losers=0,rld_nregs=0
-Choosing alt 2 in insn 5:  (0) v  (1) vm {movv4si_internal}
-  alt=0,overall=0,losers=0,rld_nregs=0
+  Removing equiv init insn 5 (freq=1000)
+5: r88:SF=[`*.LC0']
+  REG_EQUIV 1.0e+0
+deleting insn with uid = 5.
+Changing pseudo 88 in operand 0 of insn 6 on equiv 1.0e+0
+0 Non-pseudo reload: reject+=2
+0 Non input pseudo reload: reject++
+  alt=0,overall=15,losers=2,rld_nregs=1
 Choosing alt 0 in insn 6:  (0) x
+  Creating newreg=90, assigning class SSE_REGS to r90
+6: {asm_operands;clobber fpsr:CCFP;clobber flags:CC;}
+  REG_UNUSED fpsr:CCFP
+  REG_UNUSED flags:CC
+Inserting insn reload before:
+   18: r90:SF=[`*.LC0']

I wonder why LRA behaves this way. Even if the register is not spilled, it can
be rematerialized.

[Bug c++/71214] Typo in feature test macro for rvalue references

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

--- Comment #6 from Markus Trippelsdorf  ---
Author: trippels
Date: Tue Jul  5 17:58:35 2016
New Revision: 238020

URL: https://gcc.gnu.org/viewcvs?rev=238020=gcc=rev
Log:
Fix PR c++/71214

 PR c++/71214
* c-cppbuiltin.c (c_cpp_builtins): Define * __cpp_rvalue_references.

Modified:
branches/gcc-5-branch/gcc/c-family/ChangeLog
branches/gcc-5-branch/gcc/c-family/c-cppbuiltin.c
branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C
branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C
branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C

[Bug c++/71214] Typo in feature test macro for rvalue references

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

Markus Trippelsdorf  changed:

   What|Removed |Added

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

--- Comment #8 from Markus Trippelsdorf  ---
Fixed.

[Bug c++/71214] Typo in feature test macro for rvalue references

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

--- Comment #7 from Markus Trippelsdorf  ---
Author: trippels
Date: Tue Jul  5 18:01:47 2016
New Revision: 238021

URL: https://gcc.gnu.org/viewcvs?rev=238021=gcc=rev
Log:
Fix PR c++/71214

PR c++/71214
* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_rvalue_references.

Modified:
branches/gcc-4_9-branch/gcc/c-family/ChangeLog
branches/gcc-4_9-branch/gcc/c-family/c-cppbuiltin.c
branches/gcc-4_9-branch/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C
branches/gcc-4_9-branch/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C
branches/gcc-4_9-branch/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C

[Bug c++/71214] Typo in feature test macro for rvalue references

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

--- Comment #5 from Markus Trippelsdorf  ---
Author: trippels
Date: Tue Jul  5 17:55:36 2016
New Revision: 238019

URL: https://gcc.gnu.org/viewcvs?rev=238019=gcc=rev
Log:
Fix PR c++/71214

PR c++/71214
* c-cppbuiltin.c (c_cpp_builtins): Define * __cpp_rvalue_references.

Modified:
branches/gcc-6-branch/gcc/c-family/ChangeLog
branches/gcc-6-branch/gcc/c-family/c-cppbuiltin.c
branches/gcc-6-branch/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C
branches/gcc-6-branch/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C
branches/gcc-6-branch/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C
branches/gcc-6-branch/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C

[Bug c++/71214] Typo in feature test macro for rvalue references

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

--- Comment #4 from Markus Trippelsdorf  ---
Author: trippels
Date: Tue Jul  5 17:50:41 2016
New Revision: 238017

URL: https://gcc.gnu.org/viewcvs?rev=238017=gcc=rev
Log:
Fix PR c++/71214

   PR c++/71214
   * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_rvalue_references.

Modified:
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-cppbuiltin.c
trunk/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C
trunk/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C
trunk/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C
trunk/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C

[Bug target/71763] powerpc64: ICE due to need for output reload on jump

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

--- Comment #8 from Michael Meissner  ---
In the past we have tried restricting the registers of the pattern to just GPRs
and CTR, and it pops back in another fashion (whack-a-mole).

[Bug target/71763] powerpc64: ICE due to need for output reload on jump

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

--- Comment #7 from Segher Boessenkool  ---
(In reply to Michael Meissner from comment #6)
> Note if you put the requirement that you need direct move, you will
> potentially have the problem in power7.

Yes; we have that same problem for FPRs already, see PR70098.

> I'm really tired of the register allocator trying to be 'helpful' in
> de-optimizing BDNZ loops by spilling the index to the FP registers (and now
> Altivec registers).  I've seen instances of this popping up for at least the
> last 7 years.

Maybe it should always split an allocno where used in a jump insn?
The ctr* patterns can then just always require a GPR (or ctr).

Or something like Alan's output-reload-on-jump-insns patch.

Or, we should just not generate ctr* if it isn't allocated the ctr reg!
It is *supposed* to not do that, but still it often does.

[Bug rtl-optimization/71768] New: Missed trivial rematerialiation oppurtunity

2016-07-05 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71768

Bug ID: 71768
   Summary: Missed trivial rematerialiation oppurtunity
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: enhancement
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hubicka at gcc dot gnu.org
  Target Milestone: ---

Compiling
#define vector __attribute__ ((vector_size (16)))
const vector int cst={10,10,10,10};
int t()
{
  vector int val = cst;
  asm("#%0"::"x"(val));
  e();
  asm("#%0"::"x"(val));
}
Results in:
t:
.LFB0:
.cfi_startproc
subq$24, %rsp
.cfi_def_cfa_offset 32
vmovaps .LC0(%rip), %xmm0
#APP
# 6 "t.c" 1
#%xmm0
# 0 "" 2
#NO_APP
xorl%eax, %eax
vmovaps %xmm0, (%rsp)
calle
vmovaps (%rsp), %xmm0
#APP
# 8 "t.c" 1
#%xmm0
# 0 "" 2
#NO_APP
addq$24, %rsp
.cfi_def_cfa_offset 8
ret

Which is clearly suboptimal, because xmm0 can be rematerialized again from LC0.
This hits pretty badly the exchange2 benchmark with -O3 -march=bdver2 where the
function is self recursive and we end up having many constants cached in XMM
registers.

[Bug target/71763] powerpc64: ICE due to need for output reload on jump

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

--- Comment #6 from Michael Meissner  ---
Note if you put the requirement that you need direct move, you will potentially
have the problem in power7.

I'm really tired of the register allocator trying to be 'helpful' in
de-optimizing BDNZ loops by spilling the index to the FP registers (and now
Altivec registers).  I've seen instances of this popping up for at least the
last 7 years.

[Bug rtl-optimization/71594] [7 Regression] ice in maybe_legitimize_operand, at optabs.c:6893

2016-07-05 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71594

--- Comment #7 from ktkachov at gcc dot gnu.org ---
Author: ktkachov
Date: Tue Jul  5 16:37:40 2016
New Revision: 238013

URL: https://gcc.gnu.org/viewcvs?rev=238013=gcc=rev
Log:
[RTL ifcvt] PR rtl-optimization/71594: ICE in noce_emit_cmove due to mismatched
source modes

PR rtl-optimization/71594
* ifcvt.c (noce_convert_multiple_sets): Wrap new_val or old_val
into subregs of appropriate mode before trying to emit a conditional
move.

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


Added:
trunk/gcc/testsuite/gcc.dg/torture/pr71594.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/ifcvt.c
trunk/gcc/testsuite/ChangeLog

[Bug rtl-optimization/71594] [7 Regression] ice in maybe_legitimize_operand, at optabs.c:6893

2016-07-05 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71594

ktkachov at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #8 from ktkachov at gcc dot gnu.org ---
Fixed.

[Bug c++/71214] Typo in feature test macro for rvalue references

2016-07-05 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71214

Jason Merrill  changed:

   What|Removed |Added

 CC||jason at gcc dot gnu.org

--- Comment #3 from Jason Merrill  ---
Hmm.  The original SD-6 proposal
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3694.htm) used the
singular, and GCC's macro was based on that, but it changed to plural in all
later revisions I can find.

[Bug fortran/71764] compiler internal error: segmentation fault

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

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu.org

--- Comment #3 from kargl at gcc dot gnu.org ---
Minimum testcase.

module sqlite3_primitive
   use iso_c_binding, only: c_funptr
end module sqlite3_primitive

module fsqlite_runtime

  use sqlite3_primitive

  use, intrinsic :: iso_c_binding, only : c_null_funptr, c_funptr

  implicit none

   contains

  subroutine fsqlite_exec
 type(c_funptr) to_cb 
 to_cb = c_null_funptr 
  end subroutine

end module

Another workaround is use PRIVATE in sqlite3_primitive and
only declare those items that need to by PUBLIC.

[Bug c++/71767] Endless stream of warnings when using GCC with -Wa,-q and Clang Integrated Assembler

2016-07-05 Thread noloader at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71767

--- Comment #1 from Jeffrey Walton  ---
Also see LLVM Issue 28427, "Endless stream of warnings when using GCC with
-Wa,-q and Clang Integrated Assembler",
https://llvm.org/bugs/show_bug.cgi?id=28427.

[Bug c++/71767] New: Endless stream of warnings when using GCC with -Wa,-q and Clang Integrated Assembler

2016-07-05 Thread noloader at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71767

Bug ID: 71767
   Summary: Endless stream of warnings when using GCC with -Wa,-q
and Clang Integrated Assembler
   Product: gcc
   Version: 6.1.0
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: noloader at gmail dot com
  Target Milestone: ---

When using MacPorts GCC on OS X and enlisting the Clang Integrated Assembler
via -Wa,-q, the assembler produces a stream of warnings for each file. A simple
test case is shown below (but a real project produces thousands of them).

I found LLVM Commit r250349, Stop generating coal sections. Here's the code
responsible, but its not clear to me how to disable the warning.

+  // Issue a warning if the target is not powerpc and Section is a *coal*
section.
+  Triple TT = getParser().getContext().getObjectFileInfo()->getTargetTriple();
+  Triple::ArchType ArchTy = TT.getArch();
+
+  if (ArchTy != Triple::ppc && ArchTy != Triple::ppc64) {
+StringRef NonCoalSection = StringSwitch(Section)
+   .Case("__textcoal_nt", "__text")
+   .Case("__const_coal", "__const")
+   .Case("__datacoal_nt", "__data")
+   .Default(Section);
+
+if (!Section.equals(NonCoalSection)) {
+  StringRef SectionVal(Loc.getPointer());
+  size_t B = SectionVal.find(',') + 1, E = SectionVal.find(',', B);
+  SMLoc BLoc = SMLoc::getFromPointer(SectionVal.data() + B);
+  SMLoc ELoc = SMLoc::getFromPointer(SectionVal.data() + E);
+  getParser().Warning(Loc, "section \"" + Section + "\" is deprecated",
+  SMRange(BLoc, ELoc));
+  getParser().Note(Loc, "change section name to \"" + NonCoalSection +
+   "\"", SMRange(BLoc, ELoc));
+}
+  }
+

**

The test case depends upon -g2 and -O2. if I omit them, then the warnings are
not present.

$ cat test.cxx 
#include 
#include 

int main(int argc, char* argv[])
{
  std::for_each(argv, argv+argc, [](char* str)
  {std::cout << str << std::endl;});

  return 0;
}

$ /opt/local/bin/g++-mp-6 -march=native -g2 -O2 -std=c++11 -Wa,-q test.cxx -o
test.exe
/var/folders/mk/y7lk0xrx72lcn_2q3d12jcchgn/T//cc1dR6yG.s:3:11: warning:
section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
 ^  ~
/var/folders/mk/y7lk0xrx72lcn_2q3d12jcchgn/T//cc1dR6yG.s:3:11: note: change
section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
 ^  ~

**

When the MacPorts GCC compiler encounters -Wa,-q, it uses /opt/local/bin/clang
as the assembler rather than /opt/local/bin/as. Here are the relevant versions.

$ /opt/local/bin/g++-mp-6 --version
g++-mp-6 (MacPorts gcc6 6.1.0_0) 6.1.0
Copyright (C) 2016 Free Software Foundation, Inc.

$ /opt/local/bin/clang --version
clang version 3.8.0 (branches/release_38 262722)
Target: x86_64-apple-darwin12.6.0

$ /opt/local/bin/as -version
Apple Inc version cctools-877.8, GNU assembler version 1.38

[Bug fortran/71764] compiler internal error: segmentation fault

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

--- Comment #2 from kargl at gcc dot gnu.org ---
Workaround is to remove the ONLY clause in the
sqlite3_primitive module.

Missing support for demangling lambdas with auto paramters in libbfd

2016-07-05 Thread Ronny Brendel
Hi gcc-developers and -users,

#include 
using namespace std;
int main() {

auto my_lambda = [](auto i) {
cout << "asdf\n" << i;
};

auto my_lambda2 = [](int i) {
cout << "asdf\n" << i;
};

my_lambda(1);
my_lambda(2.0);
my_lambda2(3);

return 0;
}

$ g++ --std=c++14 file.cpp

In this example the mangled names for the lamdbas are:

_ZZ4mainENKUliE0_clEi   <- int
_ZZ4mainENKUlT_E_clIdEEDaS_  <- auto : double
_ZZ4mainENKUlT_E_clIiEEDaS_   <- auto : int

c++filt and libbfd are unable to demangle the last two: (binutils
version 2.26 on Kubuntu 16.04, GCC version: gcc (Ubuntu
5.3.1-14ubuntu2.1) 5.3.1 20160413)

(lambdas with auto parameters is a c++14 feature)

Thanks for your help.
Best regards,
Ronny


[Bug c++/62314] Fix-it Hints

2016-07-05 Thread dmalcolm at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62314

--- Comment #8 from David Malcolm  ---
Author: dmalcolm
Date: Tue Jul  5 15:50:54 2016
New Revision: 238008

URL: https://gcc.gnu.org/viewcvs?rev=238008=gcc=rev
Log:
PR c++/62314: add fixit hint for "expected ';' after class definition"

gcc/cp/ChangeLog:
PR c++/62314
* parser.c (cp_parser_class_specifier_1): When reporting
missing semicolons, use a fixit-hint to suggest insertion
of a semicolon immediately after the closing brace,
offsetting the reported column accordingly.

gcc/testsuite/ChangeLog:
PR c++/62314
* gcc/testsuite/g++.dg/parse/error5.C: Update column
number of missing semicolon error.
* g++.dg/pr62314-2.C: New test case.


Added:
trunk/gcc/testsuite/g++.dg/pr62314-2.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/parser.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/parse/error5.C

[Bug middle-end/71762] [4.9/5/6/7 Regression] ifcombine wrong codegen with uninitialized data

2016-07-05 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71762

Richard Biener  changed:

   What|Removed |Added

   Keywords||wrong-code
 CC||rguenth at gcc dot gnu.org
   Target Milestone|--- |4.9.4
Summary|[4.9 Regression] ifcombine  |[4.9/5/6/7 Regression]
   |wrong codegen with  |ifcombine wrong codegen
   |uninitialized data  |with uninitialized data

--- Comment #2 from Richard Biener  ---
I think the issue is probably gone latent only, the revs that "fix" this merely
hide it.

[Bug target/66960] Add interrupt attribute to x86 backend

2016-07-05 Thread hjl.tools at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66960

--- Comment #16 from H.J. Lu  ---
(In reply to Goswin von Brederlow from comment #15)

> > No.  We only do it for data pushed onto stack by CPU.
> 
> I was thinking of something like:
> 
> __attribute__ ((interrupt("save_regs")))
> void
> f (struct interrupt_frame *frame, uword_t error_code, struct regs regs)
> {
> kprintf("user SP = %#016x\n", regs.sp);
> }

It is an interesting idea.  But frame and err_code are created by caller,
which is CPU, not by callee.  You want to not only save all original
registers of interrupted process, but also make them available to interrupt
handler.  This won't be supported without significant changes in
infrastructure.

[Bug rtl-optimization/71621] [7 Regression] ICE in assign_by_spills, at lra-assigns.c:1417 (error: unable to find a register to spill) w/ -O2 -mavx2 -ftree-vectorize

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

--- Comment #2 from Arseny Solokha  ---
Another one, just for the record:

int hf, sv, zz, aj;

void
dn (int xb, int bl)
{
  while (zz < 1)
  {
if (xb == 0)
  goto mr;

while (bl < 3)
{
  int d3;
  unsigned char vh;
  unsigned char *fj = 

 mr:
  while (bl < 1)
  {
hf += vh;
++bl;
  }
  if (xb == 0)
zz = bl;
  if (d3 == 0)
return;
  while (sv < 1)
  {
--vh;
aj += vh;
++sv;
  }
}
sv = 0;
  }
}

% x86_64-pc-linux-gnu-gcc-7.0.0-alpha20160703 -c -mavx2 -O3 md4gkoj3.c
md4gkoj3.c: In function 'dn':
md4gkoj3.c:36:1: error: unable to find a register to spill
 }
 ^
md4gkoj3.c:36:1: error: this is the insn:
(insn 93 571 35 3 (set (reg:V32QI 172 [ vect_cst__257 ])
(vec_duplicate:V32QI (reg:QI 330))) 4215 {*vec_dupv32qi}
 (expr_list:REG_DEAD (reg:QI 330)
(nil)))
md4gkoj3.c:36:1: internal compiler error: in assign_by_spills, at
lra-assigns.c:1417

[Bug c/71766] New: Strange position of "error: request for member ‘...’ in something not a structure or union"

2016-07-05 Thread ch3root at openwall dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71766

Bug ID: 71766
   Summary: Strange position of "error: request for member ‘...’
in something not a structure or union"
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ch3root at openwall dot com
  Target Milestone: ---

Only the first letter of 'offsetof' is shown in another color for the following
testcase.

Source code:

--
#include 

int main()
{
  +offsetof(int, a);
}
--

Results:

--
$ gcc -std=c11 -pedantic -Wall -Wextra -O3 test.c && ./a.out
In file included from test.c:1:0:
test.c: In function ‘main’:
test.c:5:4: error: request for member ‘a’ in something not a structure or union
   +offsetof(int, a);
^
--

gcc version: gcc (GCC) 7.0.0 20160704 (experimental)


For comparison:

--
$ clang -std=c11 -Weverything -O3 test.c && ./a.out
test.c:5:4: error: offsetof requires struct, union, or class type, 'int'
invalid
  +offsetof(int, a);
   ^~~~
.../lib/clang/3.9.0/include/stddef.h:120:24: note: expanded from macro
'offsetof'
#define offsetof(t, d) __builtin_offsetof(t, d)
   ^  ~
1 error generated.
--

clang version: clang version 3.9.0 (trunk 274502)

[Bug target/71763] powerpc64: ICE due to need for output reload on jump

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

--- Comment #5 from Segher Boessenkool  ---
Actually, needs -mcpu=power8 as well, otherwise we get another ICE (we need
direct moves for FP regs in the ctr patterns; this is the case that is not
yet solved in PR70098).

[Bug target/71763] powerpc64: ICE due to need for output reload on jump

2016-07-05 Thread amodra at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71763

--- Comment #4 from Alan Modra  ---
Created attachment 38833
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38833=edit
output reloads on jump insns

Revised https://gcc.gnu.org/ml/gcc-patches/2004-12/msg00739.html
It's surprising how little has changed.

[Bug target/71088] [i386, AVX-512, Perf] vpermi2ps instead of vpermps emitted

2016-07-05 Thread izamyatin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71088

--- Comment #1 from Igor Zamyatin  ---
Fixed by r237982

[Bug target/71763] powerpc64: ICE due to need for output reload on jump

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

Segher Boessenkool  changed:

   What|Removed |Added

 Target|powerpc64le-linux   |powerpc64*-linux

--- Comment #3 from Segher Boessenkool  ---
Testcase needs -O1 -mvsx -m64; fails on BE just the same.

[Bug target/66960] Add interrupt attribute to x86 backend

2016-07-05 Thread goswin-v-b at web dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66960

--- Comment #15 from Goswin von Brederlow  ---
(In reply to H.J. Lu from comment #14)
> (In reply to Goswin von Brederlow from comment #13)
> > > > Secondly why pass error_code as argument if is already on the stack and
> > > > could be accessed through the frame pointer? The argument register 
> > > > (amd64)
> > > > would have to be saved on the stack too causing an extra push/pop. But 
> > > > if it
> > > > is passed as argument then why not pop it before the call to keep the 
> > > > stack
> > > > frame the same as for interrupts (assuming the saved registers are not
> > > > included in the frame)?
> > > 
> > > error_code is a pseudo parameter, which is mapped to error code on stack
> > > pushed by CPU.  You can write a simple code to see it yourself.
> > 
> > Couldn't the same trick be used for registers? Pass them as pseudo
> > parameters and they either resolve to the location on the stack where gcc
> > did save them or become the original register unchanged.
> 
> No.  We only do it for data pushed onto stack by CPU.

I was thinking of something like:

__attribute__ ((interrupt("save_regs")))
void
f (struct interrupt_frame *frame, uword_t error_code, struct regs regs)
{
kprintf("user SP = %#016x\n", regs.sp);
}

[Bug fortran/71623] [5/6/7 Regression] Segfault when allocating deferred-length characters to size of a pointer

2016-07-05 Thread vehre at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71623

--- Comment #7 from vehre at gcc dot gnu.org ---
Waiting one week for regressions to pop up before applying to gcc-6 and -5.

[Bug fortran/71623] [5/6/7 Regression] Segfault when allocating deferred-length characters to size of a pointer

2016-07-05 Thread vehre at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71623

--- Comment #6 from vehre at gcc dot gnu.org ---
Author: vehre
Date: Tue Jul  5 12:06:22 2016
New Revision: 238002

URL: https://gcc.gnu.org/viewcvs?rev=238002=gcc=rev
Log:
gcc/fortran/ChangeLog:

2016-07-05  Andre Vehreschild  

PR fortran/71623
* trans-stmt.c (gfc_trans_allocate): Add code of pre block of typespec
in allocate to parent block.

gcc/testsuite/ChangeLog:

2016-07-05  Andre Vehreschild  

PR fortran/71623
* gfortran.dg/deferred_character_17.f90: New test.



Added:
trunk/gcc/testsuite/gfortran.dg/deferred_character_17.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-stmt.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/71214] Typo in feature test macro for rvalue references

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

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-07-05
 CC||trippels at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |trippels at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Markus Trippelsdorf  ---
Confirmed. I will post a patch.

[Bug c++/71755] friend function may not be defined inside a class using a qualified name but GCC allows that

2016-07-05 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71755

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords||accepts-invalid
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-07-05
 Ever confirmed|0   |1

[Bug c++/71765] incorrectly accepts invalid C++ code that invokes base class constructor

2016-07-05 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71765

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords||accepts-invalid
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-07-05
 Ever confirmed|0   |1

--- Comment #1 from Jonathan Wakely  ---
From the clang bug report:

[basic.lookup.classref]p3 says:

"If the unqualified-id is ~type-name, the type-name is looked up in the context
of the entire postfix-expression. If the type T of the object expression is of
a class type C, the type-name is also looked up in the scope of class C. At
least one of the lookups shall find a name that refers to (possibly
cv-qualified) T."

So Richard is right that we should reject it, because lookup for ~A finds the
type-name A, but that doesn't refer to B, so it's ill-formed.

[Bug c++/71214] Typo in feature test macro for rvalue references

2016-07-05 Thread d.v.a at ngs dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71214

__vic  changed:

   What|Removed |Added

 CC||d.v.a at ngs dot ru

--- Comment #1 from __vic  ---
The same in GCC 6.1

[Bug libgcj/71757] libgcj: unknown symbol __cxa_throw_bad_array_new_length

2016-07-05 Thread timo.teras at iki dot fi
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71757

--- Comment #9 from Timo Teräs  ---
Adding the following also works for me:

--- gcc-6.1.0/libjava/Makefile.am
+++ gcc-6.1.0/libjava/Makefile.am
@@ -488,10 +488,14 @@
 nat_files = $(nat_source_files:.cc=.lo)
 xlib_nat_files = $(xlib_nat_source_files:.cc=.lo)

+libgcj_la_CPPFLAGS = \
+$(AM_CPPFLAGS) \
+$(LIBSTDCXX_RAW_CXX_CXXFLAGS)
+
 # Include THREADLIBS here to ensure that the correct version of
 # certain linuxthread functions get linked:
 ## The mysterious backslash in the grep pattern is consumed by make.
-libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(extra_ldflags)
$(THREADLIBS) \
+libgcj_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LDFLAGS) -rpath $(toolexeclibdir)
$(THREADLDFLAGS) $(extra_ldflags) $(THREADLIBS) \
$(LIBLTDL) $(SYS_ZLIBS) $(LIBJAVA_LDFLAGS_NOUNDEF) \
-version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) $(LIBGCJ_LD_EXPORT_ALL)
--- gcc-6.1.0/libjava/Makefile.in
+++ gcc-6.1.0/libjava/Makefile.in
@@ -1103,9 +1103,13 @@
 nat_files = $(nat_source_files:.cc=.lo)
 xlib_nat_files = $(xlib_nat_source_files:.cc=.lo)

+libgcj_la_CPPFLAGS = \
+   $(AM_CPPFLAGS) \
+$(LIBSTDCXX_RAW_CXX_CXXFLAGS)
+
 # Include THREADLIBS here to ensure that the correct version of
 # certain linuxthread functions get linked:
-libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(extra_ldflags)
$(THREADLIBS) \
+libgcj_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LDFLAGS) -rpath $(toolexeclibdir)
$(THREADLDFLAGS) $(extra_ldflags) $(THREADLIBS) \
$(LIBLTDL) $(SYS_ZLIBS) $(LIBJAVA_LDFLAGS_NOUNDEF) \
-version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) $(LIBGCJ_LD_EXPORT_ALL)

After this the proper .so dependency is picked up for libstdc++.

[Bug middle-end/71762] [4.9 Regression] ifcombine wrong codegen with uninitialized data

2016-07-05 Thread ibuclaw at gdcproject dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71762

--- Comment #1 from Iain Buclaw  ---
Backporting r217638 to gcc-4.9 fixes the problem too.

Allowing propagation of __cond60 and __cond59 comparisons into comparisons of
len elides the wrong optimization.

---
__cond60_9 = len_8(D) > 1;
if (__cond60_9 != 0)
  goto ;
else
  goto ;

:
__cond59_13 = len_8(D) == 1;
if (__cond59_13 != 0)
  goto ;
else
  goto ;

/* ... */

:
if (__cond60_9 != 0)
  goto ;
else
  goto ;
---

Becomes:

---
if (len_8(D) > 1)
  goto ;
else
  goto ;

:
if (len_8(D) == 1)
  goto ;
else
  goto ;

/* ... */

:
if (len_8(D) <= 1)
  goto ;
else
  goto ;
---

[Bug c++/71765] New: incorrectly accepts invalid C++ code that invokes base class constructor

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

Bug ID: 71765
   Summary: incorrectly accepts invalid C++ code that invokes base
class constructor
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

Please see: 

https://llvm.org/bugs/show_bug.cgi?id=28408

in particular, Richard Smith's comment. 


$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160704 (experimental) [trunk revision 237986] (GCC) 
$ 
$ g++-trunk -c -Wall -Wextra -pedantic -std=c++98 good.cpp
$ 
$ clang++-3.8 -c good.cpp
good.cpp:14:7: error: destructor type 'A' in object destruction expression does
not match the type 'B' of the
  object being destroyed
  b->~A (); 
  ^
good.cpp:1:8: note: type 'A' is declared here
struct A 
   ^
1 error generated.
$ 
$ cat good.cpp
struct A 
{
  virtual ~A () {}
};

struct B : public A 
{
  virtual ~B () {} 
};

void foo ()
{
  B *b = new B;
  b->~A (); 
  // but okay: b->A::~A(); 
}