https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111856

--- Comment #6 from Kevin Stefanov <kevinstefanov15 at gmail dot com> ---
(In reply to Drea Pinski from comment #1)
> Confirmed,
> This is obvious wrong:
>   if (orig_rettype == void_type_node)
>     return NULL_TREE;
> 
> 
> It should be:
>   if (TREE_CODE (orig_rettype) == VOID_TYPE)
>     return NULL_TREE;

I did this code change and compiling the same test program made GCC crash at
another place:

0x6a2ce8 simd_clone_adjust
        ../../gcc/gcc/omp-simd-clone.cc:1373

I looked there, it's in the function simd_clone_adjust, it had the exact same
IF check, so I applied the above code change there too and when compiling the
same test program, this time GCC crashes at a third place, in the same
function, at this ELSE statement:

else
  veclen = exact_div (veclen,
                      GET_MODE_BITSIZE (SCALAR_TYPE_MODE (orig_rettype)));

I tried wrapping orig_rettype in TREE_CODE() here too, but this time even GCC
itself couldn't compile.

Also, I noticed the function simd_clone_adjust_return_type returns void and has
a simple "return;" after the IF check in your code snippet from 2023, it
doesn't return NULL_TREE anymore. I'm assuming fndecl is a pointer through
which the function stores its result now.

Apart from looking at the classes and macro definitions that are used here to
try paint a clearer picture for myself, I'm a little lost. Can you point me to
some part of GCC internals or maybe a part of the codebase or another resource
I can go read, which could give me some context on what's going on, what the
code I'm touching does, and hopefully that will give me ideas on what I should
try to do next?

Reply via email to