Reject creating arrays of fieldless structs

Investigating a bug in a project using libgccjit revealed a problem where
fields within a struct within the JIT-created code weren't laid out in the
same places as the supposedly same struct in normally-built code:

  struct foo
  {
    int a;
    int b;
    int c;
  };

  struct bar
  {
    int d;
    struct foo e[20];
    int f; /* <<< error here */
  };

Field "f" was erroneously compiled as if "e" was only 4 bytes in size.

The root cause turned out to be that the client code was creating the
array type for
    struct foo e[20]
before the fields of "struct foo" had been set, hence the call to
layout_type for the array type would fail this conditional:
  2168  /* We need to know both bounds in order to compute the size.  */
  2169  if (index && TYPE_MAX_VALUE (index) && TYPE_MIN_VALUE (index)
  2170      && TYPE_SIZE (element))
because TYPE_SIZE(element) was 0 at that time.

Add an error for this case, to ensure that client code can only create an
array of structs once the fields of the struct have been set up.

gcc/jit/
	* internal-api.c (gcc::jit::recording::context::new_array_type):
	Reject attempts to create an array of a struct if the fields of
	the struct haven't yet been set.
	* internal-api.h (gcc::jit::recording::type::dyn_cast_struct): New
	virtual function.
	(gcc::jit::recording::struct_::dyn_cast_struct): New, overriding
	for this subclass.
	(gcc::jit::recording::struct_::get_name): New.
Clean out state within ipa-cp.c

Certain client code that repeatedly performed in-process compilations with
optimizations and inlinable functions led to a segfault within
ipa-cp.c:propagate_effects, whilst traversing the values_topo list.

The root cause was that values_topo was not reset to NULL, and hence could
contain entities allocated by a previous compile within a then-defunct
alloc_pool.

Introduce ipa_cp_c_finalize to clean out state within ipa-cp.c and call
it from toplev::finalize.  In particular, reset values_topo back to NULL.

gcc/
	* cgraph.h (ipa_cp_c_finalize): Add prototype.
	* ipa-cp.c (ipa_cp_c_finalize): New.
	* toplev.c (toplev::finalize): Add call to ipa_cp_c_finalize.
Add type-checking for API calls that expect numeric types

gcc/jit/
	* TODO.rst (error-checking): Remove various items that either
	already were implemented, or are implemented by this commit.
	* internal-api.h (gcc::jit::recording::type::is_numeric): New.
	* libgccjit.c (RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE): New macro.
        (gcc_jit_context_new_rvalue_from_int): Verify that numeric_type is
	indeed numeric.
	(gcc_jit_context_zero): Likewise.
	(gcc_jit_context_one): Likewise.
	(gcc_jit_context_new_rvalue_from_double): Likewise.
	(gcc_jit_context_new_array_access): Likewise for type of "index".

gcc/testsuite/
	* jit.dg/test-error-index-not-a-numeric-type.c: New test case.
	* jit.dg/test-error-value-not-a-numeric-type.c: New test case.