http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51625

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #5 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-29 
21:56:23 UTC ---
(In reply to comment #4)
> I run into this problem today too.  Why gcc do not warning by default when we
> assign a double to a int?  This is even not warned by Wall and Wextra.  If you
> google the internet, you will find there are many users asking this question.

So, what do you think should happen in this case?
 double d = 1.0;
  int i;
  i = d; 

Should we warn?

> > This tied with the fact that there is no data-flow in front-ends (see next 
> > question) results in hard to avoid warnings for perfectly working and valid 
> > code.
> 
> This is not convincing for me.  Since I think you should do these conversion
> explicitly to tell others you know what you are doing.

-Wconversion warns for a lot of things that are perfectly ok. If you compile
any large project with it (like the Linux kernel), there are lots of invalid
warnings. Moreover, there are cases where it is difficult to avoid the warning.
See PR 39170.

> I hope that there is a day that the developer can change their mind on this
> question:)

If the accuracy of Wconversion improves enough... One prerequisite is to find a
fix for PR 39170. Another would be to find a way to avoid warning for the case
above. There are more PRs related to Wconversion. You can help to fix them.
Please, see: http://gcc.gnu.org/contribute.html

Reply via email to