[Bug c++/47749] New: Wrong function return value
elpa.rizzo at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Feb 15 09:08:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47749
Summary: Wrong function return value
Product: gcc
Version: 4.4.4
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: elpa.rizzo@gmail.com
This function returns always false, also if parameter is true
Target is: arm-unknown-linux-uclibc
If you:
- define string s inside if loop
- or instance string s as static
- or add an explicit final return statement
- or don't use string s
the function works correctly.
Examining the source code, one unwinding assembler statement is missing.
#include <string>
using namespace std;
bool fn_bad(bool flag)
{
string s;
if(flag)
{
s = "A";
return true;
}
}
More information about the Gcc-bugs
mailing list