[Bug c/59939] No warning on signedness changes caused by implicit conversion

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jan 25 03:47:00 GMT 2014


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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Chengnian Sun from comment #5)
> (In reply to Andrew Pinski from comment #4)
> > (In reply to Chengnian Sun from comment #3)
> > > (In reply to Andrew Pinski from comment #1)
> > > > IIRC this was done so that code which uses macros and have conditional code
> > > > like:
> > > > 
> > > > MACRO1 || fn1(a, b)
> > > 
> > > Sorry, I do not understand. Can you elaborate more? Why it is related to
> > > macros
> > > and what is the rational behind this design.
> > 
> > Lets say 1 was really MACRO1 defined by:
> > #define MACRO1 0
> > or
> > #define MACRO1 1
> > 
> > and you have some typedefs which 
> > 
> > And then you use that macro below and you get the warning.
> 
> 
> 
> Thanks for your reply. I am still not sure whether I got you correctly. I
> thought after preprocessing, all the constant macros will be expanded. 
> 
> Following your instructions, I replaced 1 with MACRO1 ("#define MACRO1 1",
> and "MACRO1 || fn1(a, b)"), but Gcc still does not warn. I also checked old
> versions of Gcc, and 4.2 warns. 

No that is exactly what I am saying the whole point is the 1/0 could be hidden
and we don't want to warn when it is 1 as the types of fn1/a/b could change
based on the macro value.



More information about the Gcc-bugs mailing list