Red Hat Bugzilla – Bug 500234
[RFE] Customer wants RHEL 5 gcc to detect and warn on downconversion from 64 to 32 bit
Last modified: 2014-06-18 04:46:43 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
Created attachment 343499 [details]
First of patches to solve issue
Created attachment 343500 [details]
Second of patches to solve issue
Created attachment 343501 [details]
Third of patches to solve issue
Note that all three patches are necessary in order.
size_t l = 4232929292;
unsigned short s = l ;
This code block corresponds to the above message.
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?
I will ask
(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
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.