[Bug c++/48519] New: wrong return-value, with an if () {} after return

2011-04-08 Thread hilmar.ackermann at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48519

   Summary: wrong return-value, with an if () {} after return
   Product: gcc
   Version: 4.4.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: hilmar.ackerm...@googlemail.com


Created attachment 23932
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23932
the *.ii created with -save-temps

Hi,

first my bug is: I have a function with a return, but the function is not
returning the right value, when I write the function like in the example given
at the end of the report. I already asked in a forum of help and they say, in
other c++ compilers it works fine. ;)

you wrote some things to have in an error bug, so I will try to report it
correct, I'm sorry if I did something wrong, but I'm not so good in all this 
..

"the exact version of GCC;
the system type;
the options given when GCC was configured/built;"

the ouput of gcc -v:

"Target: mingw32
Configured with: ../../gcc-4.4.1/configure --prefix=/mingw --build=mingw32
--ena
ble-languages=c,ada,c++,fortran,objc,obj-c++ --disable-nls
--disable-win32-regis
try --enable-libgomp --enable-cxx-flags='-fno-function-sections
-fno-data-sectio
ns' --disable-werror --enable-threads --disable-symvers
--enable-version-specifi
c-runtime-libs --enable-fully-dynamic-string --with-pkgversion='TDM-2 mingw32'
-
-enable-sjlj-exceptions --with-bugurl=http://www.tdragon.net/recentgcc/bugs.php
Thread model: win32"

"the complete command line that triggers the bug;"
I'm not sure, I'm using the preconfigured MinGW of Code::Blocks, I think you
mean this command line (?):
mingw32-g++.exe -Wall  -g  -g   -IC:\Programme\wxWidgets-2.8.12\include  -c
"C:\Dateien\projekte\c++ programme\tests\testblub\main.cpp" -o obj\Debug\main.o
mingw32-g++.exe -LC:\Programme\wxWidgets-2.8.12\include  -o
bin\Debug\testblub.exe obj\Debug\main.o   
C:\Programme\CodeBlocks\MinGW\lib\OpenAL32.lib
C:\Programme\CodeBlocks\MinGW\lib\alut.lib
C:\Programme\CodeBlocks\MinGW\lib\corona.lib
C:\Programme\CodeBlocks\MinGW\lib\libpangowin32-1.0.dll.a
C:\Programme\CodeBlocks\MinGW\lib\libSDL.dll.a
C:\Programme\CodeBlocks\MinGW\lib\libSDLmain.a

"the compiler output (error messages, warnings, etc.);"
[...]\main.cpp||In function 'int TestFct()':|
[...]\main.cpp|12|warning: control reaches end of non-void function|
||=== Build finished: 0 errors, 1 warnings ===|

"the preprocessed file (*.i*) that triggers the bug, generated by adding
-save-temps to the complete compilation command, or, in the case of a bug
report for the GNAT front end, a complete set of source files (see below)."
the *.ii is attached..

the whole source-code by the way is:

"#include 
using namespace std;

int test1 = 4;

int TestFct (void)
{
string test2;//if this line will be commented out,
everything works fine
cout << "abc" << endl;   //if this line will be commented out,
everything works fine
return 10;
if (test1 == 3) {}   //if this line will be commented out,
everything works fine
}

int main(void)
{
cout << TestFct() << endl;
}
"


regards


[Bug c++/48519] wrong return-value, with an if () {} after return

2011-04-08 Thread hilmar.ackermann at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48519

--- Comment #2 from Herbert  2011-04-08 
18:34:31 UTC ---
it prints 206000. maybe the bug is already fixed in a newer version!? Which
version have you?

regards


[Bug c++/48519] wrong return-value, with an if () {} after return

2011-04-08 Thread hilmar.ackermann at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48519

--- Comment #3 from Herbert  2011-04-08 
18:35:35 UTC ---
oh, sorry, you already wrote it o.O


[Bug target/48519] wrong return-value, with an if () {} after return

2011-04-08 Thread hilmar.ackermann at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48519

--- Comment #5 from Herbert  2011-04-08 
18:41:35 UTC ---
by the way, I can replace "string test2;" with "vector  test2;" as
example, and there is the same bug..


[Bug target/48519] wrong return-value, with an if () {} after return

2011-04-12 Thread hilmar.ackermann at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48519

--- Comment #7 from Herbert  2011-04-12 
13:41:06 UTC ---
Hi,

I don't know why I am the only one with the bug ..? The bug doesn't happen if I
write a second return at the end of the function, so I can solve the problem,
but anyway it's curious.. Maybe someone with the integrated installation of
MinGW in Code::Blocks can test this, perhaps there is a bug, don't know ..  ;)

regards


[Bug target/48519] wrong return-value, with an if () {} after return

2011-04-13 Thread hilmar.ackermann at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48519

--- Comment #10 from Herbert  
2011-04-13 09:07:04 UTC ---
ah ok, thank you very much, this was the bug ;)

regards