]> git.ozlabs.org Git - ccan/commitdiff
configurator: fix bitshift tests (-fsanitize=undefined)
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 9 Jan 2023 02:14:22 +0000 (12:44 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 16 Mar 2023 23:22:47 +0000 (09:52 +1030)
```
configuratortest.c:5:24: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools/configurator/configurator.c

index f830cbca14eb3eb3a2f4070fc6564674a0428d2d..722a6f6928834e8e2df647bddbb28d96b59d5a83 100644 (file)
@@ -197,7 +197,7 @@ static const struct test base_tests[] = {
          "return __builtin_clzll(1) == (sizeof(long long)*8 - 1) ? 0 : 1;" },
        { "HAVE_BUILTIN_CTZ", "__builtin_ctz support",
          "INSIDE_MAIN", NULL, NULL,
-         "return __builtin_ctz(1 << (sizeof(int)*8 - 1)) == (sizeof(int)*8 - 1) ? 0 : 1;" },
+         "return __builtin_ctz(1U << (sizeof(int)*8 - 1)) == (sizeof(int)*8 - 1) ? 0 : 1;" },
        { "HAVE_BUILTIN_CTZL", "__builtin_ctzl support",
          "INSIDE_MAIN", NULL, NULL,
          "return __builtin_ctzl(1UL << (sizeof(long)*8 - 1)) == (sizeof(long)*8 - 1) ? 0 : 1;" },