On x86-32 warn_ptrdiff_anti_range_add() and warn_int_anti_range()
degrade to the same function so ICF is folding the latter into a call
into the former.  This is causing no warnings to be emitted for
warn_int_anti_range.

Fixed by passing -fno-ipa-icf to the test.

Long term, we really should be finding a way to run these warning
passes earlier :-/.

Pushed.

On Thu, May 27, 2021 at 9:39 AM Christophe Lyon
<christophe.l...@linaro.org> wrote:
>
> Hi,
>
> On Tue, 25 May 2021 at 18:17, Aldy Hernandez via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
> >
> > Adjustments per discussion.
> >
> > OK pending tests?
> >
>
> The xfail removal causes failures on 32 bits platforms (eg arm, or
> aarch64 with -mabi=ilp32):
> FAIL: gcc.dg/Wstringop-overflow-55.c pr????? (test for warnings, line 86)
> FAIL: gcc.dg/Wstringop-overflow-55.c pr????? (test for warnings, line 94)
>
>
> Christophe
>
> > Aldy
>
From 95bef94c6c6c6cb7bf640068aea77c209bca7c65 Mon Sep 17 00:00:00 2001
From: Aldy Hernandez <al...@redhat.com>
Date: Thu, 27 May 2021 09:32:42 +0200
Subject: [PATCH] Tweak Wstringop-overflow-55.c test.

On x86-32 warn_ptrdiff_anti_range_add() and warn_int_anti_range()
degrade to the same function so ICF is folding the latter into a call
into the former.  This is causing no warnings to be emitted for
warn_int_anti_range.

Fixed by passing -fno-ipa-icf.

gcc/testsuite/ChangeLog:

	* gcc.dg/Wstringop-overflow-55.c: Pass -fno-ipa-icf.
---
 gcc/testsuite/gcc.dg/Wstringop-overflow-55.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow-55.c b/gcc/testsuite/gcc.dg/Wstringop-overflow-55.c
index 8df5cb629ae..c3c2dbe06dd 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow-55.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow-55.c
@@ -1,6 +1,6 @@
 /* Verify that offsets in "anti-ranges" are handled correctly.
    { dg-do compile }
-   { dg-options "-O2 -Wall -ftrack-macro-expansion=0" } */
+   { dg-options "-O2 -Wall -ftrack-macro-expansion=0 -fno-ipa-icf" } */
 
 typedef __PTRDIFF_TYPE__ ptrdiff_t;
 typedef __SIZE_TYPE__    size_t;
-- 
2.31.1

Reply via email to