[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Fix strict aliasing violation
From: |
Andreas Schwab |
Subject: |
[PATCH] Fix strict aliasing violation |
Date: |
Sat, 11 Apr 2020 22:05:36 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.90 (gnu/linux) |
* unit-tests/test-dl.c (test_fn_check): Avoid strict aliasing
violation.
---
unit-tests/test-dl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/unit-tests/test-dl.c b/unit-tests/test-dl.c
index d996bba5..51e73239 100644
--- a/unit-tests/test-dl.c
+++ b/unit-tests/test-dl.c
@@ -183,7 +183,7 @@ static void test_fn_check(void *fn, const char *expected)
{
char buf[16];
test_fn fn_p;
- *((void **) &fn_p) = fn;
+ fn_p = (test_fn)fn;
(*fn_p)(buf, sizeof(buf));
if (strncmp(buf, expected, 15) != 0)
abortmsg("Test function returned %s, expected %s", buf,
expected);
--
2.26.0
--
Andreas Schwab, SUSE Labs, address@hidden
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
- [PATCH] Fix strict aliasing violation,
Andreas Schwab <=