public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] add g_nonstandard_bool attribute for GIMPLE FE use
@ 2020-12-11  9:02 Richard Biener
  2020-12-13 17:35 ` Jeff Law
  2020-12-13 23:59 ` Martin Sebor
  0 siblings, 2 replies; 7+ messages in thread
From: Richard Biener @ 2020-12-11  9:02 UTC (permalink / raw)
  To: gcc-patches; +Cc: joseph

This adds __attribute__((g_nonstandard_bool(precision))) to be able
to construct nonstandard boolean types which for the included testcase
is needed to simulate Ada and LTO interaction (Ada uses a 8 bit
precision boolean_type_node).  This will also be useful for vector
unit testcases where we need to produce vector types with
non-standard boolean type components.

--

Joseph, is using attributes a good enough way to extend the set of C
types for use of the GIMPLE FE?  I chose to add a g_ prefix to
note use by the GIMPLE FE but since we can mix C and GIMPLE FE
functions in one TU those of course can leak into C functions
(and eventually lead to ICEs/issues there) - but the attribute is
simply ignored when not compiling with -fgimple.

I figured there's no documentation about GIMPLE FE "extensions",
I'll see to write something as followup (there's a small section
in sourcebuild.texi and the -fgimple docs itself).  I chose to
not document this attribute in the place we document attributes
supposed to be used in production.

OK for trunk?

I'll push the actual vectorizer fix for PR95582 separately, this
patch is only "needed" to add a testcase for the PR.

Thanks,
Richard.

2020-12-11  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/95582
gcc/c-family/
	* c-attribs.c (c_common_attribute_table): Add entry for
	g_nonstandard_bool.
	(handle_g_nonstandard_bool_attribute): New.

gcc/testsuite/
	* gcc.dg/pr95582.c: New testcase.
---
 gcc/c-family/c-attribs.c       | 41 ++++++++++++++++++++++++++++++++++
 gcc/testsuite/gcc.dg/pr95582.c | 19 ++++++++++++++++
 2 files changed, 60 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/pr95582.c

diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index f7dad7a91d7..be3009865b1 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -161,6 +161,8 @@ static tree handle_copy_attribute (tree *, tree, tree, int, bool *);
 static tree handle_nsobject_attribute (tree *, tree, tree, int, bool *);
 static tree handle_objc_root_class_attribute (tree *, tree, tree, int, bool *);
 static tree handle_objc_nullability_attribute (tree *, tree, tree, int, bool *);
+static tree handle_g_nonstandard_bool_attribute (tree *, tree, tree, int,
+						 bool *);
 
 /* Helper to define attribute exclusions.  */
 #define ATTR_EXCL(name, function, type, variable)	\
