public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-712] testsuite: mallign: Handle word size of 1 byte
@ 2022-05-23 15:46 Dimitar Dimitrov
0 siblings, 0 replies; only message in thread
From: Dimitar Dimitrov @ 2022-05-23 15:46 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e6c04ac9fd9c7b5538a6f5f45e5f9dc22954764b
commit r13-712-ge6c04ac9fd9c7b5538a6f5f45e5f9dc22954764b
Author: Dimitar Dimitrov <dimitar@dinux.eu>
Date: Sun Apr 3 13:41:04 2022 +0300
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 <dimitar@dinux.eu>
Diff:
---
gcc/testsuite/gcc.dg/mallign.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/testsuite/gcc.dg/mallign.c b/gcc/testsuite/gcc.dg/mallign.c
index 349cdaa343f..9a18a00c3b0 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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-23 15:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-23 15:46 [gcc r13-712] testsuite: mallign: Handle word size of 1 byte Dimitar Dimitrov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).