[18/12] Handle BITINT_TYPE in build_{, minus_}one_cst [PR102989]

Message ID ZPbZGGqmV8L+/rni@tucnak
State Unresolved
Headers
Series None |

Checks

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

Commit Message

Jakub Jelinek Sept. 5, 2023, 7:30 a.m. UTC
  Hi!

Recent match.pd changes trigger ICE in build_minus_one_cst, apparently
I forgot to handle BITINT_TYPE in these (while I've handled it in
build_zero_cst).

Will commit as obvious together with the rest of the series when the last
patches are approved.

2023-09-05  Jakub Jelinek  <jakub@redhat.com>

	PR c/102989
	* tree.cc (build_one_cst, build_minus_one_cst): Handle BITINT_TYPE
	like INTEGER_TYPE.


	Jakub
  

Comments

Andrew Pinski Sept. 5, 2023, 9:42 p.m. UTC | #1
On Tue, Sep 5, 2023 at 12:31 AM Jakub Jelinek via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi!
>
> Recent match.pd changes trigger ICE in build_minus_one_cst, apparently
> I forgot to handle BITINT_TYPE in these (while I've handled it in
> build_zero_cst).
>
> Will commit as obvious together with the rest of the series when the last
> patches are approved.

I assume there was a testcase that will be added when _BitInt
front-end support gets added.

Thanks,
Andrew

>
> 2023-09-05  Jakub Jelinek  <jakub@redhat.com>
>
>         PR c/102989
>         * tree.cc (build_one_cst, build_minus_one_cst): Handle BITINT_TYPE
>         like INTEGER_TYPE.
>
> --- gcc/tree.cc.jj      2023-09-04 09:45:33.444059843 +0200
> +++ gcc/tree.cc 2023-09-05 08:57:31.420059962 +0200
> @@ -2546,7 +2546,7 @@ build_one_cst (tree type)
>      {
>      case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
>      case POINTER_TYPE: case REFERENCE_TYPE:
> -    case OFFSET_TYPE:
> +    case OFFSET_TYPE: case BITINT_TYPE:
>        return build_int_cst (type, 1);
>
>      case REAL_TYPE:
> @@ -2599,7 +2599,7 @@ build_minus_one_cst (tree type)
>      {
>      case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
>      case POINTER_TYPE: case REFERENCE_TYPE:
> -    case OFFSET_TYPE:
> +    case OFFSET_TYPE: case BITINT_TYPE:
>        return build_int_cst (type, -1);
>
>      case REAL_TYPE:
>
>         Jakub
>
  
Jakub Jelinek Sept. 5, 2023, 9:52 p.m. UTC | #2
On Tue, Sep 05, 2023 at 02:42:39PM -0700, Andrew Pinski wrote:
> On Tue, Sep 5, 2023 at 12:31 AM Jakub Jelinek via Gcc-patches
> > Recent match.pd changes trigger ICE in build_minus_one_cst, apparently
> > I forgot to handle BITINT_TYPE in these (while I've handled it in
> > build_zero_cst).
> >
> > Will commit as obvious together with the rest of the series when the last
> > patches are approved.
> 
> I assume there was a testcase that will be added when _BitInt
> front-end support gets added.

After working around the build_nonstandard_integer_type in match.pd (in that
case the single one, I know there are some others) the ICE was on
dg-torture/bitint-42.c at -O1/-Os, so no new testcase needs to be added.

	Jakub
  

Patch

--- gcc/tree.cc.jj	2023-09-04 09:45:33.444059843 +0200
+++ gcc/tree.cc	2023-09-05 08:57:31.420059962 +0200
@@ -2546,7 +2546,7 @@  build_one_cst (tree type)
     {
     case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
     case POINTER_TYPE: case REFERENCE_TYPE:
-    case OFFSET_TYPE:
+    case OFFSET_TYPE: case BITINT_TYPE:
       return build_int_cst (type, 1);
 
     case REAL_TYPE:
@@ -2599,7 +2599,7 @@  build_minus_one_cst (tree type)
     {
     case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
     case POINTER_TYPE: case REFERENCE_TYPE:
-    case OFFSET_TYPE:
+    case OFFSET_TYPE: case BITINT_TYPE:
       return build_int_cst (type, -1);
 
     case REAL_TYPE: