This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/25155] New: Base type of expressions involving short operands is shown as int
- From: "santhosh dot selvaraj at wipro dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Nov 2005 16:05:35 -0000
- Subject: [Bug c/25155] New: Base type of expressions involving short operands is shown as int
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I don't know whether it is a bug or not.
Consider the following example:
short int sh1 = 1;
short int sh2 = 2;
printf("Size of short: %d\n", sizeof(short));
printf("Size of int: %d\n", sizeof(int));
printf("Size of expr: %d\n", sizeof(sh1+sh2));
Output:
Size of short: 2
Size of int: 4
Size of expr: 4
GCC is converting short to int while doing any arithmatic operation. Can anyone
explain why it is happening and where exactly(function) does this conversion
happen?
--
Summary: Base type of expressions involving short operands is
shown as int
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: santhosh dot selvaraj at wipro dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25155