Re: [Patch, Fortran] libgomp: Silence unpack's may be used uninitialized warning

2020-09-29 Thread Tobias Burnus

Hi Damian,

my silencing-a-warning patch is about warnings reported when compiling
GCC itself. — There are also warning for internal/artificially created
variables when compiling code with gfortran. This patch was about the
former and I assume that you are seeing the later.

But, otherwise, I concur that both should eventually be fixed.

Tobias

On 9/29/20 1:25 AM, Damian Rouson wrote:

I've been seeing similar messages to this one for quite some time now -- I
think ~1 year.  I don't often use unpack so there are likely many other
causes too.  I haven't take the time to isolate them, but if I can do so
easily, I'll submit reports.

Damian

On Mon, Sep 28, 2020 at 2:12 PM Tobias Burnus 
wrote:


There are more warnings, but I picked this one which shows up
with default build options for GCC trunk – twice for each
generated file:

../../../../repos/gcc/libgfortran/generated/unpack_i2.c:128:12: warning:
‘rstride’ may be used uninitialized [-Wmaybe-uninitialized]
../../../../repos/gcc/libgfortran/generated/unpack_i2.c:278:12: warning:
‘rstride’ may be used uninitialized [-Wmaybe-uninitialized]

Hence, 13 times these messages (×2 warnings/file + ×2 with multilib) → 53
'warning:'.

Seemingly, the compiler logic has changes as the previous location
used to be sufficient to silence the compiler.
(The warning is right if base_addr = NULL and dim = 0; the latter should
not occur but the compiler does not know this.)

Committed as obvious as r11-3508-g69c56ce673d1e1d4508e82053a32011f807c6088

Tobias

-
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München /
Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung,
Alexander Walter


-
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander 
Walter


Re: [Patch, Fortran] libgomp: Silence unpack's may be used uninitialized warning

2020-09-28 Thread Damian Rouson
I've been seeing similar messages to this one for quite some time now -- I
think ~1 year.  I don't often use unpack so there are likely many other
causes too.  I haven't take the time to isolate them, but if I can do so
easily, I'll submit reports.

Damian

On Mon, Sep 28, 2020 at 2:12 PM Tobias Burnus 
wrote:

> There are more warnings, but I picked this one which shows up
> with default build options for GCC trunk – twice for each
> generated file:
>
> ../../../../repos/gcc/libgfortran/generated/unpack_i2.c:128:12: warning:
> ‘rstride’ may be used uninitialized [-Wmaybe-uninitialized]
> ../../../../repos/gcc/libgfortran/generated/unpack_i2.c:278:12: warning:
> ‘rstride’ may be used uninitialized [-Wmaybe-uninitialized]
>
> Hence, 13 times these messages (×2 warnings/file + ×2 with multilib) → 53
> 'warning:'.
>
> Seemingly, the compiler logic has changes as the previous location
> used to be sufficient to silence the compiler.
> (The warning is right if base_addr = NULL and dim = 0; the latter should
> not occur but the compiler does not know this.)
>
> Committed as obvious as r11-3508-g69c56ce673d1e1d4508e82053a32011f807c6088
>
> Tobias
>
> -
> Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München /
> Germany
> Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung,
> Alexander Walter
>


[Patch, Fortran] libgomp: Silence unpack's may be used uninitialized warning

2020-09-28 Thread Tobias Burnus

There are more warnings, but I picked this one which shows up
with default build options for GCC trunk – twice for each
generated file:

../../../../repos/gcc/libgfortran/generated/unpack_i2.c:128:12: warning: 
‘rstride’ may be used uninitialized [-Wmaybe-uninitialized]
../../../../repos/gcc/libgfortran/generated/unpack_i2.c:278:12: warning: 
‘rstride’ may be used uninitialized [-Wmaybe-uninitialized]

Hence, 13 times these messages (×2 warnings/file + ×2 with multilib) → 53 
'warning:'.

Seemingly, the compiler logic has changes as the previous location
used to be sufficient to silence the compiler.
(The warning is right if base_addr = NULL and dim = 0; the latter should
not occur but the compiler does not know this.)

Committed as obvious as r11-3508-g69c56ce673d1e1d4508e82053a32011f807c6088

Tobias

-
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander 
Walter
libgfortran/m4/unpack.m4: Silence -Wmaybe-uninitialized

