From: Dimitar Dimitrov Date: Sun, 3 Apr 2022 10:41:04 +0000 (+0300) Subject: testsuite: mallign: Handle word size of 1 byte X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e6c04ac9fd9c7b5538a6f5f45e5f9dc22954764b;p=platform%2Fupstream%2Fgcc.git testsuite: mallign: Handle word size of 1 byte This patch fixes a spurious warning for the pru-unknown-elf target: gcc/testsuite/gcc.dg/mallign.c:12:27: warning: ignoring return value of 'malloc' declared with attribute 'warn_unused_result' [-Wunused-result] For 8-bit targets the resulting mask ignores all bits in the value returned by malloc. Fix by first checking the target word size. gcc/testsuite/ChangeLog: * gcc.dg/mallign.c: Skip check if sizeof(word)==1. Signed-off-by: Dimitar Dimitrov --- diff --git a/gcc/testsuite/gcc.dg/mallign.c b/gcc/testsuite/gcc.dg/mallign.c index 349cdaa..9a18a00 100644 --- a/gcc/testsuite/gcc.dg/mallign.c +++ b/gcc/testsuite/gcc.dg/mallign.c @@ -9,7 +9,7 @@ typedef int word __attribute__((mode(word))); int main() { - if ((__UINTPTR_TYPE__)malloc (1) & (sizeof(word)-1)) + if ((sizeof(word)>1) && ((__UINTPTR_TYPE__)malloc (1) & (sizeof(word)-1))) abort (); return 0; }