Bug 132730 - std::numeric_limits<long>::max() is -1 with -m32 flag
Summary: std::numeric_limits<long>::max() is -1 with -m32 flag
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: gcc
Version: 3.0
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2004-09-16 14:06 UTC by Göran Uddeborg
Modified: 2007-11-30 22:07 UTC (History)
2 users (show)

Clone Of:
Last Closed: 2004-12-21 21:02:05 UTC

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2004:584 normal SHIPPED_LIVE Updated gcc packages 2004-12-21 05:00:00 UTC

Description Göran Uddeborg 2004-09-16 14:06:02 UTC
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 20:01:32 UTC
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 13:20:43 UTC
Should be fixed in gcc-3.2.3-46 which ought to show up in U4 beta.

Comment 3 John Flanagan 2004-12-21 21:02:05 UTC
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.