From 6cf5881044dcf60e556c9667a878bcb7e5834017 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 13 Apr 2019 17:20:46 +0200 Subject: [PATCH] re PR target/89093 (C++ exception handling clobbers d8 VFP register) PR target/89093 * config/arm/arm.c (arm_valid_target_attribute_rec): Use strcmp instead of strncmp when checking for thumb and arm. Formatting fixes. * gcc.target/arm/pr89093.c: New test. From-SVN: r270339 --- gcc/ChangeLog | 6 ++++++ gcc/config/arm/arm.c | 12 ++++++------ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/arm/pr89093.c | 7 +++++++ 4 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arm/pr89093.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 83e595453be..6a394b8ce0f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-04-13 Jakub Jelinek + + PR target/89093 + * config/arm/arm.c (arm_valid_target_attribute_rec): Use strcmp + instead of strncmp when checking for thumb and arm. Formatting fixes. + 2019-04-12 Iain Buclaw * doc/install.texi: Document --with-target-system-zlib. diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 12ccb7d6901..9cda96ae84a 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -30874,16 +30874,16 @@ arm_valid_target_attribute_rec (tree args, struct gcc_options *opts) while (ISSPACE (*q)) ++q; argstr = NULL; - if (!strncmp (q, "thumb", 5)) - opts->x_target_flags |= MASK_THUMB; + if (!strcmp (q, "thumb")) + opts->x_target_flags |= MASK_THUMB; - else if (!strncmp (q, "arm", 3)) - opts->x_target_flags &= ~MASK_THUMB; + else if (!strcmp (q, "arm")) + opts->x_target_flags &= ~MASK_THUMB; else if (!strncmp (q, "fpu=", 4)) { int fpu_index; - if (! opt_enum_arg_to_value (OPT_mfpu_, q+4, + if (! opt_enum_arg_to_value (OPT_mfpu_, q + 4, &fpu_index, CL_TARGET)) { error ("invalid fpu for target attribute or pragma %qs", q); @@ -30901,7 +30901,7 @@ arm_valid_target_attribute_rec (tree args, struct gcc_options *opts) } else if (!strncmp (q, "arch=", 5)) { - char* arch = q+5; + char *arch = q + 5; const arch_option *arm_selected_arch = arm_parse_arch_option_name (all_architectures, "arch", arch); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2951fc82167..1f3dd43cb88 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-04-13 Jakub Jelinek + + PR target/89093 + * gcc.target/arm/pr89093.c: New test. + 2019-04-12 Jakub Jelinek PR c/89933 diff --git a/gcc/testsuite/gcc.target/arm/pr89093.c b/gcc/testsuite/gcc.target/arm/pr89093.c new file mode 100644 index 00000000000..2efefcfbc6e --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr89093.c @@ -0,0 +1,7 @@ +/* PR target/89093 */ +/* { dg-do compile } */ + +__attribute__((target ("arm.foobar"))) void f1 (void) {} /* { dg-error "unknown target attribute or pragma 'arm.foobar'" } */ +__attribute__((target ("thumbozoo1"))) void f2 (void) {} /* { dg-error "unknown target attribute or pragma 'thumbozoo1'" } */ +__attribute__((target ("arm,thumbique"))) void f3 (void) {} /* { dg-error "unknown target attribute or pragma 'thumbique'" } */ +__attribute__((target ("thumb981,arm"))) void f4 (void) {} /* { dg-error "unknown target attribute or pragma 'thumb981'" } */ -- 2.30.2