Mesa (main): pan/bi: Fix infinite loop parsing arguments for bifrost_compiler

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Aug 1 13:17:00 UTC 2021


Module: Mesa
Branch: main
Commit: 490d09f1a4971cae64ba393a27fc3ce52794a686
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=490d09f1a4971cae64ba393a27fc3ce52794a686

Author: Icecream95 <ixn at disroot.org>
Date:   Sat Jul 31 13:21:54 2021 +1200

pan/bi: Fix infinite loop parsing arguments for bifrost_compiler

While char is signed on macOS AArch64, on Linux it is unsigned. This
means it cannot represent the -1 return value of getopt_long.

Change the type of `c` to int, the type that getopt_long returns, so
that the -1 will be kept intact and can be checked for.

Fixes: c6be4f85e3c ("pan/bi: Use getopt for bifrost_compiler")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12153>

---

 src/panfrost/bifrost/cmdline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/panfrost/bifrost/cmdline.c b/src/panfrost/bifrost/cmdline.c
index 7aa98715d55..fcc5de92a1c 100644
--- a/src/panfrost/bifrost/cmdline.c
+++ b/src/panfrost/bifrost/cmdline.c
@@ -252,7 +252,7 @@ disassemble(const char *filename)
 int
 main(int argc, char **argv)
 {
-        char c;
+        int c;
 
         if (argc < 2) {
                 printf("Pass a command\n");



More information about the mesa-commit mailing list