public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, Fortran, pr79335, v2] [7 Regression] Conditional jump or move depends on uninitialised in value  get_scalar_to_descriptor_type(tree_node*, symbol_attribute) (trans-expr.c:53)
       [not found] ` <bug-79335-26035-GTNSrUpC7a@http.gcc.gnu.org/bugzilla/>
@ 2017-02-15 13:43   ` Andre Vehreschild
  2017-02-15 16:51     ` Jerry DeLisle
  0 siblings, 1 reply; 4+ messages in thread
From: Andre Vehreschild @ 2017-02-15 13:43 UTC (permalink / raw)
  To: GCC-Patches-ML; +Cc: GCC-Fortran-ML

[-- Attachment #1: Type: text/plain, Size: 2304 bytes --]

Hi all,

attached patch fixes (hopefully) all occurrences of uninitialized
symbol_attributes used for getting a descriptor for a scalar as reported in the
reopended pr79335.

Bootstraps and regtests ok on x86_64-linux/f25. Ok for trunk?

Regards,
	Andre

On Tue, 14 Feb 2017 08:32:59 +0000
"marxin at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79335
> 
> Martin Liška <marxin at gcc dot gnu.org> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|WAITING                     |REOPENED
> 
> --- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
> Thanks for fix, however there are still some issues:
> 
> $ valgrind --leak-check=yes --trace-children=yes ./xgcc -B.
> /home/marxin/Programming/gcc/gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f90
> -fcoarray=lib -lcaf_single 
> 
> ==15334== Conditional jump or move depends on uninitialised value(s)
> ==15334==    at 0x95EE91: get_scalar_to_descriptor_type(tree_node*,
> symbol_attribute) (trans-expr.c:53)
> ==15334==    by 0x95EFF0: gfc_conv_scalar_to_descriptor(gfc_se*, tree_node*,
> symbol_attribute) (trans-expr.c:71)
> ==15334==    by 0x977D9C: gfc_trans_structure_assign(tree_node*, gfc_expr*,
> bool, bool) (trans-expr.c:7552)
> ==15334==    by 0x97830F: gfc_conv_structure(gfc_se*, gfc_expr*, int)
> (trans-expr.c:7646)
> ==15334==    by 0x978AD9: gfc_conv_expr(gfc_se*, gfc_expr*)
> (trans-expr.c:7813) ==15334==    by 0x97F5EC:
> gfc_trans_assignment_1(gfc_expr*, gfc_expr*, bool, bool, bool, bool)
> (trans-expr.c:9923) ==15334==    by 0x9804A5: gfc_trans_assignment(gfc_expr*,
> gfc_expr*, bool, bool, bool, bool) (trans-expr.c:10231)
> ==15334==    by 0x9804E1: gfc_trans_init_assign(gfc_code*)
> (trans-expr.c:10237) ==15334==    by 0x9D2655: gfc_trans_allocate(gfc_code*)
> (trans-stmt.c:6328) ==15334==    by 0x92077B: trans_code(gfc_code*,
> tree_node*) (trans.c:1965) ==15334==    by 0x9209F6:
> gfc_trans_code(gfc_code*) (trans.c:2124) ==15334==    by 0x95B503:
> gfc_generate_function_code(gfc_namespace*) (trans-decl.c:6306)
> ...
> 


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 

[-- Attachment #2: pr79335_v2.clog --]
[-- Type: text/plain, Size: 282 bytes --]

gcc/fortran/ChangeLog:

2017-02-15  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/79335
	* trans-array.c (duplicate_allocatable_coarray): Ensure attributes
	passed are properly initialized.
	(structure_alloc_comps): Same.
	* trans-expr.c (gfc_trans_structure_assign): Same.



[-- Attachment #3: pr79335_v2.patch --]
[-- Type: text/x-patch, Size: 2060 bytes --]

diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index d0dfc26..47e8c09 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -7950,6 +7950,8 @@ duplicate_allocatable_coarray (tree dest, tree dest_tok, tree src,
       tree dummy_desc;
 
       gfc_init_se (&se, NULL);
+      gfc_clear_attr (&attr);
+      attr.allocatable = 1;
       dummy_desc = gfc_conv_scalar_to_descriptor (&se, dest, attr);
       gfc_add_block_to_block (&globalblock, &se.pre);
       size = TYPE_SIZE_UNIT (TREE_TYPE (type));
@@ -8518,14 +8520,15 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
 	      else
 		{
 		  gfc_se se;
-		  symbol_attribute attr;
 
 		  gfc_init_se (&se, NULL);
-		  gfc_clear_attr (&attr);
 		  token = fold_build3_loc (input_location, COMPONENT_REF,
 					   pvoid_type_node, decl, c->caf_token,
 					   NULL_TREE);
-		  comp = gfc_conv_scalar_to_descriptor (&se, comp, attr);
+		  comp = gfc_conv_scalar_to_descriptor (&se, comp,
+							c->ts.type == BT_CLASS
+							? CLASS_DATA (c)->attr
+							: c->attr);
 		  gfc_add_block_to_block (&fnblock, &se.pre);
 		}
 
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 87bf069..cc41fe3 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -7516,7 +7516,6 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr, bool init, bool coarray)
 	  && (!c->expr || c->expr->expr_type == EXPR_NULL))
 	{
 	  tree token, desc, size;
-	  symbol_attribute attr;
 	  bool is_array = cm->ts.type == BT_CLASS
 	      ? CLASS_DATA (cm)->attr.dimension : cm->attr.dimension;
 
@@ -7549,7 +7548,10 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr, bool init, bool coarray)
 	    }
 	  else
 	    {
-	      desc = gfc_conv_scalar_to_descriptor (&se, field, attr);
+	      desc = gfc_conv_scalar_to_descriptor (&se, field,
+						    cm->ts.type == BT_CLASS
+						    ? CLASS_DATA (cm)->attr
+						    : cm->attr);
 	      size = TYPE_SIZE_UNIT (TREE_TYPE (field));
 	    }
 	  gfc_add_block_to_block (&block, &se.pre);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH, Fortran, pr79335, v2] [7 Regression] Conditional jump or move depends on uninitialised in value get_scalar_to_descriptor_type(tree_node*, symbol_attribute) (trans-expr.c:53)
  2017-02-15 13:43   ` [PATCH, Fortran, pr79335, v2] [7 Regression] Conditional jump or move depends on uninitialised in value get_scalar_to_descriptor_type(tree_node*, symbol_attribute) (trans-expr.c:53) Andre Vehreschild
