[Bug c++/46903] New: [C++0x] ICE unexpected expression of kind template_id_expr

2010-12-12 Thread rubidium at openttd dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46903

   Summary: [C++0x] ICE unexpected expression of kind
template_id_expr
   Product: gcc
   Version: 4.6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: rubid...@openttd.org


Created attachment 22723
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22723
Test case, compile with C++0x.

The attached test case fails with an ICE:
test.ii:6:18: internal compiler error: unexpected expression ‘CreateA’ of
kind template_id_expr

Using: g++-trunk -std=gnu++0x test.ii
With g++-trunk (GCC) 4.6.0 20101211 (experimental) (revision 167723)

It compiles fine with gcc 4.5.1, 4.4.5 and 4.3.5.


[Bug c++/44108] [4.6 Regression] -Wunused-but-set-variable does not consider array sizing use of a const variable

2010-05-13 Thread rubidium at openttd dot org


--- Comment #1 from rubidium at openttd dot org  2010-05-13 11:04 ---
Created an attachment (id=20655)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20655&action=view)
Simple testcase

Compile with g++ -Wunused-but-set-variable testcase.cpp


-- 


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



[Bug c++/44108] New: [4.6 Regression] -Wunused-but-set-variable does not consider array sizing use of a const variable

2010-05-13 Thread rubidium at openttd dot org
Like PR c/43981, but still happening with 4.6.0 20100513 (Last Changed Rev:
159356
), which is why I copied and editted the title.

In case a const variable is used for array sizing it is not considered to be
read whereas a non-const variable would be considered to be read. It does NOT
happen when using gcc on a .c file, but it happens when using g++ on a .cpp
file, as such component c++.

See the attached test case which shows that only the const variables are
affected by this.


-- 
   Summary: [4.6 Regression] -Wunused-but-set-variable does not
consider array sizing use of a const variable
   Product: gcc
   Version: 4.6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rubidium at openttd dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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



[Bug lto/41602] undefined references when linking with -flto

2009-10-06 Thread rubidium at openttd dot org


--- Comment #1 from rubidium at openttd dot org  2009-10-06 13:45 ---
Created an attachment (id=18721)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18721&action=view)
The testcase


-- 


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



[Bug lto/41602] New: undefined references when linking with -flto

2009-10-06 Thread rubidium at openttd dot org
Under certain circumstances, see attachment, linking with -flto fails:
gcc-4.5 r152491

