[Bug c++/66604] New: ICE in use_thunk at cp/method.c:338 when creating a default virtual destructor

2015-06-19 Thread eric_moyer at yahoo dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66604

Bug ID: 66604
   Summary: ICE in use_thunk at cp/method.c:338 when creating a
default virtual destructor
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: eric_moyer at yahoo dot com
  Target Milestone: ---

This may be the same as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60595
unfortunately, I don't know how to compile using the preprocessed source so I
couldn't relocate it to a machine where I can run a more recent g++ to verify
that the problem is fixed.

The machine is running 64-bit Centos.

>From gcc -v:
Configured with: ./configure --prefix=/usr/local/gcc/4.8.1
--build=x86_64-redhat-linux-gnu --libdir=/usr/lib64 --with-slibdir=/usr/l
ib64 --enable-version-specific-runtime-libs --enable-threads --enable-static
--enable-languages=c,c++ --disable-multilib --with-cloo
g=/tmp/gcc-deps --enable-cloog-backend=isl --disable-cloog-version-check

Thread model: posix
gcc version 4.8.1 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-Wno-format-y2k' '-pthread' '-O2'
'-fPIC' '-std=c++11' '-g' '-Wall' '-Wextra' '-Werror'
 '-Wpedantic' '-I' '../../../../../../include' '-I'
'../../../../../../include/internal' '-I' '.' '-I'
'/netopt/ncbi_tools64/c++.by-
date/20150619/src/internal/variation/snp/dbsnp2.0/lib' '-D' 'NDEBUG' '-D'
'_LARGEFILE_SOURCE' '-D' '_FILE_OFFSET_BITS=64' '-D' '_LAR
GEFILE64_SOURCE' '-D' '_MT' '-D' '_REENTRANT' '-D' '_THREAD_SAFE' '-I'
'/netopt/ncbi_tools64/c++.by-date/20150619/GCC481-Release64MT
/inc' '-I' '/netopt/ncbi_tools64/c++.by-date/20150619/include' '-I'
'/netopt/ncbi_tools64/c++.by-date/20150619/include/internal' '-s
hared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/local/gcc/4.8.1/libexec/gcc/x86_64-redhat-linux-gnu/4.8.1/cc1plus -E
-quiet -v -I ../../../../../../include -I ../../../../../
../include/internal -I . -I
/netopt/ncbi_tools64/c++.by-date/20150619/src/internal/variation/snp/dbsnp2.0/lib
-I /netopt/ncbi_tools6
4/c++.by-date/20150619/GCC481-Release64MT/inc -I
/netopt/ncbi_tools64/c++.by-date/20150619/include -I
/netopt/ncbi_tools64/c++.by-da
te/20150619/include/internal -D_GNU_SOURCE -D_REENTRANT -D NDEBUG -D
_LARGEFILE_SOURCE -D _FILE_OFFSET_BITS=64 -D _LARGEFILE64_SOURC
E -D _MT -D _REENTRANT -D _THREAD_SAFE Rs/RefSnpSnapshot.cpp -mtune=generic
-march=x86-64 -std=c++11 -Wno-format-y2k -Wall -Wextra -
Werror -Wpedantic -fPIC -g -fworking-directory -O2 -fpch-preprocess -o
RefSnpSnapshot.ii
ignoring nonexistent directory
"/usr/lib64/gcc/x86_64-redhat-linux-gnu/4.8.1/../../../../../x86_64-redhat-linux-gnu/include"

Error message:
Compiler executable checksum: ae8d4875691bdb213696bc564004f479
In file included from
../../../../../../include/internal/variation/snp/dbsnp2.0/lib/Build/BuildComponent.hpp:32:0,
 from
../../../../../../include/internal/variation/snp/dbsnp2.0/lib/Build/DerivedProductBuildComponent.hpp:30,
 from
../../../../../../include/internal/variation/snp/dbsnp2.0/lib/Build/Summary.hpp:31,
 from
../../../../../../include/internal/variation/snp/dbsnp2.0/lib/Rs/RefSnpSnapshot.hpp:30,
 from Rs/RefSnpSnapshot.cpp:29:
