Repository: compiler-explorer/compiler-explorer (ts)

Issue:
[BUG]: .base64 is filtered by directive filter
### Describe the bug

Forwarded from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118524.
Select "arm64 gcc trunk". Compile the following C (or C++):
```
const char *a = "a\0\0b";
```
Look at the output and see it only shows .string under LC0 rather than including also the .base64.

### Steps to reproduce

Select "arm64 gcc trunk". Compile the following C (or C++):
```
const char *a = "a\0\0b";
```
Look at the output and see it only shows .string under LC0 rather than including also the .base64.

### Expected behavior

LC0 output should be
```
.LC0:
        .string "a"
        .base64 "AGIA"
```

### Reproduction link

https://godbolt.org/z/z1dff7q9x

### Screenshots

Not applicable

### Operating System

_No response_

### Browser version

_No response_

Pull request:
Support `.base64` as a data indicator.
Fixes #7280

@partouf I expect this will need a fix in the C++ code too, right?

Patch:
diff --git a/lib/parsers/asm-parser.ts b/lib/parsers/asm-parser.ts
index 70034d264..0b6af58da 100644
--- a/lib/parsers/asm-parser.ts
+++ b/lib/parsers/asm-parser.ts
@@ -99,7 +99,7 @@ export class AsmParser extends AsmRegex implements IAsmParser {
         this.labelFindMips = /[$.A-Z_a-z][\w$.]*/g;
         this.mipsLabelDefinition = /^\$[\w$.]+:/;
         this.dataDefn =
-            /^\s*\.(ascii|asciz|[1248]?byte|dc(?:\.[abdlswx])?|dcb(?:\.[bdlswx])?|ds(?:\.[bdlpswx])?|double|dword|fill|float|half|hword|int|long|octa|quad|short|single|skip|space|string(?:8|16|32|64)?|value|word|xword|zero)/;
+            /^\s*\.(ascii|asciz|base64|[1248]?byte|dc(?:\.[abdlswx])?|dcb(?:\.[bdlswx])?|ds(?:\.[bdlpswx])?|double|dword|fill|float|half|hword|int|long|octa|quad|short|single|skip|space|string(?:8|16|32|64)?|value|word|xword|zero)/;
         this.fileFind = /^\s*\.(?:cv_)?file\s+(\d+)\s+"([^"]+)"(\s+"([^"]+)")?.*/;
         // Opcode expression here matches LLVM-style opcodes of the form `%blah = opcode`
         this.hasOpcodeRe = /^\s*(%[$.A-Z_a-z][\w$.]*\s*=\s*)?[A-Za-z]/;


Test patch:
diff --git a/test/filters-cases/bug-7280.asm b/test/filters-cases/bug-7280.asm
new file mode 100644
index 000000000..f6e5260cc
--- /dev/null
+++ b/test/filters-cases/bug-7280.asm
@@ -0,0 +1,17 @@
+        .arch armv8-a
+        .file   "example.cpp"
+        .text
+        .global a
+        .section        .rodata
+        .align  3
+.LC0:
+        .string "a"
+        .base64 "AGIA"
+        .data
+        .align  3
+        .type   a, %object
+        .size   a, 8
+a:
+        .xword  .LC0
+        .ident  "GCC: (GNU) 15.0.1 20250115 (experimental)"
+        .section        .note.GNU-stack,"",@progbits
diff --git a/test/filters-cases/bug-7280.asm.binary.directives.labels.comments.json b/test/filters-cases/bug-7280.asm.binary.directives.labels.comments.json
new file mode 100644
index 000000000..720205208
--- /dev/null
+++ b/test/filters-cases/bug-7280.asm.binary.directives.labels.comments.json
@@ -0,0 +1,4 @@
+{
+  "asm": [],
+  "labelDefinitions": {}
+}
\ No newline at end of file
diff --git a/test/filters-cases/bug-7280.asm.directives.comments.json b/test/filters-cases/bug-7280.asm.directives.comments.json
new file mode 100644
index 000000000..805e10c8f
--- /dev/null
+++ b/test/filters-cases/bug-7280.asm.directives.comments.json
@@ -0,0 +1,49 @@
+{
+  "asm": [
+    {
+      "labels": [],
+      "source": null,
+      "text": ".LC0:"
+    },
+    {
+      "labels": [
+        {
+          "name": "a",
+          "range": {
+            "endCol": 19,
+            "startCol": 18
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .string \"a\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "        .base64 \"AGIA\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "a:"
+    },
+    {
+      "labels": [
+        {
+          "name": ".LC0",
+          "range": {
+            "endCol": 21,
+            "startCol": 17
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .xword  .LC0"
+    }
+  ],
+  "labelDefinitions": {
+    ".LC0": 1,
+    "a": 4
+  }
+}
\ No newline at end of file
diff --git a/test/filters-cases/bug-7280.asm.directives.json b/test/filters-cases/bug-7280.asm.directives.json
new file mode 100644
index 000000000..805e10c8f
--- /dev/null
+++ b/test/filters-cases/bug-7280.asm.directives.json
@@ -0,0 +1,49 @@
+{
+  "asm": [
+    {
+      "labels": [],
+      "source": null,
+      "text": ".LC0:"
+    },
+    {
+      "labels": [
+        {
+          "name": "a",
+          "range": {
+            "endCol": 19,
+            "startCol": 18
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .string \"a\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "        .base64 \"AGIA\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "a:"
+    },
+    {
+      "labels": [
+        {
+          "name": ".LC0",
+          "range": {
+            "endCol": 21,
+            "startCol": 17
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .xword  .LC0"
+    }
+  ],
+  "labelDefinitions": {
+    ".LC0": 1,
+    "a": 4
+  }
+}
\ No newline at end of file
diff --git a/test/filters-cases/bug-7280.asm.directives.labels.comments.json b/test/filters-cases/bug-7280.asm.directives.labels.comments.json
new file mode 100644
index 000000000..805e10c8f
--- /dev/null
+++ b/test/filters-cases/bug-7280.asm.directives.labels.comments.json
@@ -0,0 +1,49 @@
+{
+  "asm": [
+    {
+      "labels": [],
+      "source": null,
+      "text": ".LC0:"
+    },
+    {
+      "labels": [
+        {
+          "name": "a",
+          "range": {
+            "endCol": 19,
+            "startCol": 18
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .string \"a\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "        .base64 \"AGIA\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "a:"
+    },
+    {
+      "labels": [
+        {
+          "name": ".LC0",
+          "range": {
+            "endCol": 21,
+            "startCol": 17
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .xword  .LC0"
+    }
+  ],
+  "labelDefinitions": {
+    ".LC0": 1,
+    "a": 4
+  }
+}
\ No newline at end of file
diff --git a/test/filters-cases/bug-7280.asm.directives.labels.comments.library.dontMaskFilenames.json b/test/filters-cases/bug-7280.asm.directives.labels.comments.library.dontMaskFilenames.json
new file mode 100644
index 000000000..805e10c8f
--- /dev/null
+++ b/test/filters-cases/bug-7280.asm.directives.labels.comments.library.dontMaskFilenames.json
@@ -0,0 +1,49 @@
+{
+  "asm": [
+    {
+      "labels": [],
+      "source": null,
+      "text": ".LC0:"
+    },
+    {
+      "labels": [
+        {
+          "name": "a",
+          "range": {
+            "endCol": 19,
+            "startCol": 18
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .string \"a\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "        .base64 \"AGIA\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "a:"
+    },
+    {
+      "labels": [
+        {
+          "name": ".LC0",
+          "range": {
+            "endCol": 21,
+            "startCol": 17
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .xword  .LC0"
+    }
+  ],
+  "labelDefinitions": {
+    ".LC0": 1,
+    "a": 4
+  }
+}
\ No newline at end of file
diff --git a/test/filters-cases/bug-7280.asm.directives.labels.comments.library.json b/test/filters-cases/bug-7280.asm.directives.labels.comments.library.json
new file mode 100644
index 000000000..805e10c8f
--- /dev/null
+++ b/test/filters-cases/bug-7280.asm.directives.labels.comments.library.json
@@ -0,0 +1,49 @@
+{
+  "asm": [
+    {
+      "labels": [],
+      "source": null,
+      "text": ".LC0:"
+    },
+    {
+      "labels": [
+        {
+          "name": "a",
+          "range": {
+            "endCol": 19,
+            "startCol": 18
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .string \"a\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "        .base64 \"AGIA\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "a:"
+    },
+    {
+      "labels": [
+        {
+          "name": ".LC0",
+          "range": {
+            "endCol": 21,
+            "startCol": 17
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .xword  .LC0"
+    }
+  ],
+  "labelDefinitions": {
+    ".LC0": 1,
+    "a": 4
+  }
+}
\ No newline at end of file
diff --git a/test/filters-cases/bug-7280.asm.directives.labels.json b/test/filters-cases/bug-7280.asm.directives.labels.json
new file mode 100644
index 000000000..805e10c8f
--- /dev/null
+++ b/test/filters-cases/bug-7280.asm.directives.labels.json
@@ -0,0 +1,49 @@
+{
+  "asm": [
+    {
+      "labels": [],
+      "source": null,
+      "text": ".LC0:"
+    },
+    {
+      "labels": [
+        {
+          "name": "a",
+          "range": {
+            "endCol": 19,
+            "startCol": 18
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .string \"a\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "        .base64 \"AGIA\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "a:"
+    },
+    {
+      "labels": [
+        {
+          "name": ".LC0",
+          "range": {
+            "endCol": 21,
+            "startCol": 17
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .xword  .LC0"
+    }
+  ],
+  "labelDefinitions": {
+    ".LC0": 1,
+    "a": 4
+  }
+}
\ No newline at end of file
diff --git a/test/filters-cases/bug-7280.asm.directives.library.json b/test/filters-cases/bug-7280.asm.directives.library.json
new file mode 100644
index 000000000..805e10c8f
--- /dev/null
+++ b/test/filters-cases/bug-7280.asm.directives.library.json
@@ -0,0 +1,49 @@
+{
+  "asm": [
+    {
+      "labels": [],
+      "source": null,
+      "text": ".LC0:"
+    },
+    {
+      "labels": [
+        {
+          "name": "a",
+          "range": {
+            "endCol": 19,
+            "startCol": 18
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .string \"a\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "        .base64 \"AGIA\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "a:"
+    },
+    {
+      "labels": [
+        {
+          "name": ".LC0",
+          "range": {
+            "endCol": 21,
+            "startCol": 17
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .xword  .LC0"
+    }
+  ],
+  "labelDefinitions": {
+    ".LC0": 1,
+    "a": 4
+  }
+}
\ No newline at end of file
diff --git a/test/filters-cases/bug-7280.asm.none.json b/test/filters-cases/bug-7280.asm.none.json
new file mode 100644
index 000000000..d3d3c00b6
--- /dev/null
+++ b/test/filters-cases/bug-7280.asm.none.json
@@ -0,0 +1,141 @@
+{
+  "asm": [
+    {
+      "labels": [
+        {
+          "name": "a",
+          "range": {
+            "endCol": 22,
+            "startCol": 21
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .arch armv8-a"
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "        .file   \"example.cpp\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "        .text"
+    },
+    {
+      "labels": [
+        {
+          "name": "a",
+          "range": {
+            "endCol": 18,
+            "startCol": 17
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .global a"
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "        .section        .rodata"
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "        .align  3"
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": ".LC0:"
+    },
+    {
+      "labels": [
+        {
+          "name": "a",
+          "range": {
+            "endCol": 19,
+            "startCol": 18
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .string \"a\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "        .base64 \"AGIA\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "        .data"
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "        .align  3"
+    },
+    {
+      "labels": [
+        {
+          "name": "a",
+          "range": {
+            "endCol": 18,
+            "startCol": 17
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .type   a, %object"
+    },
+    {
+      "labels": [
+        {
+          "name": "a",
+          "range": {
+            "endCol": 18,
+            "startCol": 17
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .size   a, 8"
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "a:"
+    },
+    {
+      "labels": [
+        {
+          "name": ".LC0",
+          "range": {
+            "endCol": 21,
+            "startCol": 17
+          }
+        }
+      ],
+      "source": null,
+      "text": "        .xword  .LC0"
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "        .ident  \"GCC: (GNU) 15.0.1 20250115 (experimental)\""
+    },
+    {
+      "labels": [],
+      "source": null,
+      "text": "        .section        .note.GNU-stack,\"\",@progbits"
+    }
+  ],
+  "labelDefinitions": {
+    ".LC0": 7,
+    "a": 14
+  }
+}
\ No newline at end of file