gcc-4.5 -flto -lstdc++ main.cpp -o a.out
/tmp/ccWovgK1.lto.o:(.rodata._ZTV33ClientNetworkContentSocketHandler[_ZTV33ClientNetworkContentSocketHandler]+0x30):
undefined reference to
`_ZThn8_N33ClientNetworkContentSocketHandler9OnConnectEb'
collect2: ld returned 1 exit status

gcc-4.5  -lstdc++ main.cpp -o a.out



-- 
   Summary: undefined references when linking with -flto
   Product: gcc
   Version: 4.5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: lto
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rubidium at openttd dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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



[Bug c++/41275] [4.5] ICE: expand_expr_real_1, at expr.c:8416

2009-09-05 Thread rubidium at openttd dot org


--- Comment #1 from rubidium at openttd dot org  2009-09-05 13:42 ---
Created an attachment (id=18506)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18506&action=view)
The .ii file of save-temps


-- 


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



[Bug c++/41275] New: [4.5] ICE: expand_expr_real_1, at expr.c:8416

2009-09-05 Thread rubidium at openttd dot org
linux-gnu/4.5.0/../../../../include/c++/4.5.0/backward
 /usr/local/include
 /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/include
 /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-fomit-frame-pointer' '-DUNIX'
'-Wall' '-Wno-multichar' '-Wsign-compare' '-Wundef' '-Wwrite-strings'
'-Wpointer-arith' '-Wno-uninitialized' '-W' '-Wno-unused-parameter'
'-Wformat=2' '-Wredundant-decls' '-fno-strict-aliasing' '-Wcast-qual'
'-fno-strict-overflow' '-DWITH_ALLEGRO' '-I/usr/include' '-DWITH_SDL'
'-I/usr/include/SDL' '-D_REENTRANT' '-DWITH_ZLIB' '-D_SQ64'
'-I/home/rubidium/openttd/special/gcc-4.5/src/3rdparty/squirrel/include'
'-DWITH_PNG' '-I/usr/include/libpng12' '-DWITH_FONTCONFIG' '-DWITH_FREETYPE'
'-I/usr/include/freetype2' '-DWITH_ICU' '-D_REENTRANT' '-I/usr/include'
'-DENABLE_NETWORK' '-DWITH_PERSONAL_DIR' '-DPERSONAL_DIR=".openttd"'
'-DGLOBAL_DATA_DIR="/usr/local/share/games/openttd"' '-I'
'/home/rubidium/openttd/special/gcc-4.5/objs/release' '-I'
'/home/rubidium/openttd/special/gcc-4.5/objs/lang' '-c' '-o' 'misc_gui.o'
'-shared-libgcc' '-mtune=generic'
 /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/cc1plus -fpreprocessed
misc_gui.ii -quiet -dumpbase misc_gui.cpp -mtune=generic -auxbase-strip
misc_gui.o -O2 -Wall -Wno-multichar -Wsign-compare -Wundef -Wwrite-strings
-Wpointer-arith -Wno-uninitialized -W -Wno-unused-parameter -Wformat=2
-Wredundant-decls -Wcast-qual -version -fomit-frame-pointer
-fno-strict-aliasing -fno-strict-overflow -o misc_gui.s
GNU C++ (GCC) version 4.5.0 20090905 (experimental) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.5.0 20090904 (experimental), GMP version
4.3.1, MPFR version 2.4.1-p2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C++ (GCC) version 4.5.0 20090905 (experimental) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.5.0 20090904 (experimental), GMP version
4.3.1, MPFR version 2.4.1-p2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 7221e3a3fa11525f4d349f716eeef094
/home/rubidium/openttd/special/gcc-4.5/src/misc_gui.cpp: In member function
‘ErrmsgWindow::~ErrmsgWindow()’:
/home/rubidium/openttd/special/gcc-4.5/src/misc_gui.cpp:640:44: internal
compiler error: in expand_expr_real_1, at expr.c:8416


-- 
   Summary: [4.5] ICE: expand_expr_real_1, at expr.c:8416
   Product: gcc
   Version: 4.5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rubidium at openttd dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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



[Bug middle-end/41120] ICE segmentation fault (reading garbage collected data)

2009-08-19 Thread rubidium at openttd dot org


--- Comment #1 from rubidium at openttd dot org  2009-08-19 14:30 ---
Created an attachment (id=18402)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18402&action=view)
save-temps data


-- 


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



[Bug middle-end/41120] New: ICE segmentation fault (reading garbage collected data)

2009-08-19 Thread rubidium at openttd dot org
; '-O2' '-fomit-frame-pointer' '-DUNIX' '-Wall'
'-Wno-multichar' '-Wsign-compare' '-Wundef' '-Wwrite-strings' '-Wpointer-arith'
'-Wno-uninitialized' '-W' '-Wno-unused-parameter' '-Wformat=2'
'-Wredundant-decls' '-fno-strict-aliasing' '-Wcast-qual' '-fno-strict-overflow'
'-DWITH_ALLEGRO' '-I/usr/include' '-DWITH_SDL' '-I/usr/include/SDL'
'-D_REENTRANT' '-DWITH_ZLIB' '-D_SQ64'
'-I/home/rubidium/openttd/special/gcc-4.5/src/3rdparty/squirrel/include'
'-DWITH_PNG' '-I/usr/include/libpng12' '-DWITH_FONTCONFIG' '-DWITH_FREETYPE'
'-I/usr/include/freetype2' '-DWITH_ICU' '-D_REENTRANT' '-I/usr/include'
'-DENABLE_NETWORK' '-DWITH_PERSONAL_DIR' '-DPERSONAL_DIR=".openttd"'
'-DGLOBAL_DATA_DIR="/usr/local/share/games/openttd"' '-I'
'/home/rubidium/openttd/special/gcc-4.5/objs/release' '-I'
'/home/rubidium/openttd/special/gcc-4.5/objs/lang' '-c' '-o'
'blitter/32bpp_anim.o' '-shared-libgcc' '-mtune=generic'
 /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/cc1plus -fpreprocessed
32bpp_anim.ii -quiet -dumpbase 32bpp_anim.cpp -mtune=generic -auxbase-strip
blitter/32bpp_anim.o -O2 -Wall -Wno-multichar -Wsign-compare -Wundef
-Wwrite-strings -Wpointer-arith -Wno-uninitialized -W -Wno-unused-parameter
-Wformat=2 -Wredundant-decls -Wcast-qual -version -fomit-frame-pointer
-fno-strict-aliasing -fno-strict-overflow --param ggc-min-expand=0 --param
ggc-min-heapsize=0 -o 32bpp_anim.s
GNU C++ (GCC) version 4.5.0 20090819 (experimental) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.5.0 20090818 (experimental), GMP version
4.3.1, MPFR version 2.4.1-p2
GGC heuristics: --param ggc-min-expand=0 --param ggc-min-heapsize=0
GNU C++ (GCC) version 4.5.0 20090819 (experimental) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.5.0 20090818 (experimental), GMP version
4.3.1, MPFR version 2.4.1-p2
GGC heuristics: --param ggc-min-expand=0 --param ggc-min-heapsize=0
Compiler executable checksum: 8c0ab930274bdc39490cd94e5cc4d1b8
/home/rubidium/openttd/special/gcc-4.5/src/blitter/32bpp_anim.cpp:14:27:
internal compiler error: Segmentation fault



Valgrind run:
GNU C++ (GCC) version 4.5.0 20090819 (experimental) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.5.0 20090818 (experimental), GMP version
4.3.1, MPFR version 2.4.1-p2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory
"/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../x86_64-unknown-linux-gnu/include"
ignoring duplicate directory "/usr/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/usr/include"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/SDL
 /home/rubidium/openttd/special/gcc-4.5/src/3rdparty/squirrel/include
 /usr/include/libpng12
 /usr/include/freetype2
 /home/rubidium/openttd/special/gcc-4.5/objs/release
 /home/rubidium/openttd/special/gcc-4.5/objs/lang

/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0

/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/x86_64-unknown-linux-gnu

/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/backward
 /usr/local/include
 /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/include
 /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/include-fixed
 /usr/include
End of search list.
GNU C++ (GCC) version 4.5.0 20090819 (experimental) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.5.0 20090818 (experimental), GMP version
4.3.1, MPFR version 2.4.1-p2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 8c0ab930274bdc39490cd94e5cc4d1b8
==4305== Invalid read of size 2
==4305==at 0x51514D: is_empty_class (class.c:6524)
==4305==by 0x482E70: build_call_a (call.c:356)
==4305==by 0x483FF2: build_cxx_call (call.c:5782)
==4305==by 0x48D5BF: build_over_call (call.c:5770)
==4305==by 0x48F8D4: build_new_method_call (call.c:6330)
==4305==by 0x6DC43EF: ???
==4305==by 0x2: ???
==4305==  Address 0xa5a5a5a5a5a5a5a5 is not stack'd, malloc'd or (recently)
free'd
/home/rubidium/openttd/special/gcc-4.5/src/blitter/32bpp_anim.cpp:14:27:
internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


-- 
   Summary: ICE segmentation fault (reading garbage collected data)
   Product: gcc
   Version: 4.5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rubidium at openttd dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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



[Bug middle-end/38509] Bogus "attempt to free a non-heap object" warning

2009-07-25 Thread rubidium at openttd dot org


--- Comment #2 from rubidium at openttd dot org  2009-07-25 23:28 ---
Is there a way to disable this warning?

I've searched the manual and gcc -v --help for 'heap' and 'free'. Neither
keyword showed any promising compiler flags.

I've also looked in the code, but I cannot find a variable (like
warn_parentheses) that enables/disables the warning.


-- 


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



[Bug lto/40681] [ICE] expand_expr_real_1, at expr.c:7382

2009-07-08 Thread rubidium at openttd dot org


--- Comment #1 from rubidium at openttd dot org  2009-07-08 10:42 ---
Created an attachment (id=18156)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18156&action=view)
The .ii file of save-temps


-- 


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



[Bug lto/40681] New: [ICE] expand_expr_real_1, at expr.c:7382

2009-07-08 Thread rubidium at openttd dot org
 '-Wundef' '-Wwrite-strings'
'-Wpointer-arith' '-Wno-uninitialized' '-W' '-Wno-unused-parameter'
'-Wformat=2' '-Wredundant-decls' '-fno-strict-aliasing' '-Wcast-qual'
'-fno-strict-overflow' '-DWITH_SDL' '-I/usr/include/SDL' '-D_REENTRANT'
'-DWITH_ZLIB' '-D_SQ64'
'-I/home/rubidium/openttd/special/lto/src/3rdparty/squirrel/include'
'-DWITH_PNG' '-I/usr/include/libpng12' '-DWITH_FONTCONFIG' '-DWITH_FREETYPE'
'-I/usr/include/freetype2' '-DWITH_ICU' '-D_REENTRANT' '-I/usr/include'
'-DENABLE_NETWORK' '-DWITH_PERSONAL_DIR' '-DPERSONAL_DIR=".openttd"'
'-DGLOBAL_DATA_DIR="/usr/local/share/games/openttd"' '-I'
'/home/rubidium/openttd/special/lto/objs/release' '-I'
'/home/rubidium/openttd/special/lto/objs/lang' '-c' '-o' 'misc_gui.o'
'-shared-libgcc' '-mtune=generic'
 /usr/local/lto/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/cc1plus
-fpreprocessed misc_gui.ii -quiet -dumpbase misc_gui.cpp -mtune=generic
-auxbase-strip misc_gui.o -O2 -Wall -Wno-multichar -Wsign-compare -Wundef
-Wwrite-strings -Wpointer-arith -Wno-uninitialized -W -Wno-unused-parameter
-Wformat=2 -Wredundant-decls -Wcast-qual -version -fomit-frame-pointer -flto
-fno-strict-aliasing -fno-strict-overflow -o misc_gui.s
GNU C++ (lto merged with rev 149291) version 4.5.0 20090706 (experimental)
(x86_64-unknown-linux-gnu)
compiled by GNU C version 4.5.0 20090706 (experimental), GMP version
4.3.1, MPFR version 2.4.1-p2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C++ (lto merged with rev 149291) version 4.5.0 20090706 (experimental)
(x86_64-unknown-linux-gnu)
compiled by GNU C version 4.5.0 20090706 (experimental), GMP version
4.3.1, MPFR version 2.4.1-p2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 1b221bba280fd5b5d5f51d82d51ad25c
/home/rubidium/openttd/special/lto/src/misc_gui.cpp: In member function
‘__comp_dtor ’:
/home/rubidium/openttd/special/lto/src/misc_gui.cpp:590:44: internal compiler
error: in expand_expr_real_1, at expr.c:7382
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


-- 
   Summary: [ICE] expand_expr_real_1, at expr.c:7382
   Product: gcc
   Version: lto
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: lto
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rubidium at openttd dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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



[Bug lto/39003] internal compiler error: in output_parm_decl, at lto-function-out.c:2652

2009-07-08 Thread rubidium at openttd dot org


--- Comment #3 from rubidium at openttd dot org  2009-07-08 09:12 ---
I cannot reproduce this error anymore in gcc-lto (lto merged with rev 149291)
4.5.0 20090706 (experimental) revision 149340.

However... I don't have the setup I've ran the previous test on, as such I have
build it with another compiler for another platform (x86_64).

On the other hand I'm hitting another internal compiler error in
expand_expr_real_1, at expr.c:7382. But I'm not sure whether this is trunk or
lto; I'm recompiling trunk right now though that takes a while. I'll open a new
bug report for lto if it's really lto only.


-- 


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



[Bug c++/39003] internal compiler error: in output_parm_decl, at lto-function-out.c:2652

2009-01-28 Thread rubidium at openttd dot org


--- Comment #1 from rubidium at openttd dot org  2009-01-28 14:42 ---
Created an attachment (id=17199)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17199&action=view)
result of gcc -save-temps


-- 


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



[Bug c++/39003] New: internal compiler error: in output_parm_decl, at lto-function-out.c:2652

2009-01-28 Thread rubidium at openttd dot org
t;'
'-DGLOBAL_DATA_DIR="/usr/local/share/games/openttd"' '-I'
'/home/rubidium/openttd/clean3/objs/release' '-I'
'/home/rubidium/openttd/clean3/objs/lang' '-c' '-o' 'ai/ai_scanner.o'
'-shared-libgcc' '-mtune=generic' '-march=pentium-m'
 /usr/local/libexec/gcc/i686-pc-linux-gnu/4.4.0/cc1plus -fpreprocessed
ai_scanner.ii -quiet -dumpbase ai_scanner.cpp -mtune=generic -march=pentium-m
-auxbase-strip ai/ai_scanner.o -O2 -Wall -Wno-multichar -Wsign-compare -Wundef
-Wwrite-strings -Wpointer-arith -Wno-uninitialized -W -Wno-unused-parameter
-Wformat=2 -Wredundant-decls -version -fomit-frame-pointer -flto
-fno-strict-aliasing -fno-strict-overflow -o ai_scanner.s
GNU C++ (lto merged with rev 143693) version 4.4.0 20090127 (experimental)
(i686-pc-linux-gnu)
compiled by GNU C version 4.4.0 20090127 (experimental), GMP version
4.2.2, MPFR version 2.3.2.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 8dc3a8f7c812ab555f35789c3c3138c0
/home/rubidium/openttd/clean3/src/ai/ai_scanner.cpp:21: internal compiler
error: in output_parm_decl, at lto-function-out.c:2652
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


-- 
   Summary: internal compiler error: in output_parm_decl, at lto-
function-out.c:2652
   Product: gcc
   Version: lto
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rubidium at openttd dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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



[Bug c++/38509] New: Bogus "attempt to free a non-heap object" warning

2008-12-12 Thread rubidium at openttd dot org
class TestCase {
private:
  const int *pointer;

public:
  TestCase() {
static int non_heap = 0;
this->pointer = &non_heap;
  }

  ~TestCase() {
if (*this->pointer != 0) __builtin_free(const_cast(this->pointer));
  }
};

int main(int argc, const char *argv[]) {
 TestCase test;
 return 0;
}

/*

The code above, compiled g++ 4.4.0 with -O1 (or any -On except -O0) gives the
following warning:
test.cpp: In function ‘int main(int, const char**)’:
test.cpp:12: warning: attempt to free a non-heap object ‘non_heap’

In this case the warning is bogus because the "free" can never be reached.

Complete command line:
g++ -O1 -o test test.cpp

Output from "g++ -v -O1 -o test test.cpp":
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../configure --with-arch=pentium-m --enable-threads
--enable-languages=c,c++
Thread model: posix
gcc version 4.4.0 20081210 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-v' '-O1' '-o' 'test' '-shared-libgcc' '-mtune=generic'
'-march=pentium-m'
 /usr/local/libexec/gcc/i686-pc-linux-gnu/4.4.0/cc1plus -quiet -v -D_GNU_SOURCE
test.cpp -quiet -dumpbase test.cpp -mtune=generic -march=pentium-m -auxbase
test -O1 -version -o /tmp/ccIffeq5.s
ignoring nonexistent directory
"/usr/local/lib/gcc/i686-pc-linux-gnu/4.4.0/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.4.0/../../../../include/c++/4.4.0

/usr/local/lib/gcc/i686-pc-linux-gnu/4.4.0/../../../../include/c++/4.4.0/i686-pc-linux-gnu

/usr/local/lib/gcc/i686-pc-linux-gnu/4.4.0/../../../../include/c++/4.4.0/backward
 /usr/local/include
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.4.0/include
 /usr/local/lib/gcc/i686-pc-linux-gnu/4.4.0/include-fixed
 /usr/include
End of search list.
GNU C++ (GCC) version 4.4.0 20081210 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 4.4.0 20081210 (experimental), GMP version
4.2.2, MPFR version 2.3.2.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: b043f60097b3fa3e759e89265ea8ebdb
test.cpp: In function ‘int main(int, const char**)’:
test.cpp:12: warning: attempt to free a non-heap object ‘non_heap’
COLLECT_GCC_OPTIONS='-v' '-O1' '-o' 'test' '-shared-libgcc' '-mtune=generic'
'-march=pentium-m'
 as -V -Qy -o /tmp/ccshvEr5.o /tmp/ccIffeq5.s
GNU assembler version 2.18.0 (i486-linux-gnu) using BFD version (GNU Binutils
for Debian) 2.18.0.20080103
COMPILER_PATH=/usr/local/libexec/gcc/i686-pc-linux-gnu/4.4.0/:/usr/local/libexec/gcc/i686-pc-linux-gnu/4.4.0/:/usr/local/libexec/gcc/i686-pc-linux-gnu/:/usr/local/lib/gcc/i686-pc-linux-gnu/4.4.0/:/usr/local/lib/gcc/i686-pc-linux-gnu/
LIBRARY_PATH=/usr/local/lib/gcc/i686-pc-linux-gnu/4.4.0/:/usr/local/lib/gcc/i686-pc-linux-gnu/4.4.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-O1' '-o' 'test' '-shared-libgcc' '-mtune=generic'
'-march=pentium-m'
 /usr/local/libexec/gcc/i686-pc-linux-gnu/4.4.0/collect2 --eh-frame-hdr -m
elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o test /usr/lib/crt1.o
/usr/lib/crti.o /usr/local/lib/gcc/i686-pc-linux-gnu/4.4.0/crtbegin.o
-L/usr/local/lib/gcc/i686-pc-linux-gnu/4.4.0
-L/usr/local/lib/gcc/i686-pc-linux-gnu/4.4.0/../../.. /tmp/ccshvEr5.o -lstdc++
-lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/local/lib/gcc/i686-pc-linux-gnu/4.4.0/crtend.o /usr/lib/crtn.o


Note: this is a self-compiled binary of SVN revision 142654.
*/


-- 
   Summary: Bogus "attempt to free a non-heap object" warning
   Product: gcc
   Version: 4.4.0
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rubidium at openttd dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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