public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Testsuite, LTO: silence warning to make test pass on Darwin
@ 2023-08-20 10:24 FX Coudert
  2023-08-21  7:26 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: FX Coudert @ 2023-08-20 10:24 UTC (permalink / raw)
  To: gcc-patches; +Cc: Iain Sandoe

[-- Attachment #1: Type: text/plain, Size: 1285 bytes --]

Hi,

On darwin (both x86_64-apple-darwin and aarch64-apple-darwin) we see the following test failure:

FAIL: gcc.dg/lto/20091013-1 c_lto_20091013-1_2.o assemble, -fPIC -r -nostdlib -O2 -flto

which is due to this extra warning:

In function 'fontcmp',
    inlined from 'find_in_cache' at /tmp/gcc-darwin-arm64/gcc/testsuite/gcc.dg/lto/20091013-1_2.c:140:13,
    inlined from 'WineEngCreateFontInstance' at /tmp/gcc-darwin-arm64/gcc/testsuite/gcc.dg/lto/20091013-1_2.c:160:15:
/tmp/gcc-darwin-arm64/gcc/testsuite/gcc.dg/lto/20091013-1_2.c:107:8: warning: 'memcmp' specified bound 4 exceeds source size 0 [-Wst
ringop-overread]
/tmp/gcc-darwin-arm64/gcc/testsuite/gcc.dg/lto/20091013-1_2.c: In function 'WineEngCreateFontInstance':
/tmp/gcc-darwin-arm64/gcc/testsuite/gcc.dg/lto/20091013-1_2.c:66:20: note: source object allocated here

Now, the main file for the test has:

/* { dg-extra-ld-options "-flinker-output=nolto-rel -Wno-stringop-overread" } */

and I believe the intent of -Wno-stringop-overread is to silence this warning, but that only applies to the linker, and the warning on darwin is produced by the compiler (in addition to the linker). Adding the flag to the compilation of the source file makes the test pass on darwin.

OK to commit?
FX



[-- Attachment #2: 0001-Testsuite-LTO-silence-warning-to-make-test-pass-on-D.patch --]
[-- Type: application/octet-stream, Size: 846 bytes --]

From 4aa64187fa35dcb9a23d66ef875cf1bab4937c55 Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gmail.com>
Date: Sun, 20 Aug 2023 12:17:50 +0200
Subject: [PATCH] Testsuite, LTO: silence warning to make test pass on Darwin

gcc/testsuite/ChangeLog:

	* gcc.dg/lto/20091013-1_2.c: Add -Wno-stringop-overread.
---
 gcc/testsuite/gcc.dg/lto/20091013-1_2.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/lto/20091013-1_2.c b/gcc/testsuite/gcc.dg/lto/20091013-1_2.c
index 1af49aa97b6..89caea868e6 100644
--- a/gcc/testsuite/gcc.dg/lto/20091013-1_2.c
+++ b/gcc/testsuite/gcc.dg/lto/20091013-1_2.c
@@ -1,3 +1,5 @@
+/* { dg-options "-Wno-stringop-overread" } */
+
 typedef struct HDC__ { int unused; } *HDC;
 typedef struct HFONT__ { int unused; } *HFONT;
 
-- 
2.39.2 (Apple Git-143)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Testsuite, LTO: silence warning to make test pass on Darwin
  2023-08-20 10:24 [PATCH] Testsuite, LTO: silence warning to make test pass on Darwin FX Coudert
@ 2023-08-21  7:26 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2023-08-21  7:26 UTC (permalink / raw)
  To: FX Coudert; +Cc: gcc-patches, Iain Sandoe

On Sun, Aug 20, 2023 at 12:24 PM FX Coudert via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi,
>
> On darwin (both x86_64-apple-darwin and aarch64-apple-darwin) we see the following test failure:
>
> FAIL: gcc.dg/lto/20091013-1 c_lto_20091013-1_2.o assemble, -fPIC -r -nostdlib -O2 -flto
>
> which is due to this extra warning:
>
> In function 'fontcmp',
>     inlined from 'find_in_cache' at /tmp/gcc-darwin-arm64/gcc/testsuite/gcc.dg/lto/20091013-1_2.c:140:13,
>     inlined from 'WineEngCreateFontInstance' at /tmp/gcc-darwin-arm64/gcc/testsuite/gcc.dg/lto/20091013-1_2.c:160:15:
> /tmp/gcc-darwin-arm64/gcc/testsuite/gcc.dg/lto/20091013-1_2.c:107:8: warning: 'memcmp' specified bound 4 exceeds source size 0 [-Wst
> ringop-overread]
> /tmp/gcc-darwin-arm64/gcc/testsuite/gcc.dg/lto/20091013-1_2.c: In function 'WineEngCreateFontInstance':
> /tmp/gcc-darwin-arm64/gcc/testsuite/gcc.dg/lto/20091013-1_2.c:66:20: note: source object allocated here
>
> Now, the main file for the test has:
>
> /* { dg-extra-ld-options "-flinker-output=nolto-rel -Wno-stringop-overread" } */
>
> and I believe the intent of -Wno-stringop-overread is to silence this warning, but that only applies to the linker, and the warning on darwin is produced by the compiler (in addition to the linker). Adding the flag to the compilation of the source file makes the test pass on darwin.

In the end this is because darwin is -ffat-lto-objects and not using
the linker plugin(?)

> OK to commit?

OK.

Thanks,
Richard.

> FX
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-21  7:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-20 10:24 [PATCH] Testsuite, LTO: silence warning to make test pass on Darwin FX Coudert
2023-08-21  7:26 ` Richard Biener

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).