This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Possible issue with integer promotion for << and >> in gcc.4.5.3


On Tue, Dec 18, 2012 at 2:39 PM, Arthur Schwarz <aschwarz1309@att.net> wrote:
>
> I have run some tests to determine the gcc 4.5.3 integer promotion policies.


This message is not appropriate for the mailing list gcc@gcc.gnu.org,
which is for the development of GCC itself.  It would be appropriate
on the mailing list gcc-help@gcc.gnu.org.  Please take any followups
to gcc-help@gcc.gnu.org.  Thanks.


The integer promotion policies are the ones specified in the language standard.


> The
> tests show that for 'char' input, "char << long" and "char >> long" promote to
> INT while other operations using a long promote to" long", and that  "char <<
> ulong" and "char >> ulong" promote to INT while other operations using ulong
> promote to "ulong". In similar fashion, "long << long" and "long >> long"
> promote to INT while other promotions are to long, and that "long << ulong" and
> "long >> ulong" promote to long while other operations promote to ulong. The
> code used and the  output are included below.

The shift operators produce a value of the same type as the left
operand, subject to the usual integer promotions.  You say in the
paragraph above that long << long promotes to INT, but that sounds
unlikely, and I don't see any support for that in the program output
that you showed.

You suggest that there is a bug somewhere, but I don't see one.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]