[Bug go/108426] [13 regression] SEGV in contains_struct_check

2023-01-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108426

--- Comment #10 from Andrew Pinski  ---
(In reply to Ian Lance Taylor from comment #9)
> I agree that if the middle-end is going to generate calls to builtin
> functions, it would be nice if the middle-end provided a function to call to
> define those functions.

I was thinking about this too. Maybe we could split up builtins.def some more
and then have the ones which are needed for the middle-end usage done in a
function which can be used by all front-ends. I noticed some backends do
include some of the *.def files to build the functions (e.g. fortran to build
the omp/acc ones) so it would be nice if that is all handled in the middle-end.
NOTE that is also stage 1 change rather than stage 3/4 changes.

[Bug go/108426] [13 regression] SEGV in contains_struct_check

2023-01-17 Thread ian at airs dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108426

--- Comment #9 from Ian Lance Taylor  ---
I agree that if the middle-end is going to generate calls to builtin functions,
it would be nice if the middle-end provided a function to call to define those
functions.

[Bug go/108426] [13 regression] SEGV in contains_struct_check

2023-01-17 Thread ian at airs dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108426

Ian Lance Taylor  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Ian Lance Taylor  ---
I committed the patch.

[Bug go/108426] [13 regression] SEGV in contains_struct_check

2023-01-17 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108426

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Ian Lance Taylor :

https://gcc.gnu.org/g:6d80690132a2f00fae1f619d4ffd950ce8cfdbc7

commit r13-5231-g6d80690132a2f00fae1f619d4ffd950ce8cfdbc7
Author: Ian Lance Taylor 
Date:   Tue Jan 17 09:02:49 2023 -0800

go: define two builtin functions used by middle-end

PR go/108426
* go-gcc.cc (Gcc_backend::Gcc_backend): Define __builtin_ctzl and
__builtin_clzl.  Patch by Andrew Pinski.

[Bug go/108426] [13 regression] SEGV in contains_struct_check

2023-01-17 Thread ro at CeBiTec dot Uni-Bielefeld.DE via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108426

--- Comment #6 from ro at CeBiTec dot Uni-Bielefeld.DE  ---
> --- Comment #3 from Andrew Pinski  ---
> (In reply to Andrew Pinski from comment #2)
>> Confirmed.
>> The following builtins are missing from the go front-end:
>> BUILT_IN_CLZL
>> BUILT_IN_CTZL
>> 
>> The {,LL} versions are there but not the L version.
>
> This should fix that:

It did: thanks a lot!

[Bug go/108426] [13 regression] SEGV in contains_struct_check

2023-01-16 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108426

--- Comment #5 from Richard Biener  ---
Meh, similar to build_common_tree_nodes we should have a function to build
those common builtin decls in the middle-end.  They are C ABI after all and
it's fine to use standard C named types there.

[Bug go/108426] [13 regression] SEGV in contains_struct_check

2023-01-16 Thread ian at airs dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108426

--- Comment #4 from Ian Lance Taylor  ---
Thanks Andrew, I'm testing the patch myself, but go ahead and commit if you are
satisfied with it.

[Bug go/108426] [13 regression] SEGV in contains_struct_check

2023-01-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108426

--- Comment #3 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #2)
> Confirmed.
> The following builtins are missing from the go front-end:
> BUILT_IN_CLZL
> BUILT_IN_CTZL
> 
> The {,LL} versions are there but not the L version.

This should fix that:
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index a4a0e5d903e..eea361b4f70 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -627,6 +627,11 @@ Gcc_backend::Gcc_backend()
unsigned_type_node,
NULL_TREE),
   builtin_const);
+  this->define_builtin(BUILT_IN_CTZL, "__builtin_ctzl", "ctzl",
+  build_function_type_list(integer_type_node,
+   long_unsigned_type_node,
+   NULL_TREE),
+  builtin_const);
   this->define_builtin(BUILT_IN_CTZLL, "__builtin_ctzll", "ctzll",
   build_function_type_list(integer_type_node,
long_long_unsigned_type_node,
@@ -637,6 +642,11 @@ Gcc_backend::Gcc_backend()
unsigned_type_node,
NULL_TREE),
   builtin_const);
+  this->define_builtin(BUILT_IN_CLZL, "__builtin_clzl", "clzl",
+  build_function_type_list(integer_type_node,
+   long_unsigned_type_node,
+   NULL_TREE),
+  builtin_const);
   this->define_builtin(BUILT_IN_CLZLL, "__builtin_clzll", "clzll",
   build_function_type_list(integer_type_node,
long_long_unsigned_type_node,

[Bug go/108426] [13 regression] SEGV in contains_struct_check

2023-01-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108426

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2023-01-16
   Assignee|unassigned at gcc dot gnu.org  |ian at airs dot com
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
  Component|tree-optimization   |go

--- Comment #2 from Andrew Pinski  ---
Confirmed.
The following builtins are missing from the go front-end:
BUILT_IN_CLZL
BUILT_IN_CTZL

The {,LL} versions are there but not the L version.