nvptx: Fix up nvptx build against latest libstdc++ [PR100375]

Message ID 20210502085233.GV1179226@tucnak
State New
Headers show
Series
  • nvptx: Fix up nvptx build against latest libstdc++ [PR100375]
Related show

Commit Message

Jason Merrill via Gcc-patches May 2, 2021, 8:52 a.m.
Hi!

The r12-220-gd96db15967e78d7cecea3b1cf3169ceb924678ac change
deprecated some non-standard std::pair constructors and that apparently
broke nvptx.c build, where pseudo_node_t is std::pair<struct basic_block_def *, int>
and so nullptr (or NULL) needs to be used for the first argument of the
ctors instead of 0.

Tested in x86_64-linux -> nvptx-none cross with CC/CXX latest trunk gcc,
ok for trunk?

2021-05-02  Jakub Jelinek  <jakub@redhat.com>

	PR target/100375
	* config/nvptx/nvptx.c (nvptx_sese_pseudo): Use nullptr instead of 0
	as first argument of pseudo_node_t constructors.


	Jakub

Comments

Tom de Vries May 2, 2021, 12:03 p.m. | #1
On 2021-05-02 10:52, Jakub Jelinek wrote:
> Hi!

> 

> The r12-220-gd96db15967e78d7cecea3b1cf3169ceb924678ac change

> deprecated some non-standard std::pair constructors and that apparently

> broke nvptx.c build, where pseudo_node_t is std::pair<struct

> basic_block_def *, int>

> and so nullptr (or NULL) needs to be used for the first argument of the

> ctors instead of 0.

> 

> Tested in x86_64-linux -> nvptx-none cross with CC/CXX latest trunk 

> gcc,

> ok for trunk?

> 


Hi Jakub,

thanks for taking care of this, LGTM, please apply.

Thanks,
- Tom

> 2021-05-02  Jakub Jelinek  <jakub@redhat.com>

> 

> 	PR target/100375

> 	* config/nvptx/nvptx.c (nvptx_sese_pseudo): Use nullptr instead of 0

> 	as first argument of pseudo_node_t constructors.

> 

> --- gcc/config/nvptx/nvptx.c.jj	2021-02-10 23:08:50.487460416 +0100

> +++ gcc/config/nvptx/nvptx.c	2021-05-02 10:39:45.803670287 +0200

> @@ -3682,9 +3682,9 @@ nvptx_sese_pseudo (basic_block me, bb_se

>    edge e;

>    edge_iterator ei;

>    int hi_back = depth;

> -  pseudo_node_t node_back (0, depth);

> +  pseudo_node_t node_back (nullptr, depth);

>    int hi_child = depth;

> -  pseudo_node_t node_child (0, depth);

> +  pseudo_node_t node_child (nullptr, depth);

>    basic_block child = NULL;

>    unsigned num_children = 0;

>    int usd = -dir * sese->dir;

> @@ -3751,7 +3751,7 @@ nvptx_sese_pseudo (basic_block me, bb_se

>        else

>  	{ /* Fallen off graph, backlink to entry node.  */

>  	  hi_back = 0;

> -	  node_back = pseudo_node_t (0, 0);

> +	  node_back = pseudo_node_t (nullptr, 0);

>  	}

>      }

> 

> @@ -3772,7 +3772,7 @@ nvptx_sese_pseudo (basic_block me, bb_se

>        else

>  	{

>  	  /* back edge to entry node */

> -	  sese->push (pseudo_node_t (0, 0));

> +	  sese->push (pseudo_node_t (nullptr, 0));

>  	}

>      }

> 

> @@ -3781,7 +3781,7 @@ nvptx_sese_pseudo (basic_block me, bb_se

>    if (!sese->brackets.length () || !edges || !edges->length ())

>      {

>        hi_back = 0;

> -      node_back = pseudo_node_t (0, 0);

> +      node_back = pseudo_node_t (nullptr, 0);

>        sese->push (node_back);

>      }

> 

> 

> 	Jakub

Patch

--- gcc/config/nvptx/nvptx.c.jj	2021-02-10 23:08:50.487460416 +0100
+++ gcc/config/nvptx/nvptx.c	2021-05-02 10:39:45.803670287 +0200
@@ -3682,9 +3682,9 @@  nvptx_sese_pseudo (basic_block me, bb_se
   edge e;
   edge_iterator ei;
   int hi_back = depth;
-  pseudo_node_t node_back (0, depth);
+  pseudo_node_t node_back (nullptr, depth);
   int hi_child = depth;
-  pseudo_node_t node_child (0, depth);
+  pseudo_node_t node_child (nullptr, depth);
   basic_block child = NULL;
   unsigned num_children = 0;
   int usd = -dir * sese->dir;
@@ -3751,7 +3751,7 @@  nvptx_sese_pseudo (basic_block me, bb_se
       else
 	{ /* Fallen off graph, backlink to entry node.  */
 	  hi_back = 0;
-	  node_back = pseudo_node_t (0, 0);
+	  node_back = pseudo_node_t (nullptr, 0);
 	}
     }
 
@@ -3772,7 +3772,7 @@  nvptx_sese_pseudo (basic_block me, bb_se
       else
 	{
 	  /* back edge to entry node */
-	  sese->push (pseudo_node_t (0, 0));
+	  sese->push (pseudo_node_t (nullptr, 0));
 	}
     }
   
@@ -3781,7 +3781,7 @@  nvptx_sese_pseudo (basic_block me, bb_se
   if (!sese->brackets.length () || !edges || !edges->length ())
     {
       hi_back = 0;
-      node_back = pseudo_node_t (0, 0);
+      node_back = pseudo_node_t (nullptr, 0);
       sese->push (node_back);
     }