On 07/28/2015 02:21 AM, Thomas Schwinge wrote:

> Cesar, please address the following compiler diagnostig:
> 
>> 2015-07-21  Cesar Philippidis  <ce...@codesourcery.com>
>>
>>      gcc/
>>      * omp-low.c (execute_oacc_transform): New function.
>>      (class pass_oacc_transform): New function.
>>      (make_pass_oacc_transform): New function.
>>      * passes.def: Add pass_oacc_transform to all_passes.
>>      * tree-pass.h (make_pass_oacc_transform): Declare.
>>      
>>
>> diff --git a/gcc/omp-low.c b/gcc/omp-low.c
>> index 388013c..23989f9 100644
>> --- a/gcc/omp-low.c
>> +++ b/gcc/omp-low.c
>> @@ -14394,4 +14394,76 @@ make_pass_late_lower_omp (gcc::context *ctxt)
>>    return new pass_late_lower_omp (ctxt);
>>  }
>>  
>> +/* Main entry point for oacc transformations which run on the device
>> +   compiler.  */
>> +
>> +static unsigned int
>> +execute_oacc_transform ()
>> +{
>> +  basic_block bb;
>> +  gimple_stmt_iterator gsi;
>> +  gimple stmt;
>> +
>> +  if (!lookup_attribute ("oacc function",
>> +                     DECL_ATTRIBUTES (current_function_decl)))
>> +    return 0;
>> +
>> +
>> +  FOR_ALL_BB_FN (bb, cfun)
>> +    {
>> +      gsi = gsi_start_bb (bb);
>> +
>> +      while (!gsi_end_p (gsi))
>> +    {
>> +      stmt = gsi_stmt (gsi);
>> +      gsi_next (&gsi);
>> +    }
>> +    }
>> +
>> +  return 0;
>> +}
> 
>     [...]/source-gcc/gcc/omp-low.c: In function 'unsigned int 
> execute_oacc_transform()':
>     [...]/source-gcc/gcc/omp-low.c:14406:10: error: variable 'stmt' set but 
> not used [-Werror=unused-but-set-variable]
>        gimple stmt;
>               ^

I could apply the attached patch, but I figured that you'd need the stmt
iterator for acc_on_device anyway. Should I apply the patch to
gomp-4_0-branch?

Cesar

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 479b28a..e237c75 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -14431,26 +14431,10 @@ make_pass_late_lower_omp (gcc::context *ctxt)
 static unsigned int
 execute_oacc_transform ()
 {
-  basic_block bb;
-  gimple_stmt_iterator gsi;
-  gimple stmt;
-
   if (!lookup_attribute ("oacc function",
 			 DECL_ATTRIBUTES (current_function_decl)))
     return 0;
 
-
-  FOR_ALL_BB_FN (bb, cfun)
-    {
-      gsi = gsi_start_bb (bb);
-
-      while (!gsi_end_p (gsi))
-	{
-	  stmt = gsi_stmt (gsi);
-	  gsi_next (&gsi);
-	}
-    }
-
   return 0;
 }
 

Reply via email to