Hi Jakub!

On 2023-08-09T20:17:50+0200, Jakub Jelinek via Gcc-patches 
<gcc-patches@gcc.gnu.org> wrote:
> The following patch introduces the middle-end part of the _BitInt
> support, a new BITINT_TYPE, handling it where needed, except the lowering
> pass and sanitizer support.

Minor comment/question: are we doing away with the property that
'assert'-like "calls" must not have side effects?  Per 'gcc/system.h',
this is "OK" for 'gcc_assert' for '#if ENABLE_ASSERT_CHECKING' or
'#elif (GCC_VERSION >= 4005)' -- that is, GCC 4.5, which is always-true,
thus the "offending" '#else' is never active.  However, it's different
for standard 'assert' and 'gcc_checking_assert', so I'm not sure if
that's a good property for 'gcc_assert' only?  For example, see also
<https://gcc.gnu.org/PR6906> "warn about asserts with side effects", or
recent <https://gcc.gnu.org/PR111144>
"RFE: could -fanalyzer warn about assertions that have side effects?".

> --- gcc/expr.cc.jj    2023-08-08 16:02:52.837633995 +0200
> +++ gcc/expr.cc       2023-08-09 10:30:13.524295673 +0200

> @@ -11002,13 +11028,35 @@ expand_expr_real_1 (tree exp, rtx target

> +         struct bitint_info info;
> +         gcc_assert (targetm.c.bitint_type_info (prec, &info));
> +         scalar_int_mode limb_mode
> +           = as_a <scalar_int_mode> (info.limb_mode);

> --- gcc/fold-const.cc.jj      2023-08-08 15:55:06.507164442 +0200
> +++ gcc/fold-const.cc 2023-08-08 16:12:02.318939952 +0200

> @@ -7714,7 +7726,29 @@ static int

> +      struct bitint_info info;
> +      gcc_assert (targetm.c.bitint_type_info (TYPE_PRECISION (type),
> +                                           &info));
> +      scalar_int_mode limb_mode = as_a <scalar_int_mode> (info.limb_mode);

> @@ -8622,7 +8656,29 @@ native_encode_initializer (tree init, un

> +      struct bitint_info info;
> +      gcc_assert (targetm.c.bitint_type_info (TYPE_PRECISION (type),
> +                                           &info));
> +      scalar_int_mode limb_mode = as_a <scalar_int_mode> (info.limb_mode);

> --- gcc/gimple-fold.cc.jj     2023-08-08 15:55:06.609163014 +0200
> +++ gcc/gimple-fold.cc        2023-08-08 16:18:44.828303852 +0200

> +static bool
> +clear_padding_bitint_needs_padding_p (tree type)
> +{
> +  struct bitint_info info;
> +  gcc_assert (targetm.c.bitint_type_info (TYPE_PRECISION (type), &info));
> +  if (info.extended)
> +    return false;

> @@ -4854,6 +4877,57 @@ clear_padding_type (clear_padding_struct

> +     struct bitint_info info;
> +     gcc_assert (targetm.c.bitint_type_info (TYPE_PRECISION (type), &info));
> +     scalar_int_mode limb_mode = as_a <scalar_int_mode> (info.limb_mode);

> --- gcc/stor-layout.cc.jj     2023-08-08 15:54:34.855607692 +0200
> +++ gcc/stor-layout.cc        2023-08-08 16:15:41.003877836 +0200

> @@ -2148,6 +2148,22 @@ finish_bitfield_representative (tree rep

> +       struct bitint_info info;
> +       unsigned prec = TYPE_PRECISION (TREE_TYPE (field));
> +       gcc_assert (targetm.c.bitint_type_info (prec, &info));
> +       scalar_int_mode limb_mode = as_a <scalar_int_mode> (info.limb_mode);

> @@ -2393,6 +2409,64 @@ layout_type (tree type)

> +     struct bitint_info info;
> +     int cnt;
> +     gcc_assert (targetm.c.bitint_type_info (TYPE_PRECISION (type), &info));
> +     scalar_int_mode limb_mode = as_a <scalar_int_mode> (info.limb_mode);

> --- gcc/varasm.cc.jj  2023-08-08 15:54:35.517598423 +0200
> +++ gcc/varasm.cc     2023-08-08 16:12:02.330939784 +0200

> @@ -5281,6 +5281,61 @@ output_constant (tree exp, unsigned HOST

> +       struct bitint_info info;
> +       tree type = TREE_TYPE (exp);
> +       gcc_assert (targetm.c.bitint_type_info (TYPE_PRECISION (type),
> +                                               &info));
> +       scalar_int_mode limb_mode = as_a <scalar_int_mode> (info.limb_mode);


Grüße
 Thomas
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955

Reply via email to