@ 2017-02-15 16:51     ` Jerry DeLisle
  2017-02-19 18:19       ` Andre Vehreschild
  0 siblings, 1 reply; 4+ messages in thread
From: Jerry DeLisle @ 2017-02-15 16:51 UTC (permalink / raw)
  To: fortran

On 02/15/2017 05:42 AM, Andre Vehreschild wrote:
> Hi all,
> 
> attached patch fixes (hopefully) all occurrences of uninitialized
> symbol_attributes used for getting a descriptor for a scalar as reported in the
> reopended pr79335.
> 
> Bootstraps and regtests ok on x86_64-linux/f25. Ok for trunk?
> 
> Regards,
> 	Andre
> 

OK, hopefully, thanks.

Jerry

;)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH, Fortran, pr79335, v2] [7 Regression] Conditional jump or move depends on uninitialised in value get_scalar_to_descriptor_type(tree_node*, symbol_attribute) (trans-expr.c:53)
  2017-02-15 16:51     ` Jerry DeLisle
@ 2017-02-19 18:19       ` Andre Vehreschild
  2017-02-19 18:20         ` Andre Vehreschild
  0 siblings, 1 reply; 4+ messages in thread
From: Andre Vehreschild @ 2017-02-19 18:19 UTC (permalink / raw)
  To: Jerry DeLisle; +Cc: fortran

[-- Attachment #1: Type: text/plain, Size: 621 bytes --]

Hi Jerry, hi all,

thanks for the fast review. Committed as r245579.

Regards,
	Andre

On Wed, 15 Feb 2017 08:51:29 -0800
Jerry DeLisle <jvdelisle@charter.net> wrote:

> On 02/15/2017 05:42 AM, Andre Vehreschild wrote:
> > Hi all,
> > 
> > attached patch fixes (hopefully) all occurrences of uninitialized
> > symbol_attributes used for getting a descriptor for a scalar as reported in
> > the reopended pr79335.
> > 
> > Bootstraps and regtests ok on x86_64-linux/f25. Ok for trunk?
> > 
> > Regards,
> > 	Andre
> >   
> 
> OK, hopefully, thanks.
> 
> Jerry
> 
> ;)


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 

[-- Attachment #2: pr79335_v2.clog --]
[-- Type: application/octet-stream, Size: 282 bytes --]

gcc/fortran/ChangeLog:

2017-02-15  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/79335
	* trans-array.c (duplicate_allocatable_coarray): Ensure attributes
	passed are properly initialized.
	(structure_alloc_comps): Same.
	* trans-expr.c (gfc_trans_structure_assign): Same.



[-- Attachment #3: pr79335_v2.patch --]
[-- Type: text/x-patch, Size: 2060 bytes --]

diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index d0dfc26..47e8c09 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -7950,6 +7950,8 @@ duplicate_allocatable_coarray (tree dest, tree dest_tok, tree src,
       tree dummy_desc;
 
       gfc_init_se (&se, NULL);
+      gfc_clear_attr (&attr);
+      attr.allocatable = 1;
       dummy_desc = gfc_conv_scalar_to_descriptor (&se, dest, attr);
       gfc_add_block_to_block (&globalblock, &se.pre);
       size = TYPE_SIZE_UNIT (TREE_TYPE (type));
@@ -8518,14 +8520,15 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
 	      else
 		{
 		  gfc_se se;
-		  symbol_attribute attr;
 
 		  gfc_init_se (&se, NULL);
-		  gfc_clear_attr (&attr);
 		  token = fold_build3_loc (input_location, COMPONENT_REF,
 					   pvoid_type_node, decl, c->caf_token,
 					   NULL_TREE);
-		  comp = gfc_conv_scalar_to_descriptor (&se, comp, attr);
+		  comp = gfc_conv_scalar_to_descriptor (&se, comp,
+							c->ts.type == BT_CLASS
+							? CLASS_DATA (c)->attr
+							: c->attr);
 		  gfc_add_block_to_block (&fnblock, &se.pre);
 		}
 
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 87bf069..cc41fe3 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -7516,7 +7516,6 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr, bool init, bool coarray)
 	  && (!c->expr || c->expr->expr_type == EXPR_NULL))
 	{
 	  tree token, desc, size;
-	  symbol_attribute attr;
 	  bool is_array = cm->ts.type == BT_CLASS
 	      ? CLASS_DATA (cm)->attr.dimension : cm->attr.dimension;
 
@@ -7549,7 +7548,10 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr, bool init, bool coarray)
 	    }
 	  else
 	    {
-	      desc = gfc_conv_scalar_to_descriptor (&se, field, attr);
+	      desc = gfc_conv_scalar_to_descriptor (&se, field,
+						    cm->ts.type == BT_CLASS
+						    ? CLASS_DATA (cm)->attr
+						    : cm->attr);
 	      size = TYPE_SIZE_UNIT (TREE_TYPE (field));
 	    }
 	  gfc_add_block_to_block (&block, &se.pre);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH, Fortran, pr79335, v2] [7 Regression] Conditional jump or move depends on uninitialised in value get_scalar_to_descriptor_type(tree_node*, symbol_attribute) (trans-expr.c:53)
  2017-02-19 18:19       ` Andre Vehreschild