libgfortran/ChangeLog:

	* m4/unpack.m4 (unpack0_'rtype_code`,
	unpack1_'rtype_code`): Move 'rstride[0]' initialization outside
	outside conditional branch to silence -Wmaybe-uninitialized.
	* generated/unpack_c10.c: Regenerate.
	* generated/unpack_c16.c: Regenerate.
	* generated/unpack_c4.c: Regenerate.
	* generated/unpack_c8.c: Regenerate.
	* generated/unpack_i1.c: Regenerate.
	* generated/unpack_i16.c: Regenerate.
	* generated/unpack_i2.c: Regenerate.
	* generated/unpack_i4.c: Regenerate.
	* generated/unpack_i8.c: Regenerate.
	* generated/unpack_r10.c: Regenerate.
	* generated/unpack_r16.c: Regenerate.
	* generated/unpack_r4.c: Regenerate.
	* generated/unpack_r8.c: Regenerate.

 libgfortran/generated/unpack_c10.c | 8 
 libgfortran/generated/unpack_c16.c | 8 
 libgfortran/generated/unpack_c4.c  | 8 
 libgfortran/generated/unpack_c8.c  | 8 
 libgfortran/generated/unpack_i1.c  | 8 
 libgfortran/generated/unpack_i16.c | 8 
 libgfortran/generated/unpack_i2.c  | 8 
 libgfortran/generated/unpack_i4.c  | 8 
 libgfortran/generated/unpack_i8.c  | 8 
 libgfortran/generated/unpack_r10.c | 8 
 libgfortran/generated/unpack_r16.c | 8 
 libgfortran/generated/unpack_r4.c  | 8 
 libgfortran/generated/unpack_r8.c  | 8 
 libgfortran/m4/unpack.m4   | 8 
 14 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/libgfortran/m4/unpack.m4 b/libgfortran/m4/unpack.m4
index da7a5ce0443..ebc469a84f8 100644
--- a/libgfortran/m4/unpack.m4
+++ b/libgfortran/m4/unpack.m4
@@ -80,6 +80,8 @@ unpack0_'rtype_code` ('rtype` *ret, const 'rtype` *vector,
   else
 runtime_error ("Funny sized logical array");
 
+  /* Initialize to avoid -Wmaybe-uninitialized complaints.  */
+  rstride[0] = 1;
   if (ret->base_addr == NULL)
 {
   /* The front end has signalled that we need to populate the
@@ -103,8 +105,6 @@ unpack0_'rtype_code` ('rtype` *ret, const 'rtype` *vector,
   else
 {
   dim = GFC_DESCRIPTOR_RANK (ret);
-  /* Initialize to avoid -Wmaybe-uninitialized complaints.  */
-  rstride[0] = 1;
   for (n = 0; n < dim; n++)
 	{
 	  count[n] = 0;
@@ -226,6 +226,8 @@ unpack1_'rtype_code` ('rtype` *ret, const 'rtype` *vector,
   else
 runtime_error ("Funny sized logical array");
 
+  /* Initialize to avoid -Wmaybe-uninitialized complaints.  */
+  rstride[0] = 1;
   if (ret->base_addr == NULL)
 {
   /* The front end has signalled that we need to populate the
@@ -250,8 +252,6 @@ unpack1_'rtype_code` ('rtype` *ret, const 'rtype` *vector,
   else
 {
   dim = GFC_DESCRIPTOR_RANK (ret);
-  /* Initialize to avoid -Wmaybe-uninitialized complaints.  */
-  rstride[0] = 1;
   for (n = 0; n < dim; n++)
 	{
 	  count[n] = 0;
diff --git a/libgfortran/generated/unpack_c10.c b/libgfortran/generated/unpack_c10.c
index e3b3c29e9da..12110df8af0 100644
--- a/libgfortran/generated/unpack_c10.c
+++ b/libgfortran/generated/unpack_c10.c
@@ -79,6 +79,8 @@ unpack0_c10 (gfc_array_c10 *ret, const gfc_array_c10 *vector,
   else
 runtime_error ("Funny sized logical array");
 
+  /* Initialize to avoid -Wmaybe-uninitialized complaints.  */
+  rstride[0] = 1;
   if (ret->base_addr == NULL)
 {
   /* The front end has signalled that we need to populate the
@@ -102,8 +104,6 @@ unpack0_c10 (gfc_array_c10 *ret, const gfc_array_c10 *vector,
   else
 {
   dim = GFC_DESCRIPTOR_RANK (ret);
-  /* Initialize to avoid -Wmaybe-uninitialized complaints.  */
-  rstride[0] = 1;
   for (n = 0; n < dim; n++)
 	{
 	  count[n] = 0;
@@ -225,6 +225,8 @@ unpack1_c10 (gfc_array_c10 *ret, const gfc_array_c10 *vector,
   else
 runtime_error ("Funny sized logical array");
 
+  /* Initialize to avoid -Wmaybe-uninitialized complaints.  */
+  rstride[0] = 1;
   if (ret->base_addr == NULL)
 {
   /* The front end has signalled that we need to