Some really strange GIMPLE
David Malcolm
dmalcolm@redhat.com
Tue Apr 27 20:26:35 GMT 2021
On Tue, 2021-04-27 at 20:10 +0000, Gary Oblock via Gcc wrote:
> I'm chasing a bug and I used Creduce to produce a
> reduced test case. However, that's really beside to
> point.
>
> I this file:
> --------------------------------
> typedef struct basket {
> } a;
> long b;
> a *basket;
> int d, c, e;
> a *flake[2];
> void primal_bea_mpp();
> void primal_net_simplex() {
> flake[1] = &basket[1];
> primal_bea_mpp(d, d, d, b, flake, 0, e, c, c, d);
> }
> --------------------------------
> Produces this GIMPLE:
> ---------------------------------
> ;; Function primal_net_simplex (primal_net_simplex, funcdef_no=3,
> decl_uid=4447, cgraph_uid=16, symbol_order=41) (executed once)
>
> primal_net_simplex ()
> {
> <bb 2> [local count: 1073741824]:
> _1 = basket;
> static struct a * flake[2];
> struct a *[2]
> flake[1] = _1;
> _2 = d;
> _3 = c;
> _4 = e;
> _5 = b;
> primal_bea_mpp (_2, _2, _2, _5, &flake, 0, _4, _3, _3, _2);
> return;
>
> }
> --------------------------------------
> These standard calls were used to dump this:
>
> FOR_EACH_FUNCTION_WITH_GIMPLE_BODY ( node)
> {
> struct function *func = DECL_STRUCT_FUNCTION ( node->decl);
> dump_function_header ( file, func->decl, (dump_flags_t)0);
> dump_function_to_file ( func->decl, file, (dump_flags_t)0);
> }
>
> The GIMPLE above looks malformed to me. Is that the case
> or am I not grasping what's going on here?
What about it looks malformed to you?
The declaration of primal_bea_mpp and primal_net_simplex could probably
use some parameters, rather than being empty, which might make things
look more sane [1]. I think -Wstrict-prototypes will catch this.
Dave
[1] https://wiki.sei.cmu.edu/confluence/display/c/DCL20-C.+Explicitly+specify+void+when+a+function+accepts+no+arguments
More information about the Gcc
mailing list