Bug 132730 - std::numeric_limits<long>::max() is -1 with -m32 flag
std::numeric_limits<long>::max() is -1 with -m32 flag
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: gcc (Show other bugs)
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2004-09-16 10:06 EDT by Göran Uddeborg
Modified: 2007-11-30 17:07 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-12-21 16:02:05 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Göran Uddeborg 2004-09-16 10:06:02 EDT
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):

How reproducible:

Steps to Reproduce:
1.Create this file:

#include <iostream>
#include <limits>
#include <climits>

int main(int argc, char **argv)
  std::cout << std::numeric_limits<long>::max() << std::endl;
  return 0;

2.Compile with "c++ -m32 h.cc -o h"
3.Run with "./h"

Actual Results:  -1

Expected Results:  2147483647
Comment 1 Jakub Jelinek 2004-10-05 16:01:32 EDT
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.
Comment 2 Jakub Jelinek 2004-10-07 09:20:43 EDT
Should be fixed in gcc-3.2.3-46 which ought to show up in U4 beta.
Comment 3 John Flanagan 2004-12-21 16:02:05 EST
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.


Note You need to log in before you can comment on or make changes to this bug.