public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][ARM][gas] Fix warnings about uninitialised uses and unused const variables
@ 2016-04-29 14:38 Kyrill Tkachov
  2016-04-29 14:39 ` Kyrill Tkachov
  0 siblings, 1 reply; 2+ messages in thread
From: Kyrill Tkachov @ 2016-04-29 14:38 UTC (permalink / raw)
  To: GCC Patches

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

Hi all,

I recently upgraded my host compiler to GCC 6.1.0 and while trying to build a
cross toolchain for arm-none-eabi I've encountered some -Werror errors in tc-arm.c
This patch fixes them.

Some static const variables that are unused are marked with ATTRIBUTE_UNUSED.
In parse_neon_el_struct_list GCC complains that firsttype.index may be used
uninitialized in an inlined neon_alias_types_same call.
This patch initialises the fields firsttype to prevent that.

With this patch the gas build succeeds for me.
Tested with make check-gas for arm-none-eabi.

Ok to commit?

Thanks,
Kyrill

2016-04-29  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * config/tc-arm.c (fpu_arch_vfp_v1): Mark with ATTRIBUTE_UNUSED.
     (fpu_arch_vfp_v3): Likewise.
     (fpu_arch_neon_v1): Likewise.
     (arm_arch_full): Likewise.
     (parse_neon_el_struct_list): Initialize fields of firsttype.

[-- Attachment #2: arm-gas-warnings.patch --]
[-- Type: text/x-patch, Size: 2065 bytes --]

diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 958434b3563cb49c3fb3cd04ffefc396916f2a49..64d87a371058f0a5b1d173fa4cb43ba8f86dee0d 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -155,10 +155,10 @@ static const arm_feature_set *object_arch = NULL;
 
 /* Constants for known architecture features.  */
 static const arm_feature_set fpu_default = FPU_DEFAULT;
-static const arm_feature_set fpu_arch_vfp_v1 = FPU_ARCH_VFP_V1;
+static const arm_feature_set fpu_arch_vfp_v1 ATTRIBUTE_UNUSED = FPU_ARCH_VFP_V1;
 static const arm_feature_set fpu_arch_vfp_v2 = FPU_ARCH_VFP_V2;
-static const arm_feature_set fpu_arch_vfp_v3 = FPU_ARCH_VFP_V3;
-static const arm_feature_set fpu_arch_neon_v1 = FPU_ARCH_NEON_V1;
+static const arm_feature_set fpu_arch_vfp_v3 ATTRIBUTE_UNUSED = FPU_ARCH_VFP_V3;
+static const arm_feature_set fpu_arch_neon_v1 ATTRIBUTE_UNUSED = FPU_ARCH_NEON_V1;
 static const arm_feature_set fpu_arch_fpa = FPU_ARCH_FPA;
 static const arm_feature_set fpu_any_hard = FPU_ANY_HARD;
 static const arm_feature_set fpu_arch_maverick = FPU_ARCH_MAVERICK;
@@ -221,7 +221,7 @@ static const arm_feature_set arm_ext_fp16 =
   ARM_FEATURE_CORE_HIGH (ARM_EXT2_FP16_INST);
 
 static const arm_feature_set arm_arch_any = ARM_ANY;
-static const arm_feature_set arm_arch_full = ARM_FEATURE (-1, -1, -1);
+static const arm_feature_set arm_arch_full ATTRIBUTE_UNUSED = ARM_FEATURE (-1, -1, -1);
 static const arm_feature_set arm_arch_t2 = ARM_ARCH_THUMB2;
 static const arm_feature_set arm_arch_none = ARM_ARCH_NONE;
 static const arm_feature_set arm_arch_v6m_only = ARM_ARCH_V6M_ONLY;
@@ -1988,6 +1988,10 @@ parse_neon_el_struct_list (char **str, unsigned *pbase,
   const char *const incr_error = _("register stride must be 1 or 2");
   const char *const type_error = _("mismatched element/structure types in list");
   struct neon_typed_alias firsttype;
+  firsttype.defined = 0;
+  firsttype.eltype.type = NT_invtype;
+  firsttype.eltype.size = -1;
+  firsttype.index = -1;
 
   if (skip_past_char (&ptr, '{') == SUCCESS)
     leading_brace = 1;

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

* Re: [PATCH][ARM][gas] Fix warnings about uninitialised uses and unused const variables
  2016-04-29 14:38 [PATCH][ARM][gas] Fix warnings about uninitialised uses and unused const variables Kyrill Tkachov
@ 2016-04-29 14:39 ` Kyrill Tkachov
  0 siblings, 0 replies; 2+ messages in thread
From: Kyrill Tkachov @ 2016-04-29 14:39 UTC (permalink / raw)
  To: GCC Patches

This was supposed to go to the binutils list :(
Please ignore.

Kyrill

On 29/04/16 15:37, Kyrill Tkachov wrote:
> Hi all,
>
> I recently upgraded my host compiler to GCC 6.1.0 and while trying to build a
> cross toolchain for arm-none-eabi I've encountered some -Werror errors in tc-arm.c
> This patch fixes them.
>
> Some static const variables that are unused are marked with ATTRIBUTE_UNUSED.
> In parse_neon_el_struct_list GCC complains that firsttype.index may be used
> uninitialized in an inlined neon_alias_types_same call.
> This patch initialises the fields firsttype to prevent that.
>
> With this patch the gas build succeeds for me.
> Tested with make check-gas for arm-none-eabi.
>
> Ok to commit?
>
> Thanks,
> Kyrill
>
> 2016-04-29  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>     * config/tc-arm.c (fpu_arch_vfp_v1): Mark with ATTRIBUTE_UNUSED.
>     (fpu_arch_vfp_v3): Likewise.
>     (fpu_arch_neon_v1): Likewise.
>     (arm_arch_full): Likewise.
>     (parse_neon_el_struct_list): Initialize fields of firsttype.

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

end of thread, other threads:[~2016-04-29 14:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-29 14:38 [PATCH][ARM][gas] Fix warnings about uninitialised uses and unused const variables Kyrill Tkachov
2016-04-29 14:39 ` Kyrill Tkachov

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).