Patchwork Changing INT to SI mode

login
register
mail settings
Submitter K_s, Vishnu
Date March 28, 2014, 1:23 p.m.
Message ID <512195FE6C78B243B073F23FF584A73361F93A85@penmbx01>
Download mbox | patch
Permalink /patch/334693/
State New
Headers show

Comments

K_s, Vishnu - March 28, 2014, 1:23 p.m.
Test pr59940.c is failing for AVR target because the test assumes the size
of int as 32 bit and test expect to generate warnings for overflow and
conversion while assigning 36-bit and 32 bit value respectively to variable si.
Following patch define a 32 bit type with SI mode and use it.

2014-03-28  Vishnu K S <Vishnu.k_s@atmel.com >

	* gcc/testsuite/gcc.dg/pr59940.c: Using 32-bit SI mode instead of int
Mike Stump - March 28, 2014, 7:18 p.m.
On Mar 28, 2014, at 6:23 AM, K_s, Vishnu <Vishnu.K_s@atmel.com> wrote:
> Test pr59940.c is failing for AVR target because the test assumes the size
> of int as 32 bit and test expect to generate warnings for overflow and
> conversion while assigning 36-bit and 32 bit value respectively to variable si.
> Following patch define a 32 bit type with SI mode and use it.
> 
> 2014-03-28  Vishnu K S <Vishnu.k_s@atmel.com >
> 
> 	* gcc/testsuite/gcc.dg/pr59940.c: Using 32-bit SI mode instead of int

[ see previous note ]

Ok.


I checked this in for you, and formatted the ChangeLog slightly better.  Two spaces after the name, no space before the >, no gcc/testsuite in the log, end sentence with a period, add name of what was changed (si in this case).

+2014-03-28  Vishnu K S  <Vishnu.k_s@atmel.com>
+
+	* gcc.dg/pr59940.c (si): Use 32-bit SI mode instead of int.
Richard Guenther - March 31, 2014, 8:11 a.m.
On Fri, Mar 28, 2014 at 8:18 PM, Mike Stump <mikestump@comcast.net> wrote:
> On Mar 28, 2014, at 6:23 AM, K_s, Vishnu <Vishnu.K_s@atmel.com> wrote:
>> Test pr59940.c is failing for AVR target because the test assumes the size
>> of int as 32 bit and test expect to generate warnings for overflow and
>> conversion while assigning 36-bit and 32 bit value respectively to variable si.
>> Following patch define a 32 bit type with SI mode and use it.
>>
>> 2014-03-28  Vishnu K S <Vishnu.k_s@atmel.com >
>>
>>       * gcc/testsuite/gcc.dg/pr59940.c: Using 32-bit SI mode instead of int
>
> [ see previous note ]
>
> Ok.
>
>
> I checked this in for you, and formatted the ChangeLog slightly better.  Two spaces after the name, no space before the >, no gcc/testsuite in the log, end sentence with a period, add name of what was changed (si in this case).

IMHO instead of mode(SI) you should use int32_t (or __INT32_TYPE__
conveniently defined by gcc).

Richard.

> +2014-03-28  Vishnu K S  <Vishnu.k_s@atmel.com>
> +
> +       * gcc.dg/pr59940.c (si): Use 32-bit SI mode instead of int.

Patch

diff --git a/gcc/testsuite/gcc.dg/pr59940.c b/gcc/testsuite/gcc.dg/pr59940.c
index b0fd17f..21d93ad 100644
--- a/gcc/testsuite/gcc.dg/pr59940.c
+++ b/gcc/testsuite/gcc.dg/pr59940.c
@@ -3,11 +3,12 @@ 
 /* { dg-options "-Wconversion -Woverflow" } */

 int f (unsigned int);
+typedef sitype __attribute__((mode(SI)));

 int
 g (void)
 {
-  int si = 12;
+  sitype si = 12;
   unsigned int ui = -1; /* { dg-warning "21:negative integer implicitly converted to unsigned type" } */
   unsigned char uc;
   ui = si; /* { dg-warning "8:conversion" } */