diff mbox

Fix a -Wnarrowing warning in Fortran FE

Message ID 20170725085326.GP2123@tucnak
State New
Headers show

Commit Message

Jakub Jelinek July 25, 2017, 8:53 a.m. UTC
Hi!

I've noticed yesterday a -Wnarrowing warning in the Fortran FE that broke
my build (old configure, these days we use -Wno-narrowing, so don't see
that).

We are storing the mask into unsigned int field, and 1 << 31 is negative.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2017-07-25  Jakub Jelinek  <jakub@redhat.com>

	* ioparm.def: Use 1U << 31 instead of 1 << 31 as flags2 mask.


	Jakub

Comments

Thomas Koenig July 25, 2017, 10:07 a.m. UTC | #1
Hi Jakub,

> I've noticed yesterday a -Wnarrowing warning in the Fortran FE that broke
> my build (old configure, these days we use -Wno-narrowing, so don't see
> that).
> 
> We are storing the mask into unsigned int field, and 1 << 31 is negative.
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
> 
> 2017-07-25  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* ioparm.def: Use 1U << 31 instead of 1 << 31 as flags2 mask.
> 
> --- gcc/fortran/ioparm.def.jj	2017-01-01 12:45:47.000000000 +0100
> +++ gcc/fortran/ioparm.def	2017-07-24 18:52:43.268946713 +0200
> @@ -82,7 +82,7 @@ IOPARM (inquire, read,		1 << 27, char2)
>   IOPARM (inquire, write,		1 << 28, char1)
>   IOPARM (inquire, readwrite,	1 << 29, char2)
>   IOPARM (inquire, convert,	1 << 30, char1)
> -IOPARM (inquire, flags2,	1 << 31, int4)
> +IOPARM (inquire, flags2,	1U << 31, int4)
>   IOPARM (inquire, asynchronous,	1 << 0,  char1)
>   IOPARM (inquire, decimal,	1 << 1,  char2)
>   IOPARM (inquire, encoding,	1 << 2,  char1)

The patch is OK.

Thanks!

	Thomas
diff mbox

Patch

--- gcc/fortran/ioparm.def.jj	2017-01-01 12:45:47.000000000 +0100
+++ gcc/fortran/ioparm.def	2017-07-24 18:52:43.268946713 +0200
@@ -82,7 +82,7 @@  IOPARM (inquire, read,		1 << 27, char2)
 IOPARM (inquire, write,		1 << 28, char1)
 IOPARM (inquire, readwrite,	1 << 29, char2)
 IOPARM (inquire, convert,	1 << 30, char1)
-IOPARM (inquire, flags2,	1 << 31, int4)
+IOPARM (inquire, flags2,	1U << 31, int4)
 IOPARM (inquire, asynchronous,	1 << 0,  char1)
 IOPARM (inquire, decimal,	1 << 1,  char2)
 IOPARM (inquire, encoding,	1 << 2,  char1)