Affects Version/s: None
Fix Version/s: None
Dear Sun Studio Developer,
Thank you for your interest in improving the quality of Sun Studio
Your report has been assigned an internal review ID of 1254911.
Please be aware that the large volume of reports we receive sometimes
prevents us from responding individually to each message.
If the information is determined to be a new Bug or Request for
Enhancement (RFE), or a duplicate of a known Bug or RFE, you will
receive a followup email containing a seven digit bug number. By
using this seven digit bug number, you may search for, view, or vote
for this bug in the Bug Database at http://bugs.sun.com/. Please note
that we cannot promise to fix all reported bugs.
If you just reported an issue that could have a major impact on your
project and require a timely response, please consider purchasing
one of the support offerings described at
Sun Studio Developer Bug Report Review Team
Date Created: Fri May 23 11:23:54 MDT 2008
Customer Name: Martin Sebor
Customer Email: sebor AT roguewave DOT com
Company: Rogue Wave Software
Synopsis: truncwarn on safe code
FULL PRODUCT VERSION :
ADDITIONAL OS VERSION INFORMATION :
A DESCRIPTION OF THE PROBLEM :
The compiler issues conversion warnings for obviously safe code. For instance, the initialization:
on line 2 below cannot cause truncation since the result of the & operator is guaranteed to be in range of unsigned int (on both ILP32 and LP64), even though the type of the initializer expression is wider than the object under initialization.
The compiler should detect these cases and avoid issuing warnings for them.
In addition, as the Error Message(s) show, all the warnings are unnecessarily duplicated.
Finally, declaring each object const silences the warnings. The warnings should be issued consistently, regardless of any cv-qualifiers.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile attached program as follows:
EXPECTED VERSUS ACTUAL BEHAVIOR :
No conversion (truncation) warnings.
Conversion (truncation) warnings.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
---------- END SOURCE ----------
comments: (company - Rogue Wave Software , email - firstname.lastname@example.org)