On 2026-01-08 13:38, Richard Biener wrote:
On Thu, Jan 8, 2026 at 2:21 PM Peter Damianov <[email protected]>
wrote:
When compiling with -fopenmp-simd, there is an ICE if a function has a
return type of a typedef of void. (e.g., "typedef void T; T foo()").
Corrected by changing:
if (orig_rettype == void_type_node)
to :
if (VOID_TYPE_P (orig_rettype))
How did you test the patch?
By building the testcase I added in this patch, which ICE'd before.
You can find a link to a testsuite run here:
https://github.com/Peter0x44/gcc/actions/runs/20816498107/job/59793407852
There's also a bootstrap there as well.
It looks OK.
Thanks,
Richard.
gcc/ChangeLog:
PR middle-end/111856
* omp-simd-clone.cc (simd_clone_adjust_return_type): Use
VOID_TYPE_P instead of comparison with void_type_node.
(simd_clone_adjust): Likewise.
gcc/testsuite/ChangeLog:
PR middle-end/111856
* c-c++-common/gomp/pr111856.c: New test.
---
gcc/omp-simd-clone.cc | 4 ++--
gcc/testsuite/c-c++-common/gomp/pr111856.c | 12 ++++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/c-c++-common/gomp/pr111856.c
diff --git a/gcc/omp-simd-clone.cc b/gcc/omp-simd-clone.cc
index 630864d948f..55f92242a09 100644
--- a/gcc/omp-simd-clone.cc
+++ b/gcc/omp-simd-clone.cc
@@ -715,7 +715,7 @@ simd_clone_adjust_return_type (struct cgraph_node
*node)
tree t;
/* Adjust the function return type. */
- if (orig_rettype == void_type_node)
+ if (VOID_TYPE_P (orig_rettype))
return;
t = TREE_TYPE (TREE_TYPE (fndecl));
if (INTEGRAL_TYPE_P (t) || POINTER_TYPE_P (t))
@@ -1370,7 +1370,7 @@ simd_clone_adjust (struct cgraph_node *node)
simd_clone_adjust_argument_types (node);
targetm.simd_clone.adjust (node);
tree retval = NULL_TREE;
- if (orig_rettype != void_type_node)
+ if (!VOID_TYPE_P (orig_rettype))
{
poly_uint64 veclen;
if (INTEGRAL_TYPE_P (orig_rettype) || POINTER_TYPE_P
(orig_rettype))
diff --git a/gcc/testsuite/c-c++-common/gomp/pr111856.c
b/gcc/testsuite/c-c++-common/gomp/pr111856.c
new file mode 100644
index 00000000000..bd723519b7c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr111856.c
@@ -0,0 +1,12 @@
+/* PR middle-end/111856 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp-simd" } */
+
+typedef void T;
+
+int array[1000];
+#pragma omp declare simd notinbranch simdlen(4)
+T foo (int i)
+{
+ array[i] = 555;
+}
--
2.52.0