Red Hat Bugzilla – Bug 132730
std::numeric_limits<long>::max() is -1 with -m32 flag
Last modified: 2007-11-30 17:07:04 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.4.3)
Description of problem:
The value of std::numeric_limits<long>::max() when compiled with the
x86_64 compiler, with the -m32 flag to produce i386 code, is -1.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.Create this file:
int main(int argc, char **argv)
std::cout << std::numeric_limits<long>::max() << std::endl;
2.Compile with "c++ -m32 h.cc -o h"
3.Run with "./h"
Actual Results: -1
Expected Results: 2147483647
This is fixed properly in GCC 3.3 and above, unfortunately GCC 3.2
lacks the necessary infrastructure.
Guess some hack in std_limits.h will be needed.
Should be fixed in gcc-3.2.3-46 which ought to show up in U4 beta.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.