Bug 132730

Summary: std::numeric_limits<long>::max() is -1 with -m32 flag
Product: Red Hat Enterprise Linux 3 Reporter: Göran Uddeborg <goeran>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: bkoz, djuran
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-12-21 21:02:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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)
Gecko/20040803

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):
gcc-3.2.3-42

How reproducible:
Always

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.

http://rhn.redhat.com/errata/RHBA-2004-584.html