pan/bi: Fix infinite loop parsing arguments for bifrost_compiler
authorIcecream95 <ixn@disroot.org>
Sat, 31 Jul 2021 01:21:54 +0000 (13:21 +1200)
committerMarge Bot <eric+marge@anholt.net>
Sun, 1 Aug 2021 13:04:20 +0000 (13:04 +0000)
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

index 7aa9871..fcc5de9 100644 (file)
@@ -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");