Bug 500234 - [RFE] Customer wants RHEL 5 gcc to detect and warn on downconversion from 64 to 32 bit
[RFE] Customer wants RHEL 5 gcc to detect and warn on downconversion from 64 ...
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gcc (Show other bugs)
5.3
All Linux
medium Severity medium
: rc
: ---
Assigned To: Jakub Jelinek
BaseOS QE
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-11 16:08 EDT by Casey Dahlin
Modified: 2014-06-18 04:46 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-09-25 13:39:08 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
First of patches to solve issue (25.65 KB, patch)
2009-05-11 16:08 EDT, Casey Dahlin
no flags Details | Diff
Second of patches to solve issue (18.50 KB, patch)
2009-05-11 16:09 EDT, Casey Dahlin
no flags Details | Diff
Third of patches to solve issue (922 bytes, patch)
2009-05-11 16:10 EDT, Casey Dahlin
no flags Details | Diff

  None (edit)
Description Casey Dahlin 2009-05-11 16:08:12 EDT
Current upstream GCC will generate warnings such as the following with the -Wconversion flag:

[root@localhost ~]# LANG=C gcc -Wconversion tmp.c
tmp.c: In function 'main':
tmp.c:10: warning: conversion to 'short unsigned int' from 'size_t' may alter its value

One of our customers would like this feature to appear in RHEL 5 as well. The patches attached will accomplish this. They apply cleanly to 4.1.2-44
Comment 1 Casey Dahlin 2009-05-11 16:08:45 EDT
Created attachment 343499 [details]
First of patches to solve issue
Comment 2 Casey Dahlin 2009-05-11 16:09:27 EDT
Created attachment 343500 [details]
Second of patches to solve issue
Comment 3 Casey Dahlin 2009-05-11 16:10:09 EDT
Created attachment 343501 [details]
Third of patches to solve issue
Comment 4 Casey Dahlin 2009-05-11 16:10:36 EDT
Note that all three patches are necessary in order.
Comment 6 James M. Leddy 2009-05-11 17:20:59 EDT
#include <stdio.h>
#include <inttypes.h>




int main()
{
  size_t l = 4232929292;
  unsigned short s = l ;
}



This code block corresponds to the above message.
Comment 7 Jakub Jelinek 2009-05-11 17:30:35 EDT
We can't change the behavior of a -W* option that way in a stable gcc, that would break code that relies on the old -Wconversion behavior (especially when using -Werror).

Can't the customer just use gcc43 (or gcc44 in RHEL5.4) if they want such diagnostics?
Comment 8 James M. Leddy 2009-05-11 17:35:36 EDT
I will ask
Comment 9 James M. Leddy 2009-05-11 17:42:48 EDT
(In reply to comment #7)
> We can't change the behavior of a -W* option that way in a stable gcc, that
> would break code that relies on the old -Wconversion behavior (especially when
> using -Werror).
> 
> Can't the customer just use gcc43 (or gcc44 in RHEL5.4) if they want such
> diagnostics?  

Since these items are tech preview and not guaranteed to work with older binutils, this may require the customer to compile once to check conversion, and again for the binaries.  Obviously this is less than ideal.

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