../../../../../../include/internal/variation/snp/dbsnp2.0/lib/SharedFromThis.hpp:66:13:
internal compiler error: in use_thunk, at cp/method.c:338
 virtual ~virtual_enable_shared_from_this() = default;
 ^
Please submit a full bug report,
with preprocessed source if appropriate.


[Bug c++/66604] ICE in use_thunk at cp/method.c:338 when creating a default virtual destructor

2015-06-19 Thread eric_moyer at yahoo dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66604

--- Comment #1 from Eric Moyer  ---
Created attachment 35817
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35817&action=edit
Preprocessed source (zipped because of attachment length limit)


[Bug libstdc++/45202] New: Strict aliasing warning in stl_tree (returning a copy of a set from a member function in a loop)

2010-08-05 Thread eric_moyer at yahoo dot com
The following code (as small as I can get but I'm not sure its minimal)

#include 

struct X{
  unsigned a;
  X(){}
  bool operator<(const X& i)const { return a < i.a; }
};

struct R{
  std::set getSet() const{
std::set result;
result.insert(X());
return result;
  }
};

void bug(){
  for(unsigned x = 0; x < 2; ++x){
std::set pts = R().getSet();
  }
}


Produces the following warnings:


bug-check2.cpp: In function ‘void bug()’:
bug-check2.cpp:6: warning: dereferencing pointer ‘__x.22’ does break
strict-aliasing rules
/usr/include/c++/4.4/bits/stl_tree.h:525: note: initialized from here
bug-check2.cpp:6: warning: dereferencing pointer ‘__x.22’ does break
strict-aliasing rules
/usr/include/c++/4.4/bits/stl_tree.h:525: note: initialized from here


When compiled with:

g++ -Wall -O3 -c bug-check2.cpp

With version 4.4.1 on Ubuntu 9.10 (Sorry for the old version, it would take
hours to recompile g++ and I already have put several into reducing the
test-case.)

I will be attaching the g++ verbose output, the preprocessed source, and the
original source.




Unusual symptoms:

1. Making getSet static or a global function removes the warning.

2. Reducing the number of loop iterations below 2 reduces or removes the
warning.

3. Removing the constructor for X removes one of the warnings.

4. Changing X::operator< to return a constant value removes the warning

5. Changing X::operator< to {return a < b; } where b is a global variable
removes the warning

6. Removing the result.insert(X()) line removes the warnings

7. Making result a global variable removes the warnings.


-- 
   Summary: Strict aliasing warning in stl_tree (returning a copy of
a set from a member function in a loop)
   Product: gcc
   Version: 4.4.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: eric_moyer at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45202



[Bug libstdc++/45202] Strict aliasing warning in stl_tree (returning a copy of a set from a member function in a loop)

2010-08-05 Thread eric_moyer at yahoo dot com


--- Comment #1 from eric_moyer at yahoo dot com  2010-08-05 22:02 ---
Created an attachment (id=21415)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21415&action=view)
Test case: original source


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45202



[Bug libstdc++/45202] Strict aliasing warning in stl_tree (returning a copy of a set from a member function in a loop)

2010-08-05 Thread eric_moyer at yahoo dot com


--- Comment #2 from eric_moyer at yahoo dot com  2010-08-05 22:03 ---
Created an attachment (id=21416)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21416&action=view)
Test case: preprocessed source


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45202



[Bug libstdc++/45202] Strict aliasing warning in stl_tree (returning a copy of a set from a member function in a loop)

2010-08-05 Thread eric_moyer at yahoo dot com


--- Comment #3 from eric_moyer at yahoo dot com  2010-08-05 22:04 ---
Created an attachment (id=21417)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21417&action=view)
Test case: output of g++ 4.4.1-ubutntu9 with -v switch


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45202



[Bug libstdc++/45202] Strict aliasing warning in stl_tree (returning a copy of a set from a member function in a loop)

2010-08-05 Thread eric_moyer at yahoo dot com


