OpenMP: Use VOID_TYPE_P for void return type checks in SIMD function clones.
Fixes OpenMP SIMD function cloning to correctly handle void return types via typedefs, preventing compiler crashes.
This change updates OpenMP’s SIMD function cloning to use VOID_TYPE_P for checking void return types. Previously, functions with void return types defined via typedefs could cause an Internal Compiler Error (ICE) during compilation. The fix ensures these cases are handled correctly, and a new test case has been added to verify the fix.
In Details
The change modifies simd_clone_adjust_return_type and simd_clone_adjust in omp-simd-clone.cc. It replaces a direct comparison to void_type_node with VOID_TYPE_P to correctly identify void return types, particularly when they are aliased through typedefs. This prevents an ICE in cases involving pragma omp declare simd on functions returning void via such type aliases.
- VOID_TYPE_P
- A GCC internal function that checks if a given type node represents a void type. This is more robust than directly comparing against the void type node, especially when dealing with type aliases.
- SIMD function clones
- In OpenMP, when
declare simdis used, the compiler generates specialized versions of functions that can operate on multiple data elements in parallel, often using SIMD (Single Instruction, Multiple Data) instructions. These specialized versions are 'clones' of the original function. - Internal Compiler Error (ICE)
- An unrecoverable error within the compiler itself. Unlike user code errors, an ICE indicates a bug in the compiler, often resulting in a crash and the inability to generate executable code.
- typedef
- A keyword in C and C++ used to create an alias for an existing type. For example,
typedef void MyVoid;creates an aliasMyVoidfor thevoidtype.