diff mbox

Fix increase_alignment

Message ID CAC1BbcSXRqxSjh6_Jg01detMQ=B6j9mo3ezPZsjm6e+_c1Dc6w@mail.gmail.com
State New
Headers show

Commit Message

Bernhard Reutner-Fischer April 8, 2015, 6:01 p.m. UTC
On 2 April 2015 at 01:20, Jan Hubicka <hubicka@ucw.cz> wrote:
>>
>> Your follow-up patch 88ada5e935d58223ae2d9ce6d0c1c71c372680a8 a.k.a r221269
>> added this to emit_local():
>>
>>  static bool
>> -emit_local (tree decl ATTRIBUTE_UNUSED,
>> +emit_local (tree decl,
>>             const char *name ATTRIBUTE_UNUSED,
>>             unsigned HOST_WIDE_INT size ATTRIBUTE_UNUSED,
>>             unsigned HOST_WIDE_INT rounded ATTRIBUTE_UNUSED)
>>  {
>> +  int align = symtab_node::get (decl)->definition_alignment ();
>>  #if defined ASM_OUTPUT_ALIGNED_DECL_LOCAL
>>    ASM_OUTPUT_ALIGNED_DECL_LOCAL (asm_out_file, decl, name,
>> -                                size, DECL_ALIGN (decl));
>> +                                size, align);
>>    return true;
>>  #elif defined ASM_OUTPUT_ALIGNED_LOCAL
>> -  ASM_OUTPUT_ALIGNED_LOCAL (asm_out_file, name, size, DECL_ALIGN (decl));
>> +  ASM_OUTPUT_ALIGNED_LOCAL (asm_out_file, name, size, align);
>>    return true;
>>  #else
>>    ASM_OUTPUT_LOCAL (asm_out_file, name, size, rounded);
>>    return false;
>>  #endif
>>  }
>>
>> which gives
>>
>> gcc/varasm.c:1936:7: error: unused variable ‘align’ [-Werror=unused-variable]
>>    int align = symtab_node::get (decl)->definition_alignment ();
>>        ^
>>
>> on
>> log/alpha64-dec-vms
>> log/alpha-dec-vms
>> log/i686-cygwinOPT-enable-threads=yes
>> log/i686-mingw32crt
>> log/i686-openbsd3.0
>> log/i686-pc-msdosdjgpp
>> log/m68k-openbsd
>>
>> Maybe just flag it as used or copy-move it?
>
> Yep, lets just move it into the ifdefs. Can you please check that the alignment

Committed revision 221925.

> looks right atone of those targets? I am not quite sure who is supposed to
> do so on targets not defining ASM_OUTPUT_ALIGNED_LOCAL.
>
> Perhaps we want then to prvent vectorizer from updating the alignments.

I have no idea how the alignment on those targets are supposed to look
like, sorry.

thanks,
diff mbox

Patch

------------------------------------------------------------------------
r221925 | aldot | 2015-04-08 19:56:18 +0200 (Wed, 08 Apr 2015) | 22 lines

emit_local(): Fix unused warning

Honzas r221269 produced

gcc/varasm.c:1936:7: error: unused variable ‘align’
[-Werror=unused-variable]
   int align = symtab_node::get (decl)->definition_alignment ();
       ^
on e.g.:

log/alpha64-dec-vms
log/alpha-dec-vms
log/i686-cygwinOPT-enable-threads=yes
log/i686-mingw32crt
log/i686-openbsd3.0
log/i686-pc-msdosdjgpp
log/m68k-openbsd

Silence this by moving the variable into the corresponding blocks and
adding back the ATTRIBUTE_UNUSED decoration for the decl param.


------------------------------------------------------------------------
Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog	(revision 221924)
+++ gcc/ChangeLog	(revision 221925)
@@ -1,3 +1,7 @@ 
+2015-04-08  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
+
+	* varasm.c (emit_local): Move definition of align.
+
 2015-04-08  Julian Brown  <julian@codesourcery.com>
 
 	* config/nvptx/mkoffload.c (process): Support variable mapping.
Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c	(revision 221924)
+++ gcc/varasm.c	(revision 221925)
@@ -1928,17 +1928,18 @@ 
 /* A noswitch_section_callback for lcomm_section.  */
 
 static bool
-emit_local (tree decl,
+emit_local (tree decl ATTRIBUTE_UNUSED,
 	    const char *name ATTRIBUTE_UNUSED,
 	    unsigned HOST_WIDE_INT size ATTRIBUTE_UNUSED,
 	    unsigned HOST_WIDE_INT rounded ATTRIBUTE_UNUSED)
 {
+#if defined ASM_OUTPUT_ALIGNED_DECL_LOCAL
   int align = symtab_node::get (decl)->definition_alignment ();
-#if defined ASM_OUTPUT_ALIGNED_DECL_LOCAL
   ASM_OUTPUT_ALIGNED_DECL_LOCAL (asm_out_file, decl, name,
 				 size, align);
   return true;
 #elif defined ASM_OUTPUT_ALIGNED_LOCAL
+  int align = symtab_node::get (decl)->definition_alignment ();
   ASM_OUTPUT_ALIGNED_LOCAL (asm_out_file, name, size, align);
   return true;
 #else