public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/110193] New: d_signed_or_unsigned_type is invoked for vector types
@ 2023-06-09 13:06 rguenth at gcc dot gnu.org
2023-06-09 14:59 ` [Bug d/110193] " pinskia at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-09 13:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110193
Bug ID: 110193
Summary: d_signed_or_unsigned_type is invoked for vector types
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: d
Assignee: ibuclaw at gdcproject dot org
Reporter: rguenth at gcc dot gnu.org
Target Milestone: ---
It looks like this function (via a langhook) is invoked on VECTOR_TYPE and
the implementation assumes it works on integer types only:
if (TYPE_PRECISION (type) == TYPE_PRECISION (d_cent_type))
return unsignedp ? d_ucent_type : d_cent_type;
if (TYPE_PRECISION (type) == TYPE_PRECISION (d_long_type))
return unsignedp ? d_ulong_type : d_long_type;
...
TYPE_PRECISION for vectors is TYPE_VECTOR_SUBPARTS so in this case
for any V8mode vector we'd return d_{u,}cent_type. The C familiy
frontend similar routine does
type1 = TYPE_MAIN_VARIANT (type);
if (type1 == signed_char_type_node || type1 == char_type_node || type1 ==
unsigned_char_type_node)
return unsignedp ? unsigned_char_type_node : signed_char_type_node;
if (type1 == integer_type_node || type1 == unsigned_type_node)
return unsignedp ? unsigned_type_node : integer_type_node;
...
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug d/110193] d_signed_or_unsigned_type is invoked for vector types
2023-06-09 13:06 [Bug d/110193] New: d_signed_or_unsigned_type is invoked for vector types rguenth at gcc dot gnu.org
@ 2023-06-09 14:59 ` pinskia at gcc dot gnu.org
2023-06-10 18:25 ` ibuclaw at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-09 14:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110193
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-06-09
Keywords| |wrong-code
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug d/110193] d_signed_or_unsigned_type is invoked for vector types
2023-06-09 13:06 [Bug d/110193] New: d_signed_or_unsigned_type is invoked for vector types rguenth at gcc dot gnu.org
2023-06-09 14:59 ` [Bug d/110193] " pinskia at gcc dot gnu.org
@ 2023-06-10 18:25 ` ibuclaw at gcc dot gnu.org
2023-06-10 18:40 ` ibuclaw at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ibuclaw at gcc dot gnu.org @ 2023-06-10 18:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110193
ibuclaw at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ibuclaw at gcc dot gnu.org
--- Comment #2 from ibuclaw at gcc dot gnu.org ---
Just having a cursory look, the only references to d_signed_or_unsigned_type is
via d_unsigned_type and d_signed_type.
The former is only called by d_gimplify_unsigned_rshift_expr.
So I guess you must mean you've noticed this with something like.
__vector(int[4]) unsigned_rshift(__vector(int[4]) v)
{
return v >>> 2;
}
It turns out that this accident doesn't affect the intent on x86.
https://d.godbolt.org/z/99fK7fWaW
Gimple dump:
---
__vector(int[4]) rshift (__vector(int[4]) v)
{
__vector(int[4]) D.1795;
_1 = VIEW_CONVERT_EXPR<vector(4) unsigned int>(v);
_2 = _1 >> 2;
D.1795 = VIEW_CONVERT_EXPR<__vector(int[4])>(_2);
return D.1795;
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug d/110193] d_signed_or_unsigned_type is invoked for vector types
2023-06-09 13:06 [Bug d/110193] New: d_signed_or_unsigned_type is invoked for vector types rguenth at gcc dot gnu.org
2023-06-09 14:59 ` [Bug d/110193] " pinskia at gcc dot gnu.org
2023-06-10 18:25 ` ibuclaw at gcc dot gnu.org
@ 2023-06-10 18:40 ` ibuclaw at gcc dot gnu.org
2023-06-10 18:42 ` ibuclaw at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ibuclaw at gcc dot gnu.org @ 2023-06-10 18:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110193
--- Comment #3 from ibuclaw at gcc dot gnu.org ---
(In reply to ibuclaw from comment #2)
> Gimple dump:
> ---
> __vector(int[4]) rshift (__vector(int[4]) v)
> {
> __vector(int[4]) D.1795;
>
> _1 = VIEW_CONVERT_EXPR<vector(4) unsigned int>(v);
> _2 = _1 >> 2;
> D.1795 = VIEW_CONVERT_EXPR<__vector(int[4])>(_2);
> return D.1795;
> }
I've just realized that I wasn't reading this code dump properly. Everything
looks correct here.
I've a look again and picked at random vector E_V8HImode, that has a precision
of 3. Whereas a cent has a precision of 128.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug d/110193] d_signed_or_unsigned_type is invoked for vector types
2023-06-09 13:06 [Bug d/110193] New: d_signed_or_unsigned_type is invoked for vector types rguenth at gcc dot gnu.org
` (2 preceding siblings ...)
2023-06-10 18:40 ` ibuclaw at gcc dot gnu.org
@ 2023-06-10 18:42 ` ibuclaw at gcc dot gnu.org
2023-06-12 7:58 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ibuclaw at gcc dot gnu.org @ 2023-06-10 18:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110193
--- Comment #4 from ibuclaw at gcc dot gnu.org ---
A shortcut to signed_or_unsigned_type_for for vector types seems reasonable
nonetheless.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug d/110193] d_signed_or_unsigned_type is invoked for vector types
2023-06-09 13:06 [Bug d/110193] New: d_signed_or_unsigned_type is invoked for vector types rguenth at gcc dot gnu.org
` (3 preceding siblings ...)
2023-06-10 18:42 ` ibuclaw at gcc dot gnu.org
@ 2023-06-12 7:58 ` rguenth at gcc dot gnu.org
2023-06-28 15:53 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-12 7:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110193
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
I noticed this by instrumenting TYPE_PRECISION and ICEing when applied on
VECTOR_TYPEs.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug d/110193] d_signed_or_unsigned_type is invoked for vector types
2023-06-09 13:06 [Bug d/110193] New: d_signed_or_unsigned_type is invoked for vector types rguenth at gcc dot gnu.org
` (4 preceding siblings ...)
2023-06-12 7:58 ` rguenth at gcc dot gnu.org
@ 2023-06-28 15:53 ` cvs-commit at gcc dot gnu.org
2023-06-28 16:28 ` ibuclaw at gcc dot gnu.org
2023-06-29 8:16 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-28 15:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110193
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain Buclaw <ibuclaw@gcc.gnu.org>:
https://gcc.gnu.org/g:9757e4440bd8755d327601a60a73d57d712583ed
commit r14-2168-g9757e4440bd8755d327601a60a73d57d712583ed
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Wed Jun 28 17:38:16 2023 +0200
d: Fix d_signed_or_unsigned_type is invoked for vector types (PR110193)
This function can be invoked on VECTOR_TYPE, but the implementation
assumes it works on integer types only. To fix, added a check whether
the type passed is any `__vector(T)' or non-integral type, and return
early by calling `signed_or_unsigned_type_for()' instead.
Problem was found by instrumenting TYPE_PRECISION and ICEing when
applied on VECTOR_TYPEs.
PR d/110193
gcc/d/ChangeLog:
* types.cc (d_signed_or_unsigned_type): Handle being called with
any
vector or non-integral type.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug d/110193] d_signed_or_unsigned_type is invoked for vector types
2023-06-09 13:06 [Bug d/110193] New: d_signed_or_unsigned_type is invoked for vector types rguenth at gcc dot gnu.org
` (5 preceding siblings ...)
2023-06-28 15:53 ` cvs-commit at gcc dot gnu.org
@ 2023-06-28 16:28 ` ibuclaw at gcc dot gnu.org
2023-06-29 8:16 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: ibuclaw at gcc dot gnu.org @ 2023-06-28 16:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110193
ibuclaw at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from ibuclaw at gcc dot gnu.org ---
Fix committed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug d/110193] d_signed_or_unsigned_type is invoked for vector types
2023-06-09 13:06 [Bug d/110193] New: d_signed_or_unsigned_type is invoked for vector types rguenth at gcc dot gnu.org
` (6 preceding siblings ...)
2023-06-28 16:28 ` ibuclaw at gcc dot gnu.org
@ 2023-06-29 8:16 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-29 8:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110193
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ro at gcc dot gnu.org
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
*** Bug 110480 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-06-29 8:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-09 13:06 [Bug d/110193] New: d_signed_or_unsigned_type is invoked for vector types rguenth at gcc dot gnu.org
2023-06-09 14:59 ` [Bug d/110193] " pinskia at gcc dot gnu.org
2023-06-10 18:25 ` ibuclaw at gcc dot gnu.org
2023-06-10 18:40 ` ibuclaw at gcc dot gnu.org
2023-06-10 18:42 ` ibuclaw at gcc dot gnu.org
2023-06-12 7:58 ` rguenth at gcc dot gnu.org
2023-06-28 15:53 ` cvs-commit at gcc dot gnu.org
2023-06-28 16:28 ` ibuclaw at gcc dot gnu.org
2023-06-29 8:16 ` rguenth at gcc dot gnu.org
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).