Bug 500234

Summary: [RFE] Customer wants RHEL 5 gcc to detect and warn on downconversion from 64 to 32 bit
Product: Red Hat Enterprise Linux 5 Reporter: Casey Dahlin <cdahlin>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED WONTFIX QA Contact: BaseOS QE <qe-baseos-auto>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.3CC: james.leddy, vanhoof
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-25 17:39:08 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:
Attachments:
Description Flags
First of patches to solve issue
none
Second of patches to solve issue
none
Third of patches to solve issue none

Description Casey Dahlin 2009-05-11 20:08:12 UTC
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 20:08:45 UTC
Created attachment 343499 [details]
First of patches to solve issue

Comment 2 Casey Dahlin 2009-05-11 20:09:27 UTC
Created attachment 343500 [details]
Second of patches to solve issue

Comment 3 Casey Dahlin 2009-05-11 20:10:09 UTC
Created attachment 343501 [details]
Third of patches to solve issue

Comment 4 Casey Dahlin 2009-05-11 20:10:36 UTC
Note that all three patches are necessary in order.

Comment 6 James M. Leddy 2009-05-11 21:20:59 UTC
#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 21:30:35 UTC
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 21:35:36 UTC
I will ask

Comment 9 James M. Leddy 2009-05-11 21:42:48 UTC
(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.