[Bug middle-end/103993] -Wismatched-new-delete due to difference in inlining decisions

2022-04-25 Thread andre at kostur dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103993

andre at kostur dot net changed:

   What|Removed |Added

 CC||andre at kostur dot net

--- Comment #3 from andre at kostur dot net ---
Here's a smaller, minimal example of the issue (as described in the subject):

#include 
struct Foo {
   static void * operator new( size_t s ) __attribute__( ( noinline ) ) {
  return ::operator new( s );
   }
   static void operator delete( void * p ) { return ::operator delete( p ); }
};

int
main() {
   Foo * f = new Foo();
   delete f;
}

[Bug c++/100879] New: gcc is complaining of a signed compare when comparing enums of different types (same underlying type)

2021-06-02 Thread andre at kostur dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100879

Bug ID: 100879
   Summary: gcc is complaining of a signed compare when comparing
enums of different types (same underlying type)
   Product: gcc
   Version: 10.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: andre at kostur dot net
  Target Milestone: ---

With the following test code:

enum e1 { e1val };

enum e2 { e3val };

int main( int, char * [] ) {
   if ( e1val == e3val ) return 1;
}

The compiler emits two warnings:
: In function 'int main(int, char**)':
:6:15: warning: comparison between 'enum e1' and 'enum e2'
[-Wenum-compare]
6 |if ( e1val == e3val ) return 1;
  | ~~^~~~
:6:15: warning: comparison between types 'e1' and 'e2' [-Wsign-compare]

The first is correct, but the second warning seems wrong.  There is no sign
mismatch as both enums would have the same underlying type.

gcc 9.3 does not seem to suffer this problem.  gcc 10.1 does, and appears every
version up to at least 11.1 does.  (Checked on compiler-explorer)