public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48519] New: wrong return-value, with an if () {} after return
@ 2011-04-08 18:25 hilmar.ackermann at googlemail dot com
  2011-04-08 18:32 ` [Bug c++/48519] " redi at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: hilmar.ackermann at googlemail dot com @ 2011-04-08 18:25 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: hilmar.ackermann@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 <iostream>
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-04-13  9:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-08 18:25 [Bug c++/48519] New: wrong return-value, with an if () {} after return hilmar.ackermann at googlemail dot com
2011-04-08 18:32 ` [Bug c++/48519] " redi at gcc dot gnu.org
2011-04-08 18:34 ` hilmar.ackermann at googlemail dot com
2011-04-08 18:35 ` hilmar.ackermann at googlemail dot com
2011-04-08 18:36 ` [Bug target/48519] " pinskia at gcc dot gnu.org
2011-04-08 18:41 ` hilmar.ackermann at googlemail dot com
2011-04-12 11:00 ` ktietz at gcc dot gnu.org
2011-04-12 13:41 ` hilmar.ackermann at googlemail dot com
2011-04-12 19:32 ` d.g.gorbachev at gmail dot com
2011-04-12 19:45 ` ktietz at gcc dot gnu.org
2011-04-13  9:07 ` hilmar.ackermann at googlemail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).