Fix 'gcc.dg/tree-ssa/return-value-range-1.c' (was: Propagate value ranges of return values)

Message ID 87v89v5pnp.fsf@euler.schwinge.homeip.net
State Unresolved
Headers
Series Fix 'gcc.dg/tree-ssa/return-value-range-1.c' (was: Propagate value ranges of return values) |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Thomas Schwinge Nov. 21, 2023, 11:09 a.m. UTC
  Hi!

On 2023-11-19T16:05:42+0100, Jan Hubicka <hubicka@ucw.cz> wrote:
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/tree-ssa/return-value-range-1.c
> @@ -0,0 +1,22 @@
> +/* { dg-do ling } */

    ERROR: gcc.dg/tree-ssa/return-value-range-1.c: 1: syntax error for " dg-do 1 ling "

With that fixed into 'dg-do link', and...

> +/* { dg-options "-O1 -dump-tree-evrp-details" } */

... that one fixed into '-fdump-tree-evrp-details', I then get:

    FAIL: gcc.dg/tree-ssa/return-value-range-1.c (test for excess errors)
    UNRESOLVED: gcc.dg/tree-ssa/return-value-range-1.c scan-tree-dump-times evrp "Recording return range" 2

    /tmp/ccTEuffl.o: In function `test':
    return-value-range-1.c:(.text+0x24): undefined reference to `link_error'

This disappears when switching from '-O1' to '-O2'.  OK to push the
attached "Fix 'gcc.dg/tree-ssa/return-value-range-1.c'"?  (..., or did
you intend something else, here?)


Grüße
 Thomas


> +__attribute__ ((__noinline__))
> +int a(char c)
> +{
> +     return c;
> +}
> +void link_error ();
> +
> +void
> +test(int d)
> +{
> +     if (a(d) > 200)
> +             link_error ();
> +}
> +int
> +main(int argc, char **argv)
> +{
> +     test(argc);
> +     return 0;
> +}
> +/* { dg-final { scan-tree-dump-times "Recording return range" 2 "evrp"} } */


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
  

Comments

Jan Hubicka Nov. 21, 2023, 12:18 p.m. UTC | #1
> Hi!
> 
> On 2023-11-19T16:05:42+0100, Jan Hubicka <hubicka@ucw.cz> wrote:
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.dg/tree-ssa/return-value-range-1.c
> > @@ -0,0 +1,22 @@
> > +/* { dg-do ling } */
> 
>     ERROR: gcc.dg/tree-ssa/return-value-range-1.c: 1: syntax error for " dg-do 1 ling "
> 
> With that fixed into 'dg-do link', and...
> 
> > +/* { dg-options "-O1 -dump-tree-evrp-details" } */
> 
> ... that one fixed into '-fdump-tree-evrp-details', I then get:
> 
>     FAIL: gcc.dg/tree-ssa/return-value-range-1.c (test for excess errors)
>     UNRESOLVED: gcc.dg/tree-ssa/return-value-range-1.c scan-tree-dump-times evrp "Recording return range" 2
> 
>     /tmp/ccTEuffl.o: In function `test':
>     return-value-range-1.c:(.text+0x24): undefined reference to `link_error'
> 
> This disappears when switching from '-O1' to '-O2'.  OK to push the
> attached "Fix 'gcc.dg/tree-ssa/return-value-range-1.c'"?  (..., or did
> you intend something else, here?)

Ah sorry for that - I looked for FAIl and missed the error.  Yes, the
change is OK.  Indeed -fipa-vrp is enabled only at -O2. (I think basic
non-dataflow VRP could be doable and effective even at -O1, but we don't
do that)
Honza
> 
> 
> Grüße
>  Thomas
> 
> 
> > +__attribute__ ((__noinline__))
> > +int a(char c)
> > +{
> > +     return c;
> > +}
> > +void link_error ();
> > +
> > +void
> > +test(int d)
> > +{
> > +     if (a(d) > 200)
> > +             link_error ();
> > +}
> > +int
> > +main(int argc, char **argv)
> > +{
> > +     test(argc);
> > +     return 0;
> > +}
> > +/* { dg-final { scan-tree-dump-times "Recording return range" 2 "evrp"} } */
> 
> 
> -----------------
> Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

> From f3a47339a9df9726da7e3c1daeadc216e1d5b365 Mon Sep 17 00:00:00 2001
> From: Thomas Schwinge <thomas@codesourcery.com>
> Date: Tue, 21 Nov 2023 11:51:42 +0100
> Subject: [PATCH] Fix 'gcc.dg/tree-ssa/return-value-range-1.c'
> 
> ... added in recent commit 53ba8d669550d3a1f809048428b97ca607f95cf5
> "inter-procedural value range propagation".
> 
> 	gcc/testsuite/
> 	* gcc.dg/tree-ssa/return-value-range-1.c: Fix.
> ---
>  gcc/testsuite/gcc.dg/tree-ssa/return-value-range-1.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/return-value-range-1.c b/gcc/testsuite/gcc.dg/tree-ssa/return-value-range-1.c
> index 4db52233c5d..74f1a5080bb 100644
> --- a/gcc/testsuite/gcc.dg/tree-ssa/return-value-range-1.c
> +++ b/gcc/testsuite/gcc.dg/tree-ssa/return-value-range-1.c
> @@ -1,5 +1,5 @@
> -/* { dg-do ling } */
> -/* { dg-options "-O1 -dump-tree-evrp-details" } */
> +/* { dg-do link } */
> +/* { dg-options "-O2 -fdump-tree-evrp-details" } */
>  __attribute__ ((__noinline__))
>  int a(char c)
>  {
> -- 
> 2.34.1
>
  

Patch

From f3a47339a9df9726da7e3c1daeadc216e1d5b365 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Tue, 21 Nov 2023 11:51:42 +0100
Subject: [PATCH] Fix 'gcc.dg/tree-ssa/return-value-range-1.c'

... added in recent commit 53ba8d669550d3a1f809048428b97ca607f95cf5
"inter-procedural value range propagation".

	gcc/testsuite/
	* gcc.dg/tree-ssa/return-value-range-1.c: Fix.
---
 gcc/testsuite/gcc.dg/tree-ssa/return-value-range-1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/return-value-range-1.c b/gcc/testsuite/gcc.dg/tree-ssa/return-value-range-1.c
index 4db52233c5d..74f1a5080bb 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/return-value-range-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/return-value-range-1.c
@@ -1,5 +1,5 @@ 
-/* { dg-do ling } */
-/* { dg-options "-O1 -dump-tree-evrp-details" } */
+/* { dg-do link } */
+/* { dg-options "-O2 -fdump-tree-evrp-details" } */
 __attribute__ ((__noinline__))
 int a(char c)
 {
-- 
2.34.1