--- Comment #4 from eric_moyer at yahoo dot com  2010-08-05 22:18 ---
This is not a duplicate of bug# 39390 because my copy of g++ compiles the test
case for that bug without complaint.  

It may be related to 42032 since that does not compile correctly but (1) the
error messages are different; (2) the errors are for different lines of the
stl_tree file; and (3) that bug relates to a map rather than a set


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45202



[Bug c++/45203] New: [Feature request] #pragma start_no_warn_regex

2010-08-05 Thread eric_moyer at yahoo dot com
I am requesting a pragma to suppress warnings that match a given regular
expression.  (Really I'd be happy with any way to suppress arbitrary warnings
for small sections of code.  This is just my proposal of a simple way to do
it.)

I propose adding two new pragmas:

#pragma start_no_warn_regex [regular expression here to end of line]

and 

#pragma end_no_warn_regex

When the preprocessor encounters start_no_warn_regex, it pushes the regular
expression onto a stack of regular expressions.  When it encounters
end_no_warn_regex, it pops the top regex off the stack.

Then for any line of code, if a warning would be emitted that matches any regex
in the stack, that warning is suppressed.


- Why? -


Warnings, by definition are going to have false positives.  However, after one
has looked carefully at the case in question (through a code-review or whatever
other quality assurance procedures are in place) and decided that the code as
written is good, the warning becomes noise needing to be mentally filtered out
by the programmer each time and possibly obscuring new warnings that should be
heeded.

This can be especially burdensome in library code.  One may have a complex
templated class in a header that compiles correctly but which produces
warnings.  The library should not emit warnings because the user can not fix
the problem.  However, giving the compiler enough analysis force to avoid
spitting out the warning is impractical.  It is better for the compiler to flag
suspicious things that are tractable to find and allow the human analytical
skills to fill in the gap.

Some warnings can be handled by simple code changes:  I leave out the names of
variables in function calls where the variable is unused;  I initialize some
variables in unreachable code that the compiler does not know is unreachable; I
initialize others twice to avoid warnings about "possible use of x
uninitialized." and so forth.  However, I would like a general method of
warning suppression and #pragma start_no_warn_regex provides an easy and
powerful way of meeting this goal.  (Of course choose a shorter name if you'd
like, the effect is what I'm interested in.)

Disabling warnings for an entire compilation unit is the other way to attack
this problem.  However, it is too blunt a tool.  I only know that variable x is
not being used uninitialized on line y.  Variable q on line r of the same
routine may be genuinely uninitialized and I would still like to be warned
about but not told that variable x is possibly uninitialized.


-- 
   Summary: [Feature request] #pragma start_no_warn_regex
   Product: gcc
   Version: 4.4.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: eric_moyer at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45203



[Bug c++/45203] [Feature request] #pragma start_no_warn_regex

2010-08-05 Thread eric_moyer at yahoo dot com


-- 

eric_moyer at yahoo dot com changed:

   What|Removed |Added

   Severity|normal  |enhancement
Summary|[Feature request] #pragma   |[Feature request] #pragma
   |start_no_warn_regex |start_no_warn_regex


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45203



[Bug c++/45203] [Feature request] #pragma start_no_warn_regex

2010-08-05 Thread eric_moyer at yahoo dot com


--- Comment #2 from eric_moyer at yahoo dot com  2010-08-06 02:09 ---
If you are talking about "#pragma GCC diagnostic" that looks good.  Turning off
error classes is sufficiently fine grained.  However the pragma is only 
guaranteed to work on a file-wide scope.  The 4.5 manual says,

"Also, while it is syntactically valid to put these pragmas anywhere in your
sources, the only supported location for them is before any data or functions
are defined. Doing otherwise may result in unpredictable results depending on
how the optimizer manages your sources."

I want to disable warnings for particular lines of code rather than whole
files.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45203



[Bug c++/45203] [Feature request] #pragma start_no_warn_regex

2010-08-09 Thread eric_moyer at yahoo dot com


--- Comment #4 from eric_moyer at yahoo dot com  2010-08-09 22:10 ---
That is great to hear.  I've wanted this feature for years (but never took the
time to create a bugzilla account.)  Thank you.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45203