[Bug c/92857] -Wsign-conversion flag issues false positives for expression using typedef'ed unsigned types

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Dec 9 17:32:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92857

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Joshua Saxby from comment #2)
> (In reply to Richard Biener from comment #1)
> > I think the warning is about foo - bar being carried out in type 'int' due to
> > integer promotion and that converted to size_t which may turn the negative
> > result into a positive.
> 
> That could be the issue, although I would expect the integer promotion to
> promote to an unsigned integer type rather than a signed one. Am I mistaken
> in this assumption?

YES you are.  If a type is smaller than int and fits into int, then it is
prompoted to int (and not unsigned int).


More information about the Gcc-bugs mailing list