* [PATCH] Fix selftest for targets where short and int are the same size.
@ 2021-05-25 6:44 Aldy Hernandez
2021-05-25 13:15 ` Jeff Law
0 siblings, 1 reply; 4+ messages in thread
From: Aldy Hernandez @ 2021-05-25 6:44 UTC (permalink / raw)
To: GCC patches
avr-elf seems to use HImode for both integer_type_node and
signed_char_type_node, which is causing the check for different sized
VARYING ranges to fail.
I've fixed this by using a char which I think should always be smaller than an
int. Is there a preferred way of fixing this? Perhaps build_nonstandard_integer
or __attribute__((mode(XX)))?
Tested on an x86-64 x avr-elf.
gcc/ChangeLog:
* value-range.cc (range_tests_legacy): Use signed char instead
of signed short.
---
gcc/value-range.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 8d7b46c0239..5eefd5ff174 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -2251,10 +2251,10 @@ range_tests_legacy ()
// VARYING of different sizes should not be equal.
int_range_max r0 (integer_type_node);
- int_range_max r1 (short_integer_type_node);
+ int_range_max r1 (signed_char_type_node);
ASSERT_TRUE (r0 != r1);
value_range vr0 (integer_type_node);
- int_range_max vr1 (short_integer_type_node);
+ int_range_max vr1 (signed_char_type_node);
ASSERT_TRUE (vr0 != vr1);
}
--
2.31.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix selftest for targets where short and int are the same size.
2021-05-25 6:44 [PATCH] Fix selftest for targets where short and int are the same size Aldy Hernandez
@ 2021-05-25 13:15 ` Jeff Law
2021-05-25 16:36 ` Aldy Hernandez
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Law @ 2021-05-25 13:15 UTC (permalink / raw)
To: Aldy Hernandez, GCC patches
On 5/25/2021 12:44 AM, Aldy Hernandez wrote:
> avr-elf seems to use HImode for both integer_type_node and
> signed_char_type_node, which is causing the check for different sized
> VARYING ranges to fail.
>
> I've fixed this by using a char which I think should always be smaller than an
> int. Is there a preferred way of fixing this? Perhaps build_nonstandard_integer
> or __attribute__((mode(XX)))?
>
> Tested on an x86-64 x avr-elf.
>
> gcc/ChangeLog:
>
> * value-range.cc (range_tests_legacy): Use signed char instead
> of signed short.
As you note, I wonder if we should just creating our own types for this
test. In fact I wonder if that should be considered best practice for
these tests. Assumptions about the underlying sizes of the standard
types has been slightly problematical for the range self-tests.
The alternate approach would be to check the underlying sizes/signedness
and skip the tests when they don't give us what we need. But that seems
inferior to just creating a suitable type.
Jeff
ps. xstormy16-elf seems to be failing in the same way. I'll assume
it's the same problem ;-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix selftest for targets where short and int are the same size.
2021-05-25 13:15 ` Jeff Law
@ 2021-05-25 16:36 ` Aldy Hernandez
2021-05-25 17:10 ` Jeff Law
0 siblings, 1 reply; 4+ messages in thread
From: Aldy Hernandez @ 2021-05-25 16:36 UTC (permalink / raw)
To: Jeff Law; +Cc: GCC patches, Andrew MacLeod
[-- Attachment #1: Type: text/plain, Size: 1366 bytes --]
Ok, let's use build_nonstandard_integer_type which works for everyone
and gets you unblocked.
Pushed.
Aldy
On Tue, May 25, 2021 at 3:15 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
>
> On 5/25/2021 12:44 AM, Aldy Hernandez wrote:
> > avr-elf seems to use HImode for both integer_type_node and
> > signed_char_type_node, which is causing the check for different sized
> > VARYING ranges to fail.
> >
> > I've fixed this by using a char which I think should always be smaller than an
> > int. Is there a preferred way of fixing this? Perhaps build_nonstandard_integer
> > or __attribute__((mode(XX)))?
> >
> > Tested on an x86-64 x avr-elf.
> >
> > gcc/ChangeLog:
> >
> > * value-range.cc (range_tests_legacy): Use signed char instead
> > of signed short.
> As you note, I wonder if we should just creating our own types for this
> test. In fact I wonder if that should be considered best practice for
> these tests. Assumptions about the underlying sizes of the standard
> types has been slightly problematical for the range self-tests.
>
> The alternate approach would be to check the underlying sizes/signedness
> and skip the tests when they don't give us what we need. But that seems
> inferior to just creating a suitable type.
>
> Jeff
>
> ps. xstormy16-elf seems to be failing in the same way. I'll assume
> it's the same problem ;-)
>
[-- Attachment #2: latest.patch --]
[-- Type: text/x-patch, Size: 1259 bytes --]
commit 41ddc5b0a6b44a9df53a259636fa3b534ae41cbe
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Tue May 25 08:36:44 2021 +0200
Fix selftest for targets where short and int are the same size.
avr-elf seems to use HImode for both integer_type_node and
signed_char_type_node, which is causing the check for different sized
VARYING ranges to fail.
gcc/ChangeLog:
* value-range.cc (range_tests_legacy): Use
build_nonstandard_integer_type instead of int and short.
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 8d7b46c0239..f113fd7c905 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -2250,11 +2250,13 @@ range_tests_legacy ()
}
// VARYING of different sizes should not be equal.
- int_range_max r0 (integer_type_node);
- int_range_max r1 (short_integer_type_node);
+ tree big_type = build_nonstandard_integer_type (32, 1);
+ tree small_type = build_nonstandard_integer_type (16, 1);
+ int_range_max r0 (big_type);
+ int_range_max r1 (small_type);
ASSERT_TRUE (r0 != r1);
- value_range vr0 (integer_type_node);
- int_range_max vr1 (short_integer_type_node);
+ value_range vr0 (big_type);
+ int_range_max vr1 (small_type);
ASSERT_TRUE (vr0 != vr1);
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix selftest for targets where short and int are the same size.
2021-05-25 16:36 ` Aldy Hernandez
@ 2021-05-25 17:10 ` Jeff Law
0 siblings, 0 replies; 4+ messages in thread
From: Jeff Law @ 2021-05-25 17:10 UTC (permalink / raw)
To: Aldy Hernandez; +Cc: GCC patches, Andrew MacLeod
On 5/25/2021 10:36 AM, Aldy Hernandez wrote:
> Ok, let's use build_nonstandard_integer_type which works for everyone
> and gets you unblocked.
Just to be clear, I'm not blocked on xstormy16. The upstream GCC
tester flagged the failure and I did enough triage to blame you :-) In
my day job I'm working in another tree, so you can break the trunk
willy-nilly and it won't block me.
jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-25 17:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 6:44 [PATCH] Fix selftest for targets where short and int are the same size Aldy Hernandez
2021-05-25 13:15 ` Jeff Law
2021-05-25 16:36 ` Aldy Hernandez
2021-05-25 17:10 ` Jeff Law
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).