[3/8] Correctly check for arm condition codes when trying to filter out 'bic'

Message ID 1508013322-19428-3-git-send-email-martin@martin.st
State Committed
Headers show

Commit Message

Martin Storsjö Oct. 14, 2017, 8:35 p.m.
Since an empty condition code also is valid, this also matched for
any other string, since it matched the empty string. By making sure
the pattern matches the full string, we avoid that issue.

Thanks to the later is_arm_register check, this slipped through
earlier.
---
 gas-preprocessor.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Janne Grunau Oct. 18, 2017, 6:12 a.m. | #1
On 2017-10-14 23:35:17 +0300, Martin Storsjö wrote:
> Since an empty condition code also is valid, this also matched for
> any other string, since it matched the empty string. By making sure
> the pattern matches the full string, we avoid that issue.
> 
> Thanks to the later is_arm_register check, this slipped through
> earlier.
> ---
>  gas-preprocessor.pl | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
> index 2c9cd07..09fcf0e 100755
> --- a/gas-preprocessor.pl
> +++ b/gas-preprocessor.pl
> @@ -704,7 +704,7 @@ sub handle_serialized_line {
>          my $cond = $3;
>          my $label = $4;
>          # Don't interpret e.g. bic as b<cc> with ic as conditional code
> -        if ($cond =~ /|$arm_cond_codes/) {
> +        if ($cond =~ /^(|$arm_cond_codes)$/) {
>              if (exists $thumb_labels{$label}) {
>                  print ASMFILE ".thumb_func $label\n";
>              } else {
> @@ -871,7 +871,7 @@ sub handle_serialized_line {
>              my $width = $4;
>              my $target = $5;
>              # Don't interpret e.g. bic as b<cc> with ic as conditional code
> -            if ($cond !~ /|$arm_cond_codes/) {
> +            if ($cond !~ /^(|$arm_cond_codes)$/) {
>                  # Not actually a branch
>              } elsif ($target =~ /^(\d+)([bf])$/) {
>                  # The target is a local label

ok

Janne

Patch

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index 2c9cd07..09fcf0e 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -704,7 +704,7 @@  sub handle_serialized_line {
         my $cond = $3;
         my $label = $4;
         # Don't interpret e.g. bic as b<cc> with ic as conditional code
-        if ($cond =~ /|$arm_cond_codes/) {
+        if ($cond =~ /^(|$arm_cond_codes)$/) {
             if (exists $thumb_labels{$label}) {
                 print ASMFILE ".thumb_func $label\n";
             } else {
@@ -871,7 +871,7 @@  sub handle_serialized_line {
             my $width = $4;
             my $target = $5;
             # Don't interpret e.g. bic as b<cc> with ic as conditional code
-            if ($cond !~ /|$arm_cond_codes/) {
+            if ($cond !~ /^(|$arm_cond_codes)$/) {
                 # Not actually a branch
             } elsif ($target =~ /^(\d+)([bf])$/) {
                 # The target is a local label