@ 2017-02-19 18:20         ` Andre Vehreschild
  0 siblings, 0 replies; 4+ messages in thread
From: Andre Vehreschild @ 2017-02-19 18:20 UTC (permalink / raw)
  To: Jerry DeLisle; +Cc: fortran

[-- Attachment #1: Type: text/plain, Size: 833 bytes --]

Sorry, for the noise, now with the correct file attached.

- Andre

On Sun, 19 Feb 2017 19:19:43 +0100
Andre Vehreschild <vehre@gmx.de> wrote:

> Hi Jerry, hi all,
> 
> thanks for the fast review. Committed as r245579.
> 
> Regards,
> 	Andre
> 
> On Wed, 15 Feb 2017 08:51:29 -0800
> Jerry DeLisle <jvdelisle@charter.net> wrote:
> 
> > On 02/15/2017 05:42 AM, Andre Vehreschild wrote:  
> > > Hi all,
> > > 
> > > attached patch fixes (hopefully) all occurrences of uninitialized
> > > symbol_attributes used for getting a descriptor for a scalar as reported
> > > in the reopended pr79335.
> > > 
> > > Bootstraps and regtests ok on x86_64-linux/f25. Ok for trunk?
> > > 
> > > Regards,
> > > 	Andre
> > >     
> > 
> > OK, hopefully, thanks.
> > 
> > Jerry
> > 
> > ;)  
> 
> 


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 

[-- Attachment #2: submit.diff --]
[-- Type: text/x-patch, Size: 2427 bytes --]

Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(Revision 245576)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,11 @@
+2017-02-19  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+	PR fortran/79335
+	* trans-array.c (duplicate_allocatable_coarray): Ensure attributes
+	passed are properly initialized.
+	(structure_alloc_comps): Same.
+	* trans-expr.c (gfc_trans_structure_assign): Same.
+
 2017-02-13  Jakub Jelinek  <jakub@redhat.com>
 
 	* trans-expr.c (gfc_conv_substring): Add missing space in diagnostics.
Index: gcc/fortran/trans-array.c
===================================================================
--- gcc/fortran/trans-array.c	(Revision 245576)
+++ gcc/fortran/trans-array.c	(Arbeitskopie)
@@ -7950,6 +7950,8 @@
       tree dummy_desc;
 
       gfc_init_se (&se, NULL);
+      gfc_clear_attr (&attr);
+      attr.allocatable = 1;
       dummy_desc = gfc_conv_scalar_to_descriptor (&se, dest, attr);
       gfc_add_block_to_block (&globalblock, &se.pre);
       size = TYPE_SIZE_UNIT (TREE_TYPE (type));
@@ -8518,14 +8520,15 @@
 	      else
 		{
 		  gfc_se se;
-		  symbol_attribute attr;
 
 		  gfc_init_se (&se, NULL);
-		  gfc_clear_attr (&attr);
 		  token = fold_build3_loc (input_location, COMPONENT_REF,
 					   pvoid_type_node, decl, c->caf_token,
 					   NULL_TREE);
-		  comp = gfc_conv_scalar_to_descriptor (&se, comp, attr);
+		  comp = gfc_conv_scalar_to_descriptor (&se, comp,
+							c->ts.type == BT_CLASS
+							? CLASS_DATA (c)->attr
+							: c->attr);
 		  gfc_add_block_to_block (&fnblock, &se.pre);
 		}
 
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c	(Revision 245576)
+++ gcc/fortran/trans-expr.c	(Arbeitskopie)
@@ -7516,7 +7516,6 @@
 	  && (!c->expr || c->expr->expr_type == EXPR_NULL))
 	{
 	  tree token, desc, size;
-	  symbol_attribute attr;
 	  bool is_array = cm->ts.type == BT_CLASS
 	      ? CLASS_DATA (cm)->attr.dimension : cm->attr.dimension;
 
@@ -7549,7 +7548,10 @@
 	    }
 	  else
 	    {
-	      desc = gfc_conv_scalar_to_descriptor (&se, field, attr);
+	      desc = gfc_conv_scalar_to_descriptor (&se, field,
+						    cm->ts.type == BT_CLASS
+						    ? CLASS_DATA (cm)->attr
+						    : cm->attr);
 	      size = TYPE_SIZE_UNIT (TREE_TYPE (field));
 	    }
 	  gfc_add_block_to_block (&block, &se.pre);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-19 18:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-79335-26035@http.gcc.gnu.org/bugzilla/>
     [not found] ` <bug-79335-26035-GTNSrUpC7a@http.gcc.gnu.org/bugzilla/>
2017-02-15 13:43   ` [PATCH, Fortran, pr79335, v2] [7 Regression] Conditional jump or move depends on uninitialised in value get_scalar_to_descriptor_type(tree_node*, symbol_attribute) (trans-expr.c:53) Andre Vehreschild
2017-02-15 16:51     ` Jerry DeLisle
2017-02-19 18:19       ` Andre Vehreschild
2017-02-19 18:20         ` Andre Vehreschild

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).