@@ -274,6 +276,8 @@ const struct attribute_spec c_common_attribute_table[] =
 {
   /* { name, min_len, max_len, decl_req, type_req, fn_type_req,
        affects_type_identity, handler, exclude } */
+  { "g_nonstandard_bool",     1, 1, false, true, false, true,
+			      handle_g_nonstandard_bool_attribute, NULL },
   { "packed",                 0, 0, false, false, false, false,
 			      handle_packed_attribute,
 	                      attr_aligned_exclusions },
@@ -894,6 +898,43 @@ validate_attr_arg (tree node[2], tree name, tree newarg)
 
 /* Attribute handlers common to C front ends.  */
 
+/* Handle a "g_nonstandard_bool" attribute; arguments as in
+   struct attribute_spec.handler.  */
+
+static tree
+handle_g_nonstandard_bool_attribute (tree *node, tree name, tree args,
+				     int ARG_UNUSED (flags), bool *no_add_attrs)
+{
+  *no_add_attrs = true;
+  if (!flag_gimple)
+    {
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
+      return NULL_TREE;
+    }
+
+  if (!TYPE_P (*node) || TREE_CODE (*node) != BOOLEAN_TYPE)
+    {
+      warning (OPT_Wattributes, "%qE attribute only supported on "
+	       "boolean types", name);
+      return NULL_TREE;
+    }
+
+  unsigned HOST_WIDE_INT prec = HOST_WIDE_INT_M1U;
+  if (tree_fits_uhwi_p (TREE_VALUE (args)))
+    prec = tree_to_uhwi (TREE_VALUE (args));
+  if (prec > MAX_FIXED_MODE_SIZE)
+    {
+      warning (OPT_Wattributes, "%qE attribute with unsupported boolean "
+	       "precision", name);
+      return NULL_TREE;
+    }
+
+  tree new_type = build_nonstandard_boolean_type (prec);
+  *node = lang_hooks.types.reconstruct_complex_type (*node, new_type);
+
+  return NULL_TREE;
+}
+
 /* Handle a "packed" attribute; arguments as in
    struct attribute_spec.handler.  */
 
diff --git a/gcc/testsuite/gcc.dg/pr95582.c b/gcc/testsuite/gcc.dg/pr95582.c
new file mode 100644
index 00000000000..cba3354557b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr95582.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fgimple -O3" } */
+
+typedef _Bool bool8 __attribute__((g_nonstandard_bool(8)));
+
+bool8 data[16];
+
+void __GIMPLE(ssa) foo(int f)
+{
+  _Bool t;
+  bool8 tp;
+
+__BB(2):
+   t_2 = f_1(D) != 0;
+   tp_3 = (bool8) t_2;
+   data[0] = tp_3;
+   data[1] = tp_3;
+   return;
+}
-- 
2.26.2

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] add g_nonstandard_bool attribute for GIMPLE FE use
  2020-12-11  9:02 [PATCH] add g_nonstandard_bool attribute for GIMPLE FE use Richard Biener
@ 2020-12-13 17:35 ` Jeff Law
  2020-12-13 23:59 ` Martin Sebor
  1 sibling, 0 replies; 7+ messages in thread
From: Jeff Law @ 2020-12-13 17:35 UTC (permalink / raw)
  To: Richard Biener, gcc-patches; +Cc: joseph



On 12/11/20 2:02 AM, Richard Biener wrote:
> This adds __attribute__((g_nonstandard_bool(precision))) to be able
> to construct nonstandard boolean types which for the included testcase
> is needed to simulate Ada and LTO interaction (Ada uses a 8 bit
> precision boolean_type_node).  This will also be useful for vector
> unit testcases where we need to produce vector types with
> non-standard boolean type components.
>
> --
>
> Joseph, is using attributes a good enough way to extend the set of C
> types for use of the GIMPLE FE?  I chose to add a g_ prefix to
> note use by the GIMPLE FE but since we can mix C and GIMPLE FE
> functions in one TU those of course can leak into C functions
> (and eventually lead to ICEs/issues there) - but the attribute is
> simply ignored when not compiling with -fgimple.
>
> I figured there's no documentation about GIMPLE FE "extensions",
> I'll see to write something as followup (there's a small section
> in sourcebuild.texi and the -fgimple docs itself).  I chose to
> not document this attribute in the place we document attributes
> supposed to be used in production.
>
> OK for trunk?
>
> I'll push the actual vectorizer fix for PR95582 separately, this
> patch is only "needed" to add a testcase for the PR.
>
> Thanks,
> Richard.
>
> 2020-12-11  Richard Biener  <rguenther@suse.de>
>
> 	PR tree-optimization/95582
> gcc/c-family/
> 	* c-attribs.c (c_common_attribute_table): Add entry for
> 	g_nonstandard_bool.
> 	(handle_g_nonstandard_bool_attribute): New.
>
> gcc/testsuite/
> 	* gcc.dg/pr95582.c: New testcase.
Looks reasonable to me -- the only place we might consider documenting
this would be in sourcebuild.texi as you mentioned since other
developers might want to do something similar.  I don't think we need
user level docs for this.

jeff


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] add g_nonstandard_bool attribute for GIMPLE FE use
  2020-12-11  9:02 [PATCH] add g_nonstandard_bool attribute for GIMPLE FE use Richard Biener
  2020-12-13 17:35 ` Jeff Law
@ 2020-12-13 23:59 ` Martin Sebor
  2020-12-16 22:04   ` Joseph Myers
  1 sibling, 1 reply; 7+ messages in thread
From: Martin Sebor @ 2020-12-13 23:59 UTC (permalink / raw)
  To: Richard Biener, gcc-patches; +Cc: joseph

On 12/11/20 2:02 AM, Richard Biener wrote:
> This adds __attribute__((g_nonstandard_bool(precision))) to be able
> to construct nonstandard boolean types which for the included testcase
> is needed to simulate Ada and LTO interaction (Ada uses a 8 bit
> precision boolean_type_node).  This will also be useful for vector
> unit testcases where we need to produce vector types with
> non-standard boolean type components.
> 
> --
> 
> Joseph, is using attributes a good enough way to extend the set of C
> types for use of the GIMPLE FE?  I chose to add a g_ prefix to
> note use by the GIMPLE FE but since we can mix C and GIMPLE FE
> functions in one TU those of course can leak into C functions
> (and eventually lead to ICEs/issues there) - but the attribute is
> simply ignored when not compiling with -fgimple.
> 
> I figured there's no documentation about GIMPLE FE "extensions",
> I'll see to write something as followup (there's a small section
> in sourcebuild.texi and the -fgimple docs itself).  I chose to
> not document this attribute in the place we document attributes
> supposed to be used in production.
> 
> OK for trunk?

"nonstandard" isn't a very descriptive name.  The leading g_ prefix
also looks a little too terse (is that supposed to stand dor GIMPLE?).
I would suggest choosing a better name, say, bool_precision.  Since
there's also a build_nonstandard_integer_type, if extending
the attribute to integers supported by the function could be similarly
useful then simply "precision" might be sufficient.

Martin

> 
> I'll push the actual vectorizer fix for PR95582 separately, this
> patch is only "needed" to add a testcase for the PR.
> 
> Thanks,
> Richard.
> 
> 2020-12-11  Richard Biener  <rguenther@suse.de>
> 
> 	PR tree-optimization/95582
> gcc/c-family/
> 	* c-attribs.c (c_common_attribute_table): Add entry for
> 	g_nonstandard_bool.
> 	(handle_g_nonstandard_bool_attribute): New.
> 
> gcc/testsuite/
> 	* gcc.dg/pr95582.c: New testcase.
> ---
>   gcc/c-family/c-attribs.c       | 41 ++++++++++++++++++++++++++++++++++
>   gcc/testsuite/gcc.dg/pr95582.c | 19 ++++++++++++++++
>   2 files changed, 60 insertions(+)
>   create mode 100644 gcc/testsuite/gcc.dg/pr95582.c
> 
> diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
> index f7dad7a91d7..be3009865b1 100644
> --- a/gcc/c-family/c-attribs.c
> +++ b/gcc/c-family/c-attribs.c
> @@ -161,6 +161,8 @@ static tree handle_copy_attribute (tree *, tree, tree, int, bool *);
>   static tree handle_nsobject_attribute (tree *, tree, tree, int, bool *);
>   static tree handle_objc_root_class_attribute (tree *, tree, tree, int, bool *);
>   static tree handle_objc_nullability_attribute (tree *, tree, tree, int, bool *);
> +static tree handle_g_nonstandard_bool_attribute (tree *, tree, tree, int,
> +						 bool *);
>   
>   /* Helper to define attribute exclusions.  */
>   #define ATTR_EXCL(name, function, type, variable)	\
> @@ -274,6 +276,8 @@ const struct attribute_spec c_common_attribute_table[] =
>   {
>     /* { name, min_len, max_len, decl_req, type_req, fn_type_req,
>          affects_type_identity, handler, exclude } */
> +  { "g_nonstandard_bool",     1, 1, false, true, false, true,
> +			      handle_g_nonstandard_bool_attribute, NULL },
>     { "packed",                 0, 0, false, false, false, false,
>   			      handle_packed_attribute,
>   	                      attr_aligned_exclusions },
> @@ -894,6 +898,43 @@ validate_attr_arg (tree node[2], tree name, tree newarg)
>   
>   /* Attribute handlers common to C front ends.  */
>   
> +/* Handle a "g_nonstandard_bool" attribute; arguments as in
> +   struct attribute_spec.handler.  */
> +
> +static tree
> +handle_g_nonstandard_bool_attribute (tree *node, tree name, tree args,
> +				     int ARG_UNUSED (flags), bool *no_add_attrs)
> +{
> +  *no_add_attrs = true;
> +  if (!flag_gimple)
> +    {
> +      warning (OPT_Wattributes, "%qE attribute ignored", name);
> +      return NULL_TREE;
> +    }
> +
> +  if (!TYPE_P (*node) || TREE_CODE (*node) != BOOLEAN_TYPE)
> +    {
> +      warning (OPT_Wattributes, "%qE attribute only supported on "
> +	       "boolean types", name);
> +      return NULL_TREE;
> +    }
> +
> +  unsigned HOST_WIDE_INT prec = HOST_WIDE_INT_M1U;
> +  if (tree_fits_uhwi_p (TREE_VALUE (args)))
> +    prec = tree_to_uhwi (TREE_VALUE (args));
> +  if (prec > MAX_FIXED_MODE_SIZE)
> +    {
> +      warning (OPT_Wattributes, "%qE attribute with unsupported boolean "
> +	       "precision", name);
> +      return NULL_TREE;
> +    }
> +
> +  tree new_type = build_nonstandard_boolean_type (prec);
> +  *node = lang_hooks.types.reconstruct_complex_type (*node, new_type);
> +
> +  return NULL_TREE;
> +}
> +
>   /* Handle a "packed" attribute; arguments as in
>      struct attribute_spec.handler.  */
>   
> diff --git a/gcc/testsuite/gcc.dg/pr95582.c b/gcc/testsuite/gcc.dg/pr95582.c
> new file mode 100644
> index 00000000000..cba3354557b
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/pr95582.c
> @@ -0,0 +1,19 @@
> +/* { dg-do compile } */
> +/* { dg-options "-fgimple -O3" } */
> +
> +typedef _Bool bool8 __attribute__((g_nonstandard_bool(8)));
> +
> +bool8 data[16];
> +
> +void __GIMPLE(ssa) foo(int f)
> +{
> +  _Bool t;
> +  bool8 tp;
> +
> +__BB(2):
> +   t_2 = f_1(D) != 0;
> +   tp_3 = (bool8) t_2;
> +   data[0] = tp_3;
> +   data[1] = tp_3;
> +   return;
> +}
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] add g_nonstandard_bool attribute for GIMPLE FE use
  2020-12-13 23:59 ` Martin Sebor
@ 2020-12-16 22:04   ` Joseph Myers
  2021-01-05 12:52     ` Richard Biener
  0 siblings, 1 reply; 7+ messages in thread
From: Joseph Myers @ 2020-12-16 22:04 UTC (permalink / raw)
  To: Martin Sebor; +Cc: Richard Biener, gcc-patches

On Sun, 13 Dec 2020, Martin Sebor via Gcc-patches wrote:

> "nonstandard" isn't a very descriptive name.  The leading g_ prefix
> also looks a little too terse (is that supposed to stand dor GIMPLE?).
> I would suggest choosing a better name, say, bool_precision.  Since

Indeed, g_ suggests the GLib API to me, so a name not involving g_ or 
"nonstandard" seems better.

The principle of a GIMPLE-front-end-specific attribute for this sort of 
thing seems reasonable to me.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] add g_nonstandard_bool attribute for GIMPLE FE use
  2020-12-16 22:04   ` Joseph Myers
@ 2021-01-05 12:52     ` Richard Biener
  2021-01-05 18:54       ` Joseph Myers
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Biener @ 2021-01-05 12:52 UTC (permalink / raw)
  To: Joseph Myers; +Cc: Martin Sebor, gcc-patches

On Wed, 16 Dec 2020, Joseph Myers wrote:

> On Sun, 13 Dec 2020, Martin Sebor via Gcc-patches wrote:
> 
> > "nonstandard" isn't a very descriptive name.  The leading g_ prefix
> > also looks a little too terse (is that supposed to stand dor GIMPLE?).
> > I would suggest choosing a better name, say, bool_precision.  Since
> 
> Indeed, g_ suggests the GLib API to me, so a name not involving g_ or 
> "nonstandard" seems better.
> 
> The principle of a GIMPLE-front-end-specific attribute for this sort of 
> thing seems reasonable to me.

OK, does "integral_precision" sound better?  (supposed to cover
INTEGRAL_TYPE_P types)  Or would "precision" be preferred (I used
g_ to not conflict with possible future C attributes).  Note that
GCCs "nonstandard boolean types" are signed as opposed to
bool which is unsigned so

typedef _Bool bool1 __attribute__((precision(1)));

would maybe result in a surprising result.  One alternative
would be to make the attribute have the signedness specified as well
(C doesn't accept 'unsigned _Bool' or 'signed _Bool') or
simply name the attribute "signed_bool_precision".  I guess the bool case
is really special compared to the desire to eventually allow
declaring of a 3 bit precision signed/unsigned integer type.

Allowing 'signed _Bool' with -fgimple might be another option
of course.

Thanks,
Richard.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] add g_nonstandard_bool attribute for GIMPLE FE use
  2021-01-05 12:52     ` Richard Biener
@ 2021-01-05 18:54       ` Joseph Myers
  2021-01-06  9:21         ` Richard Biener
  0 siblings, 1 reply; 7+ messages in thread
From: Joseph Myers @ 2021-01-05 18:54 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

On Tue, 5 Jan 2021, Richard Biener wrote:

> would maybe result in a surprising result.  One alternative
> would be to make the attribute have the signedness specified as well
> (C doesn't accept 'unsigned _Bool' or 'signed _Bool') or
> simply name the attribute "signed_bool_precision".  I guess the bool case
> is really special compared to the desire to eventually allow
> declaring of a 3 bit precision signed/unsigned integer type.
> 
> Allowing 'signed _Bool' with -fgimple might be another option
> of course.

Something that makes clear it's a signed boolean type with the given 
precision seems a good idea (I'd have assumed a nonstandard boolean type 
with a given precision was unsigned).

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] add g_nonstandard_bool attribute for GIMPLE FE use
  2021-01-05 18:54       ` Joseph Myers
@ 2021-01-06  9:21         ` Richard Biener
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Biener @ 2021-01-06  9:21 UTC (permalink / raw)
  To: Joseph Myers; +Cc: gcc-patches

On Tue, 5 Jan 2021, Joseph Myers wrote:

> On Tue, 5 Jan 2021, Richard Biener wrote:
> 
> > would maybe result in a surprising result.  One alternative
> > would be to make the attribute have the signedness specified as well
> > (C doesn't accept 'unsigned _Bool' or 'signed _Bool') or
> > simply name the attribute "signed_bool_precision".  I guess the bool case
> > is really special compared to the desire to eventually allow
> > declaring of a 3 bit precision signed/unsigned integer type.
> > 
> > Allowing 'signed _Bool' with -fgimple might be another option
> > of course.
> 
> Something that makes clear it's a signed boolean type with the given 
> precision seems a good idea (I'd have assumed a nonstandard boolean type 
> with a given precision was unsigned).

OK, I've used signed_bool_precision, re-bootstrapped and tested on
x86_64-unknown-linux-gnu and pushed as below.

Richard.

From c9ee9c1e3553247c776f33eb0fe0aadee094a192 Mon Sep 17 00:00:00 2001
From: Richard Biener <rguenther@suse.de>
Date: Fri, 11 Dec 2020 09:50:59 +0100
Subject: [PATCH] add signed_bool_precision attribute for GIMPLE FE use
To: gcc-patches@gcc.gnu.org

This adds __attribute__((signed_bool_precision(precision))) to be able
to construct nonstandard boolean types which for the included testcase
is needed to simulate Ada and LTO interaction (Ada uses a 8 bit
precision boolean_type_node).  This will also be useful for vector
unit testcases where we need to produce vector types with
non-standard precision signed boolean type components.

2021-01-06  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/95582
gcc/c-family/
	* c-attribs.c (c_common_attribute_table): Add entry for
	signed_bool_precision.
	(handle_signed_bool_precision_attribute): New.

gcc/testsuite/
	* gcc.dg/pr95582.c: New testcase.
---
 gcc/c-family/c-attribs.c       | 41 ++++++++++++++++++++++++++++++++++
 gcc/testsuite/gcc.dg/pr95582.c | 19 ++++++++++++++++
 2 files changed, 60 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/pr95582.c

diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index ef7cec9b2e8..84ec86b2091 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -161,6 +161,8 @@ static tree handle_copy_attribute (tree *, tree, tree, int, bool *);
 static tree handle_nsobject_attribute (tree *, tree, tree, int, bool *);
 static tree handle_objc_root_class_attribute (tree *, tree, tree, int, bool *);
 static tree handle_objc_nullability_attribute (tree *, tree, tree, int, bool *);
+static tree handle_signed_bool_precision_attribute (tree *, tree, tree, int,
+						    bool *);
 
 /* Helper to define attribute exclusions.  */
 #define ATTR_EXCL(name, function, type, variable)	\
@@ -274,6 +276,8 @@ const struct attribute_spec c_common_attribute_table[] =
 {
   /* { name, min_len, max_len, decl_req, type_req, fn_type_req,
        affects_type_identity, handler, exclude } */
+  { "signed_bool_precision",  1, 1, false, true, false, true,
+			      handle_signed_bool_precision_attribute, NULL },
   { "packed",                 0, 0, false, false, false, false,
 			      handle_packed_attribute,
 	                      attr_aligned_exclusions },
@@ -894,6 +898,43 @@ validate_attr_arg (tree node[2], tree name, tree newarg)
 
 /* Attribute handlers common to C front ends.  */
 
+/* Handle a "signed_bool_precision" attribute; arguments as in
+   struct attribute_spec.handler.  */
+
+static tree
+handle_signed_bool_precision_attribute (tree *node, tree name, tree args,
+					int, bool *no_add_attrs)
+{
+  *no_add_attrs = true;
+  if (!flag_gimple)
+    {
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
+      return NULL_TREE;
+    }
+
+  if (!TYPE_P (*node) || TREE_CODE (*node) != BOOLEAN_TYPE)
+    {
+      warning (OPT_Wattributes, "%qE attribute only supported on "
+	       "boolean types", name);
+      return NULL_TREE;
+    }
+
+  unsigned HOST_WIDE_INT prec = HOST_WIDE_INT_M1U;
+  if (tree_fits_uhwi_p (TREE_VALUE (args)))
+    prec = tree_to_uhwi (TREE_VALUE (args));
+  if (prec > MAX_FIXED_MODE_SIZE)
+    {
+      warning (OPT_Wattributes, "%qE attribute with unsupported boolean "
+	       "precision", name);
+      return NULL_TREE;
+    }
+
+  tree new_type = build_nonstandard_boolean_type (prec);
+  *node = lang_hooks.types.reconstruct_complex_type (*node, new_type);
+
+  return NULL_TREE;
+}
+
 /* Handle a "packed" attribute; arguments as in
    struct attribute_spec.handler.  */
 
diff --git a/gcc/testsuite/gcc.dg/pr95582.c b/gcc/testsuite/gcc.dg/pr95582.c
new file mode 100644
index 00000000000..cc2ab46ec95
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr95582.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fgimple -O3" } */
+
+typedef _Bool bool8 __attribute__((signed_bool_precision(8)));
+
+bool8 data[16];
+
+void __GIMPLE(ssa) foo(int f)
+{
+  _Bool t;
+  bool8 tp;
+
+__BB(2):
+   t_2 = f_1(D) != 0;
+   tp_3 = (bool8) t_2;
+   data[0] = tp_3;
+   data[1] = tp_3;
+   return;
+}
-- 
2.26.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-01-06  9:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11  9:02 [PATCH] add g_nonstandard_bool attribute for GIMPLE FE use Richard Biener
2020-12-13 17:35 ` Jeff Law
2020-12-13 23:59 ` Martin Sebor
2020-12-16 22:04   ` Joseph Myers
2021-01-05 12:52     ` Richard Biener
2021-01-05 18:54       ` Joseph Myers
2021-01-06  9:21         ` Richard